Router One
Back to Blog

Use Codex CLI Without ChatGPT Plus: Pay per Token Through Router One

|Router 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: set OPENAI_BASE_URL=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

Set two environment variables:

export OPENAI_BASE_URL=https://api.router.one/v1
export OPENAI_API_KEY=sk-your-router-one-key
codex

If your shell already has direct OpenAI credentials, put the Router One values in the shell profile or project-specific environment you use for Codex CLI. The CLI setup guide has the complete version, including how to configure 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
  • Budget limits so agent loops cannot spend indefinitely
  • 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 supportAlipay, WeChat Pay, Stripe, 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 Alipay, WeChat Pay, Stripe, or stablecoins.
  3. Create a dedicated API key named something like codex-local.
  4. Set a monthly spend cap on that key.
  5. Export the environment variables:
export OPENAI_BASE_URL=https://api.router.one/v1
export OPENAI_API_KEY=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.

Recommended key setup

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 /facts/integrations.md 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 uses the OpenAI-compatible endpoint through OPENAI_BASE_URL and OPENAI_API_KEY.

Can I pay with Alipay or WeChat Pay? Yes. Wallet top-ups support China-friendly payment methods. Payment details are documented in /facts/payments.md.

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