Router One
Back to Blog

Codex CLI Without ChatGPT Plus: Pay per Token Instead

PublishedUpdatedRouter One Team

Yes. You can use Codex CLI without treating ChatGPT Plus as the billing path, as long as the CLI is configured to call an OpenAI-compatible API endpoint and you have a funded API key for that endpoint.

For developers in China, the cleaner setup is Router One: point Codex at the OpenAI-compatible endpoint https://api.router.one/v1, use a Router One API key, and pay from wallet balance or a live subscription plan. The CLI still speaks the OpenAI-compatible API shape, but billing, budget control, and request traces live in Router One.

This guide is for developers who want Codex-style terminal workflows without relying on a foreign card, a consumer ChatGPT subscription, or a fragile virtual-card workaround.

The short version

One command installs Codex CLI (if missing), writes ~/.codex/config.toml with the Router One provider, persists your key, and verifies it:

curl -fsSL https://router.one/install/codex.sh | bash -s -- sk-your-router-one-key

Prefer manual setup? Declare the provider in ~/.codex/config.toml (base_url = "https://api.router.one/v1", wire_api = "responses", env_key = "ROUTER_ONE_API_KEY") and export ROUTER_ONE_API_KEY in your shell profile. The CLI setup guide has the complete version, including the Windows command and related tools.

Why ChatGPT Plus is the wrong mental model

ChatGPT Plus is a consumer subscription for the ChatGPT web product. Codex CLI is a developer tool that sends API-like model requests. They can overlap in a vendor's account system, but they are not the same workflow.

If your goal is to use the ChatGPT website, Plus may matter. If your goal is to run a terminal coding agent, what matters is:

  • An API-compatible endpoint
  • A valid API key
  • Enough balance or plan quota
  • A model that works well for coding
  • A per-key maxSpend cap so one agent loop cannot consume the whole wallet
  • Request traces so you can inspect what happened

Router One optimizes for the second list.

What Router One adds to Codex CLI

Pointing Codex CLI at Router One gives you more than payment convenience:

NeedDirect single-provider APIRouter One
Local paymentDepends on provider card supportCard or Alipay in one hosted checkout, stablecoins
Budget controlAccount-level or manualPer-key spend caps
FallbackUsually noneGateway-level fallback where compatible
ObservabilityProvider dashboardPer-request model, token, cost, latency trace
China accessNetwork dependentChina-reachable gateway endpoint
Tool isolationManual accounts or projectsOne key per tool, project, or developer

This matters because Codex CLI can make many calls in one work session. A single bad loop or overly broad refactor can consume more tokens than a normal chat session. Key-level caps and traces are not optional once multiple developers are using the tool.

Step-by-step setup

  1. Create an account at router.one.
  2. Top up with a card or Alipay on the hosted checkout, or with stablecoins.
  3. Create a dedicated API key named something like codex-local.
  4. Set maxSpend on that key to cap its cumulative exposure.
  5. Run the one-click setup with that key:
curl -fsSL https://router.one/install/codex.sh | bash -s -- sk-your-router-one-key
  1. Run codex and complete a small task.
  2. Open the dashboard logs and verify the model, token counts, cost, latency, and status.

For the broader China-specific Codex page, see Codex CLI in China. For a longer comparison with the direct OpenAI path, see OpenAI Codex CLI Alternative.

Do not put every tool on the same key. A better pattern is:

  • codex-personal for your own terminal workflow
  • codex-team-alice or codex-team-bob for individual teammates
  • staging-agent for automated test agents
  • prod-agent only when an agent workflow actually reaches production

Each key should have its own cap. If a local Codex session loops, it should exhaust only the Codex key, not the whole account.

Production safety checks

Before letting Codex write code against an important repository, verify:

  • You can see each request in the Router One dashboard
  • The key has a spend cap
  • The key is separate from production app traffic
  • The model used by Codex is visible in traces
  • Prompt and completion body retention boundaries are understood by the team

The integration facts page at the integration facts sheet summarizes the OpenAI-compatible API and coding-tool boundaries in a machine-readable form.

Does this replace ChatGPT Plus?

It replaces Plus only for one category: developer API and CLI usage. It does not replace the ChatGPT web app, voice mode, custom GPTs, or consumer features that exist only inside ChatGPT.

If your main question is "how do I use ChatGPT Plus or GPT API from China", read the ChatGPT Plus and GPT API China guide. If your question is specifically "how do I run Codex CLI without a foreign card or a Plus-style commitment", this page is the direct answer.

FAQ

Do I need a ChatGPT Plus subscription? Not for this Router One API path. You need a Router One API key with balance or plan coverage.

Does Codex CLI need special Router One code? No. It's a standard custom model provider in ~/.codex/config.toml: the OpenAI-compatible base URL, wire_api = "responses", and your key via the ROUTER_ONE_API_KEY environment variable.

Can I pay with Alipay? Yes. Wallet top-ups support China-friendly payment methods. Payment details are documented in the machine-readable payment facts.

Where is the detailed configuration guide? Start with Codex CLI in China, then keep the CLI setup guide open while configuring your shell.

Related canonical pages

This article belongs to the Codex CLI China cluster. These pages are the commercial page, setup docs, evidence source, and trust references.

Related reads