Why We Chose Flat-Rate CLI Over Per-Token API Pricing
One of the most important architectural decisions we made early on was how to call the AI model. The two options:
- API mode: Direct HTTP calls to Anthropic’s Messages API. Pay per input/output token.
- CLI mode: Run Claude Code CLI inside each agent’s container, authenticated via OAuth with a Max plan subscription. Flat monthly rate, unlimited queries.
We chose CLI mode as our primary, and API as a fallback. Here’s why.
The Math
A busy agent handling 50 conversations per day, averaging 2,000 tokens per exchange, burns through ~3M tokens daily. At Anthropic’s API pricing, that’s roughly $45/day or $1,350/month — for a single agent.
With a Claude Max plan at $200/month, that same agent costs… $200/month. Regardless of volume.
When you’re running 6 agents, the difference is staggering: $8,100/month (API) vs $1,200/month (CLI). That’s a 6.75x cost reduction.
The Tradeoffs
CLI mode isn’t perfect:
- Queries are blocking (5-60s) — but we handle this with async Task dispatch
- No streaming API — but we built our own streaming layer with the SDK daemon
- Session management is more complex — but the Claude Agent SDK handles this now
For high-volume, predictable workloads, flat-rate wins. For occasional, low-volume agents or specialized tasks that need specific API features, we fall back to API mode.
The Hybrid Approach
Our model router classifies each query and picks the right mode. Quick factual questions go to Haiku (API, cheap). Complex multi-step tasks go to Sonnet (CLI, flat-rate). The router considers query complexity, agent plan tier, and provider health before making the call.
The result: optimal cost and performance for every query.