Skip to content

OpenAI Codex CLI — Accessible from China, Pay-Per-Token

Router One runs OpenAI Codex CLI from Mainland China without a VPN or ChatGPT Plus: add it as a model provider in ~/.codex/config.toml (base_url https://api.router.one/v1, wire_api = "responses", plus a top-level model = "gpt-6.2-sol" line) and pay per token from a wallet topped up by card, Alipay or WeChat Pay; every request the gateway sends to a model is recorded in Dashboard → Logs with its tokens and the wallet charge or plan quota it used. Per-key spend caps and same-model failover come with the same endpoint, and https://router.one/benchmarks/model-reliability reports rolling per-model error rates.

Stable from China

In the China latency benchmark of 2026-11-15 (43 probes in 25 mainland cities on China Telecom, China Unicom, China Mobile and cloud networks), api.router.one answered 85 of 86 requests, with a median first byte 395ms after the request was sent; api.openai.com connected from none of the same probes. Individual networks may vary.

Pay-per-token, no ChatGPT Plus

Use wallet billing or live Router One subscription plans. Top up with a card, Alipay or WeChat Pay through hosted checkout, or with USDT/USDC on six chains — usage outside plan coverage is metered by what Codex actually consumes.

Same-model failover

Requests are served by the model you name. If a route fails (429, 5xx or timeout), the request is retried on another route for the same model, and routes with a sustained upstream-error rate are automatically moved to the back of the order until they recover. Customer Logs shows the model, request ID, usage, wallet charge or plan quota used, recorded latency, and status without exposing internal routes, and /benchmarks/model-reliability reports each model's success, 429 and 5xx rates over the last 7 and 30 days.

Configure Codex CLI

Run the one-click command, or register Router One as a model provider in ~/.codex/config.toml.

  1. 1Create a Router One API keySign up at router.one and create an API key. Top up with a card, Alipay or WeChat Pay through hosted checkout, or with USDT/USDC — no ChatGPT Plus or foreign credit card required.
  2. 2Point Codex CLI at Router OneRun the one-click command with your key — it installs Codex CLI if missing, writes ~/.codex/config.toml with the Router One provider (env_key = ROUTER_ONE_API_KEY), persists the key in your shell profile, and verifies it.
  3. 3Launch Codex CLIRun Codex CLI as usual. Requests route through Router One's China-reachable, OpenAI-compatible endpoint, billed per token from your wallet, or from your plan's allowance for models a plan tier lists.
terminal
# Use Codex CLI through Router One
curl -fsSL https://router.one/install/codex.sh | bash -s -- sk-your-router-one-key
Read the Codex CLI alternative guideView the China latency benchmark

FAQ

Do I still need ChatGPT Plus?

No. Codex CLI runs on Router One with a Router One key, billed per token from your wallet or, on a Pro, Max or Ultra plan, from the plan's allowance first: as of the 2026-11-18 plan response, gpt-6.2-sol (the model the one-click install writes), gpt-5.6-sol (which earlier installs wrote) and gpt-6.1-sol (which Codex 0.159.1 through 0.169.0 use when config.toml names no model) are in the Premium models tier of all three plans, together with gpt-6-sol. From Codex 0.169.1, a config with no model line asks for gpt-6.2-sol; Codex's default changes between releases, so keep the model line the one-click install writes. Calls beyond a tier's allowance, and usage outside plan coverage, bill the wallet at posted rates; /pricing shows each plan's allowances.

Will my existing Codex configuration work?

Yes — Router One is added as a standard model provider in ~/.codex/config.toml (base_url https://api.router.one/v1, wire_api "responses", key via the ROUTER_ONE_API_KEY environment variable). Codex speaks the Responses API, so pick a model whose page lists POST /v1/responses — GPT, DeepSeek V4 and Grok chat models; Claude IDs get a 400 and belong in Claude Code. Accepted and rejected Responses features are listed on the Codex Responses API page (/codex-responses-api); context window defaults, model_context_window limits and auto-compaction are covered on https://router.one/codex-context-window.

Which model should config.toml name: gpt-5.6-sol, gpt-6-sol or gpt-6.1-sol?

The one-click install writes model = "gpt-6.2-sol" (earlier installs wrote gpt-5.6-sol). Per the rust-v0.169.0 and rust-v0.169.1 bundled model lists (checked 2026-11-18), Codex has a gpt-6.2-sol entry from 0.169.1, so run it with Codex 0.169.1 or later; as of the 2026-11-18 plan response it is in the Premium models tier of the Pro, Max and Ultra plans. The three IDs in the question are served natively on /v1/responses (gpt-6.1-sol needs Codex 0.159.1 or later, the first release whose bundled model list includes it), and as of the 2026-11-16 plan response all three are in the Premium models tier of the Pro, Max and Ultra plans: on a plan, each billed request Codex sends to any of them draws from that tier's shared allowance, and calls beyond it bill the wallet at posted rates. So pick by model, not by plan: compare them on /models. Per the 0.159.1 release notes and the rust-v0.169.0 and rust-v0.169.1 bundled model lists (checked 2026-11-18), Codex 0.159.1 through 0.169.0 use gpt-6.1-sol when config.toml names no model; rust-v0.169.1 (released 2026-11-17) puts gpt-6.2-sol first in its bundled list, so from 0.169.1 a config with no model line asks for gpt-6.2-sol. Per the Codex models docs (checked 2026-11-18), that default applies only when config.toml names no model, so keep a model line: a change of Codex's default then cannot move your sessions to another model or tier — per the bundled model lists of those releases (checked 2026-10-06), from 0.153.4 to 0.159.0 the default was GPT-6 Astra, which only the Max and Ultra plans cover.

Codex shows "Meet GPT-6 Sol" at startup. Should I switch?

Per the Codex source (the upgrade entries in its bundled models.json, 0.156.1 and later; re-checked against rust-v0.169.1 on 2026-11-18), Codex may offer to move gpt-5.6-sol or gpt-5.6-terra to gpt-6-sol (not gpt-6.1-sol) with a "Meet GPT-6 Sol" prompt, and the source does not limit that prompt to the built-in OpenAI provider, so a Router One setup may see it too. Accepting switches your model to gpt-6-sol, which Router One serves. As of the 2026-11-16 plan response, gpt-6-sol and gpt-5.6-sol are in the Premium models tier of the Pro, Max and Ultra plans and gpt-5.6-terra is in the Mid-tier models tier, so on a plan a switch from gpt-5.6-sol keeps your calls on the same allowance, while a switch from gpt-5.6-terra moves them to the Premium models allowance, which is smaller on every plan. To keep your current model, choose "Use existing model" in the prompt; accepting saves gpt-6-sol as your default model. Per the same source, Codex 0.159.1 and later may also show a startup tip that recommends GPT-6.1 Sol; the tip does not change your model.

Can I still use GPT-5.5 in Codex?

As of the 2026-10-15 catalog, Router One no longer lists GPT-5.5 (openai/gpt-5.5), so if config.toml still names gpt-5.5, change its model line to a model /models lists. The question above on which model config.toml should name covers that choice.

Codex says "The '…' model is not supported when using Codex with a ChatGPT account". Is that a Router One error?

No. The message says the request went through Codex's ChatGPT sign-in, which does not support the model it names: Codex's own test suite (rust-v0.169.1, checked 2026-11-18) uses this reply as the server's answer to a ChatGPT-signed-in session whose model the test treats as retired (its example is gpt-5.5), and per OpenAI's Codex models page (its GPT-5.5 retirement section, checked 2026-11-18), GPT-5.5's retirement from Codex with ChatGPT sign-in took effect on October 14, 2026, at noon PDT (19:00 UTC), while the OpenAI API and Codex sessions authenticated with an API key aren't affected. Per Codex's authentication docs (checked 2026-11-18), a custom model provider with env_key uses the API key in that environment variable, so a Codex CLI session that uses Router One as its model provider (env_key = "ROUTER_ONE_API_KEY" and a top-level model = "gpt-6.2-sol" line, as the one-click install writes) sends its requests to https://api.router.one/v1 with your Router One key, not through the ChatGPT sign-in. Check the model's page on /models for its plan coverage before you rely on it. The Codex model-not-supported page (https://router.one/codex-model-not-supported) walks through the fix step by step.

What about latency from China?

In the China latency benchmark of 2026-11-15 (43 probes in 25 mainland cities on China Telecom, China Unicom, China Mobile and cloud networks), api.router.one answered 85 of 86 requests, with a median first byte 395ms after the request was sent; api.openai.com connected from none of the same probes. Individual networks may vary.

Can I set budget caps?

Yes. Give each project or tool a separate API key, then set that key's maxSpend cap in the dashboard. Every request the gateway sends to a model is recorded in Dashboard → Logs with its token counts and the wallet charge or plan quota it used. For a dev team, give each developer their own key: the team rollout guide (/blog/claude-code-codex-team-rollout) covers how plan quota interacts with key caps and what to do when someone leaves.

Choose the next step for your Codex workflow

Next steps for Codex CLI: shared controls across coding tools, Responses API compatibility, topping up, and Claude Code setup.

Workflow hubGive each coding tool its own budgetUse dedicated API keys for Codex, Claude Code, Cursor, or another client without splitting wallet visibility.TroubleshootingUnderstand Codex Responses API errorsUse this when a relay accepts Chat Completions but Codex needs the native Responses API contract.TroubleshootingFix Codex's model-not-supported errorWhen Codex's ChatGPT sign-in refuses a model: confirm the sign-in, then send local sessions through an env_key provider.TroubleshootingUnderstand Codex's model-at-capacity errorWhat "Selected model is at capacity" means, what Codex already retried, and when to wait or pick another model.TroubleshootingFix Codex's exceeded retry limit (429)When Codex stops retrying a 429: read Dashboard → Logs to see whose limit it was, then back off or have the key or account limit raised.TroubleshootingUnderstand Codex's usage-limit messageWhat "You’ve hit your usage limit" means on a ChatGPT plan, when it resets, and how local sessions keep working on another billing path.TroubleshootingFix Codex's 401 and missing-variable errorsWhen Codex says "Missing environment variable" or "unexpected status 401 Unauthorized", set the variable env_key names, then read the url in the message to see whose 401 it was.Context windowUnderstand Codex's 258K, 500K and 1M context settingsWhy Codex displays 258K (272,000 × 95%), how model_context_window clamps to 872,000 (828K usable), how /status reports it, and how the 272K billing line applies.TroubleshootingFix Codex unexpected status errors (402–504)Read the url, body and headers on Codex "unexpected status" lines for 401, 402, 403, 404, 413, 502, 503 and 504, and see why 400, 429 and 500 print different messages.TroubleshootingFix Codex stream disconnected & Reconnecting 5/5Match the suffix after "stream disconnected before completion", troubleshoot proxies, WebSockets and idle timeouts, and separate content_filter or Subscription Sharing limits from network drops.TroubleshootingFix ChatGPT subscription sharing errorsDecode subscription_sharing_* and chatpass_v2_* errors in T3 Code, OpenCode, Pi and other apps, or move requests to your own API key.Setup guideOne-click Codex CLI setupRun the sh or PowerShell install script, or add the provider block to ~/.codex/config.toml by hand with env_key.Desktop appSet up with CC Switch (no env vars)A free desktop app that sets up the Codex connection through a graphical interface — no config.toml to edit by hand.CostCut the per-token price of GPT callsPosted GPT rates run up to 90% off official prices on select models — see how caps and traces apply to Codex traffic.PlansCompare monthly plans with pay-as-you-goCheck which models each plan tier covers before you pick a Codex model; everything outside plan coverage bills to the wallet.API referenceConfirm the Responses API requestExact /v1/responses fields Codex CLI sends, what is accepted natively, and what returns 400.BillingFund the Codex wallet with AlipayAlipay credits the same Router One wallet used by Codex's pay-per-token requests.Alternative CLISet up Claude Code insteadClaude Code has its own Anthropic-compatible environment-variable setup path.ComparisonClaude Code vs Codex CLI, honestly comparedStill deciding between the two CLIs? A workflow-first comparison of what each is actually good at.ComparisonOpenCode vs Claude Code vs Codex CLIThree terminal coding agents on one key — pick by workflow.ComparisonDeepSeek Harness vs Claude Code vs Codex CLIDeepSeek's open-source agent next to the two vendor CLIs: the protocol each speaks, and one Router One key for all three.
More Codex CLI guides(4)

Start using Codex CLI in China

Get your API key