PrimeRouter × Codex CLI

Install Codex in one clickwired to PrimeRouter

Download an installer with your API key already embedded and double-click it: it installs Codex CLI, writes the config, and backs up before overwriting. Then just run codex. Pay as you go, balance never expires.

One-line install

Sign up or log in first — you will be brought back to the install step automatically. Already have an account? Log in

KEY
Your API key is embedded — nothing to paste
BACKUP
config.toml and auth.json are backed up before writing
HISTORY
Keeps your existing model_provider, so codex resume still lists old sessions
REVERSIBLE
Switch back to a ChatGPT account any time with codex login
HOW IT WORKS

Three steps

01

Sign up or log in

Click “Get my installer”. If you are not logged in you will be taken to sign-up first, then brought back here; the source tag in your link is kept.

02

Download and run the installer

You get PrimeRouter-Codex-Installer.zip. Unzip it and double-click PrimeRouter-Codex-Installer.command. If macOS blocks the first launch, right-click the file → Open.

03

Start Codex

Open a new terminal and run codex. The default model is already in the config; if anything fails, check the FAQ below or the troubleshooting page.

ONE-LINE INSTALL

Already have an API key? One line

No web login needed: the script asks for your API key interactively and never writes it into the command or your shell history.

curl -fsSL https://primerouter.ai/install/codex.sh | bash

What it does: checks Node v22+ → installs @openai/codex globally with npm if missing (asks first) → asks for your API key → backs up and writes ~/.codex/config.toml and auth.json, keeping the existing model_provider id.

Script source: codex.sh · codex.ps1

No key yet? Create one on the API keys page.

Why PrimeRouter

Why run Codex through PrimeRouter

Pay as you go, balance never expires

Top up what you need — no subscription, no monthly reset.

Fiat or crypto top-up

Local payment methods, or USDT / USDC on multiple chains.

Zero risk to your personal accounts

Requests bill against the service's procurement quota, fully isolated from any account you hold with OpenAI.

One key, every coding tool

The same key also works with Claude Code, Gemini CLI, Cursor and any OpenAI- or Anthropic-protocol client.

FAQ

FAQ

Yes. Codex keeps a single credential (~/.codex/auth.json), so the PrimeRouter key replaces the ChatGPT login. The original is backed up as auth.json.bak.<timestamp>; run codex login to switch back any time. Troubleshooting page →
Yes. The installer reuses the model_provider id already on this machine, so codex resume keeps listing your old sessions; no file is touched. Troubleshooting page →
Usually you ran codex login (which replaced the key), or the key was deleted or disabled in the console. Re-run the installer to restore it, or write it back by hand: printf '%s' "sk-your-key" | codex login --with-api-key. Troubleshooting page →
The model in config.toml is not enabled for your group. The installer picks an available default model for your group, so re-running it is enough; or check the console models page and edit model = "…" yourself (keep it above [model_providers]). Troubleshooting page →
PowerShell's execution policy blocked the .ps1 file. The one-liner irm … | iex runs straight from the network and needs no policy change; if you already downloaded codex.ps1, use powershell -ExecutionPolicy Bypass -File .\codex.ps1 to allow just this run. Avoid a machine-wide Set-ExecutionPolicy Unrestricted. Troubleshooting page →
It is generated for you only and contains one key from your account — do not forward it. If it leaks, delete or recreate that key on the API keys page; your other keys are unaffected. API keys page →
The desktop app shares ~/.codex/config.toml with the CLI, so one setup serves both. On macOS / Windows use the Codex Desktop install page; there is no official Linux desktop build yet, use the CLI. Codex Desktop install page →

Wire up Codex now

One API key that also works with Claude Code, Gemini CLI and every OpenAI- or Anthropic-protocol client.