What a month of Codex CLI costs

A terminal agent has a cost profile that a chat interface does not, and it comes from how much you let it run without asking you.

In an interactive session you approve each step, so the loop pauses at every tool call and the human is the throttle. In a more permissive mode the agent keeps going (reading, editing, running tests, retrying) and the number of turns per task rises sharply. Since every turn re-sends the accumulated context, turns are the cost driver, and autonomy multiplies turns.

You need a key before the code below runs. Create an account, generate a key, and copy the base URL (https://aicomp.ai/v1). Create one free →
Check current rates → Free to sign up · $1 minimum top-up · No prepayment

Two shapes, one tool

The same task can land in very different places depending on how it is run:

Neither is wrong, the second is often the point of using a CLI agent. But it means a monthly figure that does not state which mode it assumes is not comparable to anything.

A day of ordinary terminal work (several tasks, a handful of file reads each), some test runs: A day of work on this page's workload is 160k input and 45k output tokens — 3.2M input and 0.9M output across a 20-day month. Unattended runs sit at the higher end of that range and interactive ones at the lower end.

Per 1M input / output tokens
ModelGateway rate
in / out per 1M tokens
One day20 days
gpt-5$0.625 / $5.00$0.32$6.50
claude-sonnet-4-6$1.5 / $7.5$0.58$11.55
deepseek-v4-flash$0.15 / $0.60$0.05$1.02
grok-4.1$1.00 / $5.00$0.39$7.70
kimi-k3$1.5 / $7.5$0.58$11.55

One day = 160k input + 45k output on this page's workload. 20 days = 3.2M input and 0.9M output. Rates checked 2026-10-27, gateway rates move with upstream promotions, so verify the current number in your dashboard before committing to a budget.

What drives the variance

Retries you never see. An unattended agent that hits a failing test will often try again with a different approach. Each attempt is a full context re-send. A task that "just took a while" may have made four attempts at the same step, and none of them appear in anything you looked at.

Test and command output. Command results become input on the next turn. A verbose test suite run inside an agent loop is not a one-time cost (the output sits in context for the turns that follow it).

Context growth within a task. The same compounding as any agent: turn 15 pays for turn 1's tokens fifteen times. Long unattended tasks are where this gets expensive, because nothing interrupts the growth.

Where this is cheaper than an IDE agent

Worth saying, since terminal agents are often assumed to be the expensive option. A CLI session usually carries less ambient context than an editor session, no open tabs, no editor state, no language-server diagnostics in the payload. Per turn, the request can be meaningfully smaller. The cost shows up in turn count and autonomy instead.

So the practical comparison is not "terminal versus editor" but "how many turns does each one need for this task". A task that takes 6 turns in the terminal and 20 in an editor is cheaper in the terminal even at identical rates.

Keeping it predictable

The useful habit is to run unattended modes on tasks you can bound, and interactive modes on ones you cannot. Bounding a task — "fix these three failing tests" rather than "improve the test suite". Caps the number of turns, which caps the cost, without giving up the convenience.

Get API access

FAQ

FAQ

Is Codex CLI more expensive than using an editor agent?

Per turn, often less: less ambient context in the request. The cost variable is turn count, and unattended runs produce more turns than interactive ones. Compare turns per task, not tool category.

Why did an unattended run cost more than the same task interactively?

Because it took more turns. Autonomy removes the pauses where you would have redirected or stopped it, so retries and exploratory steps accumulate, and each one re-sends the full context built so far.

Does running tests inside the agent add much?

It adds input tokens on every subsequent turn, not just once. Verbose command output stays in the context, so a noisy test run early in a task is paid for repeatedly as the task continues.

How do I estimate a month before committing?

Count turns rather than tasks. A few turns per task with a modest context is the cheap shape; many turns with growing context is the expensive one. The table above prices a middle case across five models.

Can I cap the cost of an unattended run?

Indirectly, by bounding the task and limiting retries. A narrow, verifiable objective finishes in fewer turns, and fewer turns is the only lever that reduces both directions of spend at once.

Related

Get API access

GPT rate card