Codex CLI Pricing Guide: Free Tier, API Costs & Money-Saving Tips

Does Codex CLI cost money? Here is the definitive answer: subscription credits, pay-as-you-go API billing, model price comparisons, and actionable tips to keep your costs as low as possible.

TL;DR

Codex CLI is effectively free for ChatGPT Plus/Pro subscribers within their included API credits. Independent API users pay per token — o4-mini costs about $1.10 per million input tokens. Most individual developers spend under $5 per month.

Overview: Is Codex CLI Free?

The Codex CLI tool itself is free and open-source. However, running it requires calls to OpenAI's model API, which has a cost. Depending on your account type, there are two distinct usage modes:

  • Mode 1: ChatGPT Plus / Pro subscription — Your subscription includes a monthly API credit allowance. Within that allowance, you pay nothing extra. Once exhausted, requests are rate-limited (no surprise charges).
  • Mode 2: Standalone API Key — You top up credit at platform.openai.com and pay for exactly what you use. Flexible and ideal for developers with variable usage.

As of 2025, ChatGPT Plus ($20/month) includes Codex CLI usage credits. Pro ($200/month) offers higher limits suitable for heavy usage. To try it completely free, new OpenAI accounts typically receive a trial credit upon signup.

i

The Codex CLI software itself is permanently free and open-source: github.com/openai/codex. You are paying for the underlying AI model calls, not the tool.

ChatGPT Plus / Pro Benefits

If you already have a ChatGPT Plus or Pro subscription, setting up Codex CLI takes just a few steps — no separate top-up required:

  1. Log in to platform.openai.com/api-keys and click "Create new secret key" to generate an API Key.
  2. In your terminal, run codex login and choose the "API Key" option when prompted.
  3. Paste your newly generated API Key and press Enter to confirm.
  4. Run codex to start the CLI and send a test message to verify everything is working.
Note

When your Plus subscription's included credits are exhausted, requests will be rate-limited (429 error) — your credit card will not be charged automatically. When you hit a 429, you can either wait for the monthly credit reset or switch to a separately funded API Key to continue.

Plan Monthly Cost Codex CLI Credits Best For
Free $0 One-time trial credit (limited) Trying it out
Plus $20 / month Moderate (covers daily dev use) Individual developers
Pro $200 / month High (supports heavy usage) Professional teams / power users
Standalone API Pay-as-you-go Unlimited (billed per token) Flexible, on-demand billing

Standalone API Billing Details

When using a standalone API Key (not subscription credits), Codex CLI is billed by the number of tokens consumed. The default model is o4-mini (reasoning-optimized, best value). Below are the 2025 prices for the main models (always verify against the OpenAI website, as prices may change):

Model Input Price Output Price Best Use Case
o4-mini (default) $1.10 / 1M tokens $4.40 / 1M tokens Daily coding, debugging
o3 $10.00 / 1M tokens $40.00 / 1M tokens Complex architecture, deep reasoning
gpt-4.1-mini $0.40 / 1M tokens $1.60 / 1M tokens Simple tasks, cost-first priority

You can switch the default model in ~/.codex/config.toml. Here is an example using gpt-4.1-mini:

~/.codex/config.toml
# Switch to a cheaper model
[model]
name = "gpt-4.1-mini"   # cheaper alternative

You can also specify the model inline for a single command without modifying your config file:

Terminal
$ codex --model gpt-4.1-mini "explain this code"
i

Token conversion reference: 1,000 tokens ≈ 750 English words. A typical code Q&A session including context usually consumes 500–3,000 tokens.

Real-World Cost Estimates

Using o4-mini ($1.10/1M input + $4.40/1M output) as the baseline, here are cost estimates for common usage scenarios:

Scenario Est. Tokens Per Request o4-mini Cost
Explain a function ~500 tokens ~$0.0006
Fix a bug ~1,500 tokens ~$0.002
Generate a complete module ~5,000 tokens ~$0.006
One workday (50 requests) ~75,000 tokens ~$0.09
One month (22 workdays) ~1,650,000 tokens ~$2.00

A typical individual developer using o4-mini will spend under $5 per month. Switching to gpt-4.1-mini can reduce that by another 65%, which is ideal for routine coding tasks.

Money-Saving Tips

With a bit of configuration, you can significantly reduce your API costs without sacrificing the experience that matters:

  1. Choose the right model for the task: Use --model gpt-4.1-mini for simple tasks (saves 60%+), and switch back to o4-mini or o3 only for complex reasoning.
  2. Set a max_tokens cap to limit output length: This prevents the model from generating unnecessarily long responses.
    ~/.codex/config.toml
    [model]
    max_tokens = 2048   # adjust as needed
  3. Use /clear to reset context: The longer a conversation runs, the more input tokens each new request carries. Starting fresh with /clear avoids paying for stale context that is no longer needed.
  4. Set approval_policy = "untrusted-only": This reduces how often Codex automatically calls tools, each of which adds token overhead.
    ~/.codex/config.toml
    approval_policy = "untrusted-only"
  5. Monitor usage regularly: Log in to platform.openai.com/usage to review your daily breakdown. Set a Hard limit under Billing → Usage limits to cap your maximum spend.

Free Trial Options

If you do not yet have an OpenAI account, or want to try Codex CLI before committing to a paid plan, here are your options:

  • New account trial credit: Newly registered OpenAI accounts typically receive $5–$18 in free credit (exact amount varies and changes over time — check the official site). This is enough for hundreds of Codex CLI requests.
  • Student / education programs: OpenAI periodically opens student verification or institutional partnership programs that provide additional credits. Check the official announcements for current availability.
  • ChatGPT Plus first-month trial: In some regions, Plus subscriptions offer a refund window. You can fully explore Codex CLI during this period before deciding whether to continue.
Warning

There is no such thing as a permanently free, unlimited Codex CLI plan. Be cautious of third-party tools claiming to "unlock free access" or "bypass API limits" — these often steal your API Key and abuse your account credits. Do not trust them.

Frequently Asked Questions

Is Codex CLI completely free?

Not entirely. The Codex CLI tool itself is free and open-source. However, it requires OpenAI API calls to function. ChatGPT Plus/Pro subscribers receive included API credits; independent API users pay per token. New accounts receive a one-time trial credit (approximately $5–$18 — see the official site for current amounts).

Are the Codex CLI credits included with ChatGPT Plus sufficient?

For typical individual developers making dozens of requests per day, the included credits are usually sufficient. Heavy users making hundreds of requests daily may encounter rate limits toward the end of the month and might need a Pro subscription or a separate API top-up.

How do I check how much API credit I have used?

Log in to platform.openai.com/usage to view real-time usage and daily cost breakdowns. It is strongly recommended to set a Hard limit under Billing → Usage limits to prevent unexpected charges.

Can I use Codex CLI with a free ChatGPT account?

Not directly. Codex CLI requires an API Key from platform.openai.com — not your ChatGPT username and password. Free accounts can apply for trial credits at platform.openai.com, but these are limited and must be topped up after they run out.

Will switching to gpt-4.1-mini reduce Codex CLI output quality?

For simple coding tasks — explaining functions, fixing small bugs, formatting code — gpt-4.1-mini performs very close to o4-mini at 2–3x lower cost, making it excellent value. For complex reasoning tasks such as architecture design, multi-step planning, or difficult algorithms, there is a noticeable quality drop. Use o4-mini or o3 for those scenarios.