Back to guides
Prices·September 11, 2026·Updated October 3, 2026·10 min read

Codex pricing—how much a real task costs through the API, and when the plan pays off

One side of the calculation is the plan’s monthly fee; the other, which nobody does, is the token cost of a real task. Here are both, and the calculation that decides.

Codex has two ways to pay, and almost every answer to “How much does Codex cost?” covers only one. With a ChatGPT plan, Codex is included in a fixed monthly fee with usage limits set by OpenAI. With an API key, you pay per token — input, cached input, and output — with no monthly fee: on Kunavo, GPT-5.6 Sol, the model we recommend as the Codex default, costs $2,00 per 1M input tokens, $0,20 for cached input, and $12,00 for output, and a real 20-step task costs about $0,62 ($1,29 without cache). Which option is cheaper comes down to a division: the plan's monthly fee ÷ the cost of one task. Heavy interactive use every day tends to favor the plan; bursty or automated use favors the API.

This page doesn't reproduce OpenAI's plan pricing — it changes, and anyone who copies it will be wrong the following week; the current price is on the ChatGPT plans page. Instead, it does the calculation plan comparisons leave out: the price per token, a real task calculated line by line, and the break-even point you can fill in using your plan's price. Rates verified on October 3, 2026; Kunavo prices are read live from the model catalog.

The two ways to pay for Codex

ChatGPT planAPI key (per token)
How you're chargedFixed monthly feePer token: input, cached input, and output
LimitsUsage windows set by OpenAINo usage window; the limits are your balance and the cap you set on the key
A quiet monthFully billed$0
A busy monthMay hit the limit and require waiting for the windowTracks your work — and so does the bill
Automation (CI, scripts)Your ChatGPT account loginOne key per job, with its own spend limit

The two options don't stack, but they can coexist: you can keep the plan and use the key only on days when you hit the limit, replacing model_provider in the config.toml.

Price per token: models that make sense for Codex

ModelWhen to useKunavo per 1M (input / cached / output)OpenAI list price (input / output)20-step task
GPT-5.6 SolDefault: most coding tasks$2,00 / $0,20 / $12,00$5,00 / $30,00
promo $4,00 / $20,00 (at least until November 21, 2026)
$0,62
GPT-6 AstraOnly the toughest ones — the bug that resisted, the major refactor$4,00 / $0,40 / $20,00$10,00 / $50,00$1,14
GPT-5.6 TerraRoutine, well-defined steps and mechanical tasks: renaming, formatting, summarizing a diff$0,70 / $0,07 / $4,20$2,00 / $12,00$0,22

Cached input is billed at 0.10× the input price; cache writes cost 1.25× the input price on GPT-5.6 Sol/Terra and GPT-6 Astra. The OpenAI column comes from the same catalog, so you can check it rather than take our word for it — on GPT-5.6 Sol, Kunavo is approximately 60% below the list price, and approximately 40% below the promotional price OpenAI currently charges today. The full model details are in GPT-5.6 Sol on Kunavo.

A real task, line by line

Codex is agentic: one request from you becomes many billable round trips to the model. The unit that matters is the step — reading context, proposing an edit or running a command, then reporting back. Since the tool resends context at every step, a typical step has about 25,000 input tokens and 1,200 output tokens. Most of the input is repeated (instructions, files already read) and comes from cache: we assume 20,000 cached tokens and 5,000 new ones, and count the new ones as cache writes at 1.25× — the pessimistic case.

Component (GPT-5.6 Sol)Tokens per stepRate per 1MCost per step
Input read from cache20.000$0,20 (0,10×)$0,0040
New input, written to cache5.000$2,50 (1,25×)$0,013
Output (includes reasoning)1.200$12,00$0,014
One step——$0,031
20-step task×20—$0,62
The same task without cache×20—$1,29
The same task at OpenAI list price, with cache×20—$1,54
The same task at OpenAI's current promotional price, with cache (at least until November 21, 2026)×20—$1,14

To replace the assumptions with your own figures, take the usage returned by the API — total input, cached input, and output — and plug them into this formula:

custo_codex.py
# Quanto custou uma tarefa do Codex, a partir do usage que a API devolve.
IN, OUT = 2.00, 12.00   # USD por 1M de tokens (gpt-5-6-sol na Kunavo)
LEITURA, GRAVACAO = 0.10, 1.25   # multiplicadores de cache sobre o input

def custo(input_total, em_cache, output, gravado=0):
    novo = input_total - em_cache - gravado
    return (novo * IN
            + em_cache * IN * LEITURA
            + gravado * IN * GRAVACAO
            + output * OUT) / 1_000_000   # output inclui reasoning

# 20 passos: 500 mil de input (400 mil em cache, 100 mil gravados), 24 mil de output
print(round(custo(500_000, 400_000, 24_000, 100_000), 2))

Plan or API: the break-even point

It's one division: monthly fee ÷ cost of one task = tasks per month the plan needs to replace to be worthwhile. Using the 20-step task from GPT-5.6 Sol:

Monthly fee (example)Breaks even with cache ($0,62 per task)Breaks even without cache ($1,29 per task)
$20/month~32 tasks~16 tasks
$100/month~162 tasks~78 tasks
$200/month~324 tasks~155 tasks

The monthly fees are round example figures for you to replace, not OpenAI's price list. The honest answer depends on your usage pattern:

  • Heavy interactive use every day: Five tasks per workday is about 110 per month — $67,98 at the GPT-5.6 Sol token rate. A subscription below this amount costs less, provided its usage limits can accommodate this volume.
  • In bursts: Three intense days a month with 15 tasks add up to $9,27. That's below any monthly fee, and a month without coding costs $0.
  • Automation (CI, scripts, unattended agents): a key is the natural fit — one per job, with a monthly spend limit per key (the API returns 402 when the limit is reached) and an IP allowlist, configured under /app/keys.

One detail points in the same direction: the heavy-use days you subscribe for are exactly the days you hit the limit — and a reached limit means paid capacity that isn't delivered. A monthly fee is predictable, while a token bill isn't, which matters for a team budget.

Running Codex CLI with a per-token key

One constraint rules out most gateways: Codex CLI only accepts wire_api = "responses", so the endpoint must serve POST /v1/responses, not just Chat Completions. Kunavo serves both:

~/.codex/config.toml
# ~/.codex/config.toml — o Codex CLI numa chave por token, sem plano.
model = "gpt-5-6-sol"
model_provider = "kunavo"

[model_providers.kunavo]
name = "Kunavo"
base_url = "https://api.kunavo.com/v1"
env_key = "KUNAVO_API_KEY"     # o NOME da variável, não a chave
wire_api = "responses"         # o único valor aceito (e o padrão)
terminal
export KUNAVO_API_KEY=sk-kn-...   # crie em /app/keys

codex                          # usa o modelo do config.toml (gpt-5-6-sol)
codex -m gpt-5-6-terra           # tarefa mecânica: o modelo mais barato
codex -m gpt-6-astra             # só quando o GPT-5.6 Sol não resolveu

The key never goes in the file: env_key is the name of an environment variable that Codex reads at startup. Each field is explained in the Codex CLI integration documentation, and the step-by-step guide in Portuguese, including the most common 401 and 404 errors, is in the Codex CLI API key guide (an English version is also available).

What changes the actual number

Reasoning tokens. GPT models think before they respond, and that reasoning is billed as output without appearing in the diff. Every additional 1,000 output tokens per step adds $0,012 on GPT-5.6 Sol, or $0,24 for a 20-step task. Check the billed output in the usage, not the response length.

Cache. It's the biggest lever, bigger than switching models: the same task costs $1,29 without cache and $0,62 with cache. Sessions that keep context stable benefit the most. The OpenAI API pricing calculator has a field for this.

Long context. The GPT-5.6 family and GPT-6 Astra charge the ENTIRE request at 2× the input price / 1.5× the output price above 272,000 prompt tokens. If a session has grown too large, starting a new one costs less than continuing the same session.

Model per step. The same 20-step task costs $0,22 on GPT-5.6 Terra, $0,62 on GPT-5.6 Sol, and $1,14 on GPT-6 Astra. Reserve GPT-6 Astra for what GPT-5.6 Sol couldn't solve.

Failures. Failed requests aren't charged on Kunavo. A successful retry, however, is a billable call like any other.

Paying from Brazil: Pix at checkout

Token rates are in dollars, and top-ups go through Stripe Checkout. For those paying from Brazil, Pix appears as a payment method: Stripe converts and displays the amount in reais before you confirm, and settlement is immediate. Cards (Visa, Mastercard, American Express), Apple Pay, Google Pay, and Link also work. The step-by-step instructions, including the QR code and copy-and-paste option, are in the guide to paying for the API with Pix.

The wallet is prepaid: a minimum top-up of $10, no subscription, and the balance never expires. Larger top-ups earn a bonus—$100 becomes $110.00 and $1,000 becomes $1,200.00. Based on the calculation above, $10 covers approximately 16 20-step tasks on GPT-5.6 Sol.

Honestly: when Kunavo isn't the right choice

The trade-off versus going directly to OpenAI is shared capacity: there is no dedicated quota or contractual SLA. If you need a guaranteed quota or an SLA by contract, go directly to OpenAI. And as the calculation above shows, anyone using Codex heavily and interactively every day may pay less with a subscription. What the key offers is everything else: no monthly fee, rates below list price, and a single key for GPT and Claude.

Codex or Claude Code

Both are agentic CLIs billed per step, so the calculation on this page applies to both — only the rate changes. The Claude side, using the same unit of 25,000 / 1,200 tokens, is covered in Claude Code pricing, and the tool comparison is in Claude Code vs Codex (in English). One Kunavo key gives you access to both, making the choice a -m argument instead of requiring a second account.

Frequently asked questions

How much does Codex cost?

Codex has two pricing options. With a ChatGPT plan, it's included in a fixed monthly fee with usage limits set by OpenAI (the current price is on the ChatGPT plans page). With an API key, you pay per token, with no monthly fee: on Kunavo, GPT-5.6 Sol, the model recommended as the Codex default, costs $2,00 per 1M input tokens, $0,20 for cached input, and $12,00 for output, compared with $5,00 / $30,00 at OpenAI's list price (OpenAI currently charges the promotional price of $4,00 / $20,00, available at least until November 21, 2026 according to the pricing page). A 20-step task (25,000 input tokens per step, 80% cached, 1,200 output tokens) costs about $0,62.

Is Codex free?

Codex CLI is free and open source, but running the model never is: every step Codex takes is a billable call, either deducted from a plan's limit or charged to an API key. Whether ChatGPT's free plan includes Codex, and to what extent, is a setting that OpenAI may change — check the plans page. The no-subscription option is paying per token with a key: a month when you don't code costs $0.

What is OpenAI Codex's API pricing?

With the API, Codex CLI charges for the tokens used by whichever model you choose. On Kunavo, per 1M input / output tokens: GPT-5.6 Sol $2,00 / $12,00, GPT-6 Astra $4,00 / $20,00, and GPT-5.6 Terra $0,70 / $4,20. Cached input costs 0.10× the input price, and cache writes cost 1.25× the input price for these four models.

Is a ChatGPT plan or the API better value for using Codex?

Divide the plan's monthly fee by the cost of one task: the result is how many tasks per month the plan needs to replace to be worthwhile. For a 20-step task costing $0,62 on GPT-5.6 Sol, a $20 monthly fee breaks even at about 32 tasks, and a $100 fee at about 162 (example amounts, not OpenAI's price list). Heavy interactive use every day exceeds these figures, so the plan tends to win as long as its limits can handle it. Bursty or automated use stays below them, so the API wins.

How much does a Codex task cost?

It depends on steps, not hours. A typical step has about 25,000 input tokens because Codex resends the context on every model call, and 1,200 output tokens. On GPT-5.6 Sol through Kunavo, with 20,000 of those tokens read from the cache, one step costs $0,031 and a 20-step task costs $0,62; without caching, the same task costs $1,29. Reasoning tokens are billed as output and do not appear in the response, so check the actual usage.

Can I pay for Codex with Pix?

Through the API key option, yes: Pix tops up the Kunavo balance consumed by Codex—it does not pay for a ChatGPT plan or OpenAI directly. Rates are in dollars and the top-up goes through Stripe Checkout, where Pix appears for those paying from Brazil, with the amount converted and displayed in reais before confirmation and immediate settlement. Cards, Apple Pay, Google Pay, and Link also work. The minimum top-up is $10, the balance does not expire, and failed requests are not charged.

Which Codex model should I use to spend less?

Match the model to the step. GPT-5.6 Sol is the default for coding tasks; GPT-5.6 Terra ($0,70 / $4,20) handles routine steps and mechanical tasks for a fraction of the cost; GPT-6 Astra ($4,00 / $20,00) is worth it only when GPT-5.6 Sol could not solve the task. A weak model that needs three attempts costs more than a strong one that gets it right the first time.

Does Codex CLI work with another provider's API key?

Yes, with a [model_providers] block in ~/.codex/config.toml — but only through the Responses API: Codex accepts only wire_api = "responses", so the provider must serve POST /v1/responses. A gateway that only offers /v1/chat/completions won't run Codex. Kunavo serves /v1/responses, with base_url https://api.kunavo.com/v1.