June 18, 20264 min readPricingCodex CLI

How to use Codex CLI cheaper without a subscription

Codex CLI is a fast, terminal-native coding agent — but the default path nudges you toward a paid plan or metered first-party billing. If you only code in bursts, a flat monthly fee is money you burn on idle days. The good news: Codex CLI speaks the standard OpenAI API, so you can point it at any OpenAI-compatible endpoint and pay only for the tokens you actually use.

Why a subscription is the wrong shape for most developers

Subscriptions optimize for heavy, daily users. Most of us aren't that. We refactor on Tuesday, ship on Thursday, and touch nothing on the weekend. A subscription charges the same on a zero-commit day as on a 40-commit day.

Pay-per-token flips the model. Quiet week, tiny bill. Crunch week, you pay for the work — and nothing more. No minimums, no "use it or lose it," no renewal you forgot to cancel.

The cheaper setup: one endpoint, one key

Instead of wiring Codex CLI to a single vendor, route it through AnyModel — one OpenAI-compatible gateway that reaches GPT, Claude, Gemini, DeepSeek, GLM, Kimi, Qwen, and Grok. The base URL is https://anymodel.org/v1, and a single API key unlocks every model. Switching models is just changing the model id in your request — nothing else moves.

That matters for cost. Different tasks deserve different price points:

Task Cheaper choice When to reach for a premium model
Boilerplate, renaming, simple fixes DeepSeek, Qwen, GLM
Day-to-day feature work GPT, Gemini When context gets large
Hard architecture / tricky bugs Claude, top GPT tiers

Because the key is shared across all of them, you can downshift to a budget model for grunt work and reserve the expensive ones for the problems that actually need them. See live pricing on the compare page.

Start free, no credit card

You get 1,000,000 tokens on signup, and a total of 6,000,000 if you link Telegram — no card required. That's enough to run Codex CLI through a real project before you spend a cent. When the free tokens run out, you continue pay-per-token with no subscription and no minimums.

Install in one line

Codex CLI is one of the tools with a managed installer. Drop in your key and it configures the endpoint for you:

bash <(curl -fsSL "https://anymodel.org/i?tool=codex") <YOUR_API_KEY>

That points Codex CLI at https://anymodel.org/v1 and stores your key. The same one-liner works for Claude Code (tool=claude), plus opencode and hermes.

Already using something else? Cursor, Windsurf, Zed, Cline, Aider, Continue, and Gemini CLI don't have a managed installer, but they all accept a manual OpenAI-compatible config — set the base URL to https://anymodel.org/v1 and paste your key into the API-key field. One key covers them all, so you can mix tools without juggling accounts.

A quick sanity check

Before running a full agent loop, confirm the endpoint answers:

curl https://anymodel.org/v1/chat/completions \
  -H "Authorization: Bearer $YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-5","messages":[{"role":"user","content":"ping"}]}'

Swap gpt-5 for any supported model id to compare answers — and costs — without changing anything else.

Keep prompts off the record

If you're piping proprietary code through an agent, turn on Ghost Mode. It's opt-in, zero-retention: your prompts and responses aren't stored on our side — only a token counter for billing. Be clear-eyed about the limit, though: the model provider still receives the prompt to generate a reply, so this isn't "100% privacy." It removes our copy, not theirs.

How to actually save money

  • Match the model to the task. Use a budget model for refactors and tests; save premium models for the gnarly 10%.
  • Lean on the free tier first. Six million tokens is real mileage — learn your usage before paying.
  • Watch your token counter. Pay-per-token only rewards you if you notice which models cost what.
  • Trim context. Smaller, focused prompts mean fewer tokens per turn across every tool.

For more setup walkthroughs and cost breakdowns, browse the blog.

Ready to drop the subscription?

Keep Codex CLI exactly as you like it — just change where it sends requests. Create a free account, grab your key, run the one-liner, and start paying only for the tokens you use.

Read next