How much do AI coding agents cost per month?
On pay-per-token pricing, an AI coding agent typically costs anywhere from a few dollars to several hundred dollars per developer per month, and the spread comes almost entirely from three things: which model you run, how long your sessions get, and whether the repeated context is cached. Agents re-send the whole conversation, file contents and tool output on every turn, so input tokens dominate. Pick the model per task, cache the prefix, and keep sessions short, and the same work costs a fraction as much.
Why do AI coding agents use so many tokens?
A chat completion is stateless. The model doesn’t remember the last turn, so the client sends the entire conversation again every time. A chat assistant does this too, but a coding agent makes it much worse because each turn is a loop of model calls and tool calls, and every tool result goes back into the context.
- The system prompt and tool definitions. Agents ship long instructions plus JSON schemas for every tool (read file, edit, run command, search). That block is sent on every single call, often several thousand tokens before you type anything.
- Context re-sent each turn. Turn 30 of a session carries turns 1 through 29 with it. Input per call grows roughly linearly, so total input over a session grows roughly with the square of its length.
- Tool output. A file read, a test run or a
grepresult lands in the context and stays there. One noisy test log can add tens of thousands of tokens to every later call. - Reasoning tokens. Models that think before answering bill that thinking as output, and output is usually priced several times higher than input. The pricing explainer covers how input, output, cached and reasoning tokens are billed.
The practical result: in a long agent session, input tokens are usually the large majority of the bill, and most of those input tokens are the same prefix sent again. That is why caching and context hygiene move the number more than haggling over output price. If you want a feel for the units, tokens explained translates tokens into words and lines of code.
What does a month of agentic coding cost? A worked example
The numbers below are hypothetical round numbers chosen to make the arithmetic visible. They are not the price of any specific model and not a measurement of any tool. Plug in your own model’s rates from the live models page and your own usage.
| Assumption | Hypothetical value |
|---|---|
| Turns (model calls) per session | 40 |
| Average input per call, as context grows from ~20k to ~80k tokens | 50,000 tokens |
| Output per call | 1,000 tokens |
| Input rate / output rate | $3 / $15 per million tokens |
| Cached input rate (prefix already seen) | $0.30 per million tokens |
| Sessions per month | 60 (about 3 per working day) |
Without caching, one session is 40 x 50,000 = 2,000,000 input tokens ($6.00) plus 40,000 output tokens ($0.60), so about $6.60 per session and roughly $400 per month. Notice that output is under a tenth of it.
Now assume 90% of each call’s input is a prefix the provider has already seen and bills at the cached rate. Input becomes 1,800,000 cached tokens ($0.54) plus 200,000 fresh tokens ($0.60), plus the same $0.60 of output: about $1.74 per session, roughly $105 per month. Same work, about a quarter of the cost, and the only change was cache hits.
Move half of those sessions (the routine ones: renames, test fixes, boilerplate) to a model with hypothetical rates one-fifth as high, and the month drops again to somewhere around $60-65. Cap session length so average context stays near 30,000 instead of 50,000, and it falls further. None of these levers requires a different tool, only different settings.
Subscription or pay-per-token: which is cheaper for coding agents?
Coding tools are sold two ways, and neither is always cheaper. A subscription is a flat monthly fee with usage limits, often expressed as rate windows or a monthly allowance, and usually tied to the vendor’s chosen models. Pay-per-token through an API bills exactly what you send, with no ceiling unless you set one.
| Subscription | Pay-per-token API | |
|---|---|---|
| Cost shape | Flat; predictable until you hit the limit | Variable; scales with tokens used |
| Light or bursty use | You pay for capacity you don’t use | You pay only for what you send |
| Heavy daily use | Often good value until limits throttle you | Can exceed a subscription without caps and caching |
| Model choice | Whatever the vendor offers in the plan | Any model your endpoint serves, per task |
| Cost control | Set by the plan’s limits | Set by you: spend caps, model choice, caching |
| Visibility | Usually an allowance meter | Per-request and per-key usage |
A reasonable rule: if you code with an agent all day, every day, on one vendor’s models, compare your measured token use against the plan’s limits before deciding. If your use is uneven, spread across several tools, or you want to pick models per task, pay-per-token with spend caps tends to be easier to reason about. Many teams do both: a subscription for the main editor and API keys for CLI agents and automation.
How do I cut the cost of AI coding agents?
In rough order of impact for a typical agent workload:
| Lever | What it reduces | How |
|---|---|---|
| Model choice per task | Price per token on every call | Reserve the strongest model for hard tasks; use a cheaper coder for routine edits. |
| Small/fast model for background work | Cost of titles, summaries, quick checks | Most agents let you set a second, cheaper model for auxiliary calls. |
| Prompt (prefix) caching | Input cost of the repeated prefix | Keep the system prompt and early turns stable so providers bill them as cached. |
| Context hygiene | Input size per call | Start new sessions per task, compact or summarize, avoid dumping huge logs. |
| Spend caps per key | Runaway sessions and leaked keys | One key per tool or teammate, each with a cap and a model allowlist. |
Choose the model per task
The gap between frontier models and strong open-weight coders is large on price and often small on routine work. Renames, test fixes, docstrings and boilerplate rarely need the most expensive model. Open-weight coders such as Qwen3 Coder, DeepSeek V4 and GLM-5 are worth trying for that tier; the open-weight models guide compares them. If you want the choice made per request, model: "auto" routes to the cheapest model that can do the task, though an agent that expects a consistent model may behave better with a fixed id. The model routing guide covers that trade-off.
Cache the prefix, not the answer
Agent requests are almost never byte-identical, so classic response caching rarely hits for them. On Smouter, exact response caching only applies to deterministic requests (explicit temperature: 0 or a pinned seed), which agents don’t usually send. The saving that matters is prefix caching: when the start of the prompt is unchanged, providers that support it bill those tokens at a reduced cached rate. Stable system prompts and append-only history keep that prefix intact; editing early messages or reordering tools breaks it. The caching guide explains the difference in detail.
Keep context small
Start a new session for each task instead of one session per day. Use your agent’s compact or summarize command when a session drags on. Point the agent at specific files rather than letting it read the whole tree, and trim test output to the failures. Every token you keep out of turn 5 is a token you don’t pay for again on turns 6 through 40.
Cap spend per key
Give each tool and each teammate its own key with a spend cap and, if useful, a model allowlist. A runaway loop or a key pasted into the wrong place then stops at the cap with a 402 instead of draining the wallet. Organizations share one wallet across members, so caps per key are how you keep one person’s experiment from eating the team budget. More levers that apply beyond coding are in how to reduce LLM API costs.
How do I point Cursor, Cline, Aider and other agents at one key?
Almost every coding agent accepts either an OpenAI-compatible base URL or an Anthropic-compatible one. OpenAI-style tools use https://api.smouter.ai/v1; Claude Code uses https://api.smouter.ai without the /v1. The key and the model id are the same everywhere, so one wallet covers all of them.
| Tool | Where the endpoint goes | Setup guide |
|---|---|---|
| Claude Code | ANTHROPIC_BASE_URL env var or ~/.claude/settings.json | Claude Code |
| Cursor | Settings, Models: override the OpenAI base URL, add custom models | Cursor |
| Cline | Panel settings: API Provider set to OpenAI Compatible | Cline |
| Roo Code / Kilo Code | Provider settings: OpenAI Compatible | Roo Code, Kilo Code |
| Aider | OPENAI_API_BASE env var, --model "openai/<model-id>" | Aider |
| Codex CLI | A model_providers entry in ~/.codex/config.toml | Codex CLI |
| OpenCode | A provider block in opencode.json | OpenCode |
| Continue / Zed | Model or provider block in the tool’s config file | Continue, Zed |
# OpenAI-style agents (Aider shown; most read the same two variables)
export OPENAI_API_BASE="https://api.smouter.ai/v1"
export OPENAI_API_KEY="sk-smouter-..."
aider --model "openai/<model-id>"
# Anthropic-style agents (Claude Code): bare host, no /v1
export ANTHROPIC_BASE_URL="https://api.smouter.ai"
export ANTHROPIC_AUTH_TOKEN="sk-smouter-..."
export ANTHROPIC_MODEL="<model-id>"
claudeTwo scope notes. Cursor’s override covers features that call OpenAI-style chat models; Cursor-native features with their own backend, such as Tab autocomplete, don’t go through a custom endpoint. And running Claude Code against a non-Claude model works mechanically but varies in quality; using Claude Code with other models covers what to expect. Any tool not listed takes the same three values; see any OpenAI client.
Frequently asked questions
How much does Claude Code cost per month on API pricing?
It depends on the model, session length and cache hit rate, not on Claude Code itself. A long session can send millions of input tokens because the context is re-sent every turn. With a mid-priced model and good prefix caching, regular daily use can land in the tens of dollars per month; with a frontier model and no caching it can run to hundreds.
Why are input tokens most of my coding agent bill?
Agents re-send the system prompt, tool definitions, conversation history and every tool result on each call. By turn 30 a single request can carry tens of thousands of tokens of context, while the model writes only a few hundred or a few thousand back. Output is priced higher per token, but input volume is usually far larger.
Is a subscription cheaper than paying per token for coding agents?
For heavy, steady use of one vendor’s models, a flat subscription can be good value until you hit its usage limits. For uneven use, several tools, or picking models per task, pay-per-token with spend caps is often cheaper and easier to control. Measure your actual monthly token use before deciding, since the answer depends on it.
Does prompt caching work with Cursor, Cline or Aider?
Prefix caching is applied by the upstream provider when the start of a prompt matches a recent request, so it depends on the model and on the tool keeping its prompt stable. Agents that append to history without rewriting earlier messages benefit most. Exact response caching rarely applies to agents, because their requests are almost never identical.
Can I use one API key for Cursor, Claude Code and Cline?
Yes. With a gateway, OpenAI-style tools use the /v1 base URL and Claude Code uses the bare host, but the key and model ids are the same. A better practice is one key per tool, each with its own spend cap, so usage is broken down per tool and a runaway session in one can’t drain the others.
Which model should I use for routine coding tasks?
Try a strong open-weight coder for renames, test fixes, boilerplate and small refactors, and keep the most capable model for design work and hard debugging. Agents that support a second small/fast model can use a cheap one for background calls. Compare on your own repository, since quality on real tasks varies more than benchmarks suggest.