Looking for a different terminal agent rather than a different way to pay for Codex? See Claude Code vs Codex CLI — or the three-way OpenCode vs Claude Code vs Codex CLI if OpenCode is on your list. Setup from Mainland China lives on Codex CLI in China; the ChatGPT Plus question on Codex CLI without ChatGPT Plus. This post is about cost: per-token wallet billing versus a subscription.
OpenAI's Codex CLI is one of the most capable terminal coding agents. It brings the power of OpenAI's reasoning models directly into your terminal — autonomous code generation, multi-file edits, test writing, all from a single command. If you have used it, you know how productive it can be.
But there is a catch. To use Codex CLI, you need a funded OpenAI account or ChatGPT plan. That means committing to a monthly plan, managing payment methods that may not be available in your region, and dealing with rate limits that can throttle you mid-session. If OpenAI's API has an outage, your entire workflow stops. There is no fallback, no alternative — you just wait.
What if you could use the exact same Codex CLI, with the exact same models, without needing ChatGPT Plus or a foreign credit card? That is what Router One enables.
If the subscription you are weighing is specifically ChatGPT Plus, Codex CLI without ChatGPT Plus walks through that comparison step by step.
What Router One Changes
Router One sits between Codex CLI and the model providers. Instead of pointing Codex at OpenAI's API directly, you point it at Router One's OpenAI-compatible endpoint. From Codex's perspective, nothing changes — it sends the same requests and gets the same responses. But behind the scenes, you get several things that the direct connection does not offer:
- Flexible billing — use wallet pay-per-token billing or live subscription plans. Usage outside plan coverage is still metered by the tokens you actually use.
- Chinese payment support — top up your balance with Alipay, on the same hosted checkout that takes cards. No international credit card required.
- Automatic failover — when an eligible upstream error occurs (a 5xx, timeout, 429 or 529), Router One can retry the request on another healthy route serving the same model. It never swaps in a different model, and it is not a zero-downtime guarantee (how fallback works).
- Budget controls — set a hard maxSpend cap on each API key; request and tokens-per-minute limits apply to each key at platform defaults and can be raised on request. Use separate keys to isolate projects or developers.
- Per-request usage tracking — every request the gateway sends to a model, with its tokens and cost, is recorded in Dashboard → Logs.
None of this requires any changes to Codex CLI itself. You register one extra model provider in its config file and everything else stays the same.
How It Works
Codex CLI reads its configuration from ~/.codex/config.toml. Router One provides a fully OpenAI-compatible endpoint with native Responses API support, so you register it as a model provider (base_url = "https://api.router.one/v1", wire_api = "responses", env_key = "ROUTER_ONE_API_KEY") and keep a top-level model = "gpt-5.6-sol" line, as the one-click install writes. Codex speaks the Responses API, which is why Chat-Completions-only relays 404 on it — see Codex and the Responses API. Or let the one-click command write the config for you:
curl -fsSL https://router.one/install/codex.sh | bash -s -- sk-your-router-one-key
That is the entire setup. Codex CLI sends requests to Router One, Router One forwards them to an upstream route serving the model you named, and the response comes back through the same path. The models available — including openai/gpt-6-astra and openai/gpt-5.6-sol — follow the live catalog, not every model available from a vendor directly.
For a detailed walkthrough, see the Codex CLI China page.
Cost Comparison: Subscription vs Pay-Per-Use
Here is where the math gets interesting. Let us compare what a typical developer actually pays.
OpenAI direct (funded API account):
That bill is per token against a funded OpenAI account, so three things are true at once: you need an international credit card to fund it, you have to keep a balance sitting there, and the monthly number moves with how much context each session loads rather than with how many commands you run. We do not reprint provider rate cards here — they move, and a stale table is worse than no table.
Router One (pay-per-token from your wallet):
- The same models behind one OpenAI-compatible endpoint, including the reasoning model Codex CLI defaults to
- Router One's own posted per-model rate — up to 90% off official prices on select models; live rates are on the model catalog
- Top up any amount with a card or Alipay on the hosted checkout; FX and payment-channel fees are shown before you confirm, separate from the token line
- Low minimum top-up, no monthly commitment required
- Unused balance carries forward indefinitely
For light users who run Codex a few times a week, wallet billing means you pay for the sessions you actually run instead of maintaining a funded account and a monthly commitment. For heavier users, live subscription plans provide predictable monthly spend; either way, you gain failover, budget controls, and usage visibility that the direct API does not provide.
The bottom line: you never pay for capacity you do not use, and you gain operational features that would otherwise require building your own proxy infrastructure.
Setup in 2 Minutes
Getting started takes less time than reading about it:
Step 1 — Sign up at router.one and create an API key.
Step 2 — Add funds to your account using your preferred payment method (card or Alipay on the hosted checkout, or stablecoins).
Step 3 — Run the one-click setup with your key:
curl -fsSL https://router.one/install/codex.sh | bash -s -- sk-your-router-one-key
The setup script already appends export ROUTER_ONE_API_KEY=… to your shell profile (~/.zshrc, ~/.bashrc or ~/.profile), so new terminals pick it up; in the current terminal, run source ~/.zshrc (or your profile) or open a new terminal before Step 4.
Step 4 — Run Codex as usual:
codex "refactor this function to use async/await"
Verify it works by checking the Router One dashboard after running a Codex command — you should see the request logged with model, tokens, and cost.
What You Get at No Extra Cost
Beyond the basic proxy functionality, routing through Router One gives you capabilities that would take weeks to build yourself:
Automatic failover. When an upstream route returns an eligible error (a 5xx, timeout, 429 or 529), Router One can retry the request on another healthy route serving the same requested model. When such a route exists, the retry costs a moment of extra latency instead of a failed call; not every error is retryable and it is not a zero-downtime guarantee, so long-running Codex tasks should still tolerate an occasional failed call. The rules are on LLM fallback.
Budget guardrails. Set a hard maxSpend cap on your API key. When the key reaches that cap, its requests are rejected instead of silently accumulating charges. This is useful when multiple developers or workloads share the same wallet.
Project isolation through separate keys. Create a separate API key for each project and set its maxSpend cap. Save project names alongside request IDs in your application logs when you need to reconcile project costs.
Per-request observability. Every Codex request shows up in your Router One dashboard with full details — model used, input and output tokens, latency, cost, and status. Over time, this data reveals usage patterns that help you optimize how you work with Codex.
Model flexibility. Codex CLI ships its own default model; through Router One you set model in config.toml to any currently listed GPT-family id the catalog lists for /v1/responses — openai/gpt-5.5 as the generalist, openai/gpt-5.6-terra as the lower-rate id for small edits. If you want to try running Codex with a different model for comparison, the infrastructure supports it without any additional setup — and if the choice is between GPT-5.6 Sol and Terra, GPT-5.6 Sol vs GPT-5.6 Terra renders both spec sheets from the live catalog.
For a full breakdown of supported models and pricing, visit the model marketplace.
Who This Is For
Router One as a Codex gateway makes the most sense for:
- Developers in China who cannot easily access OpenAI's payment system or face network reliability issues with direct API calls.
- Individual developers who want pay-as-you-go pricing without committing to a monthly plan.
- Teams that assign separate keys to projects or developers and need per-key spend controls plus centralized usage visibility for Codex.
- Anyone who has been burned by API outages and wants same-model failover on eligible upstream errors, so fewer coding sessions stop on a transient failure.
FAQ
Can I use Codex CLI without an OpenAI API subscription? Yes. Point Codex CLI at Router One's OpenAI-compatible endpoint instead of OpenAI's API and pay per token with wallet billing — no ChatGPT Plus, no foreign credit card, and no monthly commitment required.
How do I set up Codex CLI with Router One?
Register Router One as a model provider in ~/.codex/config.toml (base_url = "https://api.router.one/v1", wire_api = "responses", env_key = "ROUTER_ONE_API_KEY") and keep a top-level model = "gpt-5.6-sol" line, as the one-click install writes, or run the one-click command curl -fsSL https://router.one/install/codex.sh | bash -s -- sk-your-router-one-key. A detailed walkthrough is on the Codex CLI China page.
Which models does Codex CLI get through Router One?
The currently listed GPT-family, DeepSeek and Grok chat ids the catalog lists for /v1/responses, including openai/gpt-6-astra and openai/gpt-5.6-sol. Codex CLI ships its own default model; set model in config.toml to openai/gpt-5.5 as the generalist or openai/gpt-5.6-terra as the lower-rate id for small edits — see the model marketplace for the full list and pricing.
What happens to my Codex session if an upstream provider has an outage? When an eligible upstream error occurs (a 5xx, timeout, 429 or 529), Router One can retry the request on another healthy route serving the same requested model. It never swaps in a different model, not every error is retryable, and it is not a zero-downtime guarantee, so long Codex sessions should still tolerate an occasional failed call. See LLM fallback.
How can I pay for Router One without an international credit card? Top up your balance with Alipay on the same hosted checkout that takes cards; stablecoins are also supported. Unused balance carries forward indefinitely.
Get Started
Sign up at router.one, create an API key, run one setup command, and start using Codex CLI with pay-per-token billing, Chinese payment support, and automatic failover.
For step-by-step setup instructions, visit the Codex CLI China page. To understand how Router One can reduce your overall LLM costs, read our guide on reducing LLM API costs.