> Markdown mirror of https://router.one/blog/codex-cli-alternative for AI assistants and crawlers. Router One is an OpenAI-compatible LLM API gateway.
> Published: 2026-04-11 · Last updated: 2026-08-26 · Author: Router One Team

# Codex CLI Alternative: Pay-Per-Token Wallet Billing, No VPN

_Codex CLI on pay-per-token wallet billing vs a subscription: what it costs, plus failover, per-key spend caps and card or Alipay top-ups through Router One._

Looking for a different terminal agent rather than a different way to pay for Codex? See [Claude Code vs Codex CLI](https://router.one/blog/claude-code-vs-codex-cli). Setup from Mainland China lives on [Codex CLI in China](https://router.one/codex-china); the ChatGPT Plus question on [Codex CLI without ChatGPT Plus](https://router.one/blog/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 exciting developer tools to come out of 2026. 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 an active OpenAI API subscription. 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](https://router.one/blog/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** — if one upstream provider has issues, Router One routes your request to an alternative provider transparently. Your Codex session continues uninterrupted.
- **Budget controls** — set a hard maxSpend cap, rateLimit, and tokenLimitTpm on each API key. Use separate keys to isolate projects or developers.
- **Real-time usage tracking** — see every request, every token, every cost in your dashboard as it happens.

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"`) — or let the one-click command write the config for you:

```bash
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 the optimal upstream provider, and the response comes back through the same path. The models available — including `o3`, `o4-mini` — are the same ones you would access directly.

For a detailed walkthrough, see the [Codex CLI China page](https://router.one/codex-china).

## 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):**

Most developers using Codex CLI consume between 500K and 2M tokens per month, depending on usage intensity. 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](https://router.one/models)
- 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](https://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:

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

**Step 4** — Run Codex as usual:

```bash
codex "refactor this function to use async/await"
```

To make the configuration persistent, add the export lines to your `~/.zshrc` or `~/.bashrc`.

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.** If an upstream provider returns an error or times out, Router One retries against an alternative provider. Your Codex session does not crash or hang — the request simply takes a moment longer while it reroutes. This is especially valuable for long-running Codex tasks that can take minutes to complete.

**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, then use the per-key view to see exactly how much that workload costs.

**Real-time 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.** While Codex CLI defaults to `o4-mini`, you can use any model available on Router One, including models from other providers. If you want to try running Codex with a different model for comparison, the infrastructure supports it without any additional setup.

For a full breakdown of supported models and pricing, visit the [model marketplace](https://router.one/models).

## 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 automatic failover so their coding sessions are not interrupted.

## 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"`), 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](https://router.one/codex-china).

**Which models does Codex CLI get through Router One?**
The same ones you would access directly, including `o3` and `o4-mini`. Codex CLI defaults to `o4-mini`, but you can use any model available on Router One — see the [model marketplace](https://router.one/models) for the full list and pricing.

**What happens to my Codex session if an upstream provider has an outage?**
Router One retries the request against an alternative provider, so your Codex session does not crash or hang — the request simply takes a moment longer while it reroutes.

**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](https://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](https://router.one/codex-china). To understand how Router One can reduce your overall LLM costs, read our guide on [reducing LLM API costs](https://router.one/blog/reduce-llm-api-costs).

## See also

- Canonical page: https://router.one/blog/codex-cli-alternative
- Codex CLI China: https://router.one/codex-china
- All blog posts: https://router.one/blog
- Models and per-model token rates: https://router.one/models (markdown: https://router.one/models.md)
- Pricing: https://router.one/pricing
- API docs (markdown): https://router.one/docs.md
- Company facts: https://router.one/facts/company.md
