Run OpenAI Codex CLI through Crazyrouter with a clean one-command setup for Windows, macOS, and Linux.
| Language | Introduction |
|---|---|
| 中文 | 本项目帮助你把 OpenAI Codex CLI 快速连接到 Crazyrouter,并通过 Crazyrouter 的 OpenAI-compatible API 调用支持的模型。 |
| 日本語 | OpenAI Codex CLI を Crazyrouter に接続し、Crazyrouter の OpenAI-compatible API 経由で対応モデルを利用できます。 |
| Русский | Проект помогает подключить OpenAI Codex CLI к Crazyrouter и использовать модели Crazyrouter через OpenAI-совместимый API. |
| English | Connect OpenAI Codex CLI to Crazyrouter, then use Crazyrouter-supported models through an OpenAI-compatible API. |
| Language | Full guide |
|---|---|
| English | README.en.md |
| 简体中文 | README.zh-CN.md |
| 日本語 | README.ja.md |
| Русский | README.ru.md |
| Need | Included file or flow |
|---|---|
| Windows installer | install-crazyrouter-codex.ps1 |
| Windows double-click entry | install-crazyrouter-codex.bat |
| macOS / Linux installer | install-crazyrouter-codex.sh |
| Existing Codex CLI users | Switch mode, config backup, Crazyrouter provider rewrite |
| New users | Full setup for Git, Node.js, Codex CLI, environment variables, test project |
The scripts write a consistent OpenAI-compatible Base URL:
https://cn.crazyrouter.com/v1
Do not add UTM parameters to API endpoints. UTM parameters are only for links opened by people.
Windows PowerShell:
$env:CRAZYROUTER_CODEX_MODE='switch'; iwr -UseB https://raw.githubusercontent.com/xujfcn/crazyrouter-codex-cli/main/install-crazyrouter-codex.ps1 | iexmacOS / Linux:
curl -fsSL https://raw.githubusercontent.com/xujfcn/crazyrouter-codex-cli/main/install-crazyrouter-codex.sh | bash -s -- --switchWindows PowerShell:
iwr -UseB https://raw.githubusercontent.com/xujfcn/crazyrouter-codex-cli/main/install-crazyrouter-codex.ps1 | iexmacOS / Linux:
curl -fsSL https://raw.githubusercontent.com/xujfcn/crazyrouter-codex-cli/main/install-crazyrouter-codex.sh | bashThe scripts ask for your Crazyrouter API key and preferred model, then configure:
OPENAI_API_KEY=your-crazyrouter-api-key
OPENAI_BASE_URL=https://cn.crazyrouter.com/v1
They also write a Codex provider block similar to:
model = "gpt-5.5"
model_provider = "crazyrouter"
[model_providers.crazyrouter]
name = "Crazyrouter"
base_url = "https://cn.crazyrouter.com/v1"
env_key = "OPENAI_API_KEY"
wire_api = "responses"
[model_providers.crazyrouter.query_params]Codex CLI options can change between versions. After installation, run:
codex --help- Keep
/v1in the Base URL. - Do not use tracking parameters in
OPENAI_BASE_URL. - Node.js 22+ is recommended for Codex CLI.
- Model availability depends on your Crazyrouter account, enabled routes, and upstream model status.
- If the script finds an existing Codex config, it creates a timestamped backup first.
- Crazyrouter: https://crazyrouter.com?utm_source=github&utm_medium=github&utm_campaign=dev_community
- Crazyrouter model list: https://crazyrouter.com/models?utm_source=github&utm_medium=github&utm_campaign=dev_community
- OpenAI-compatible Base URL explanation: https://crazyrouter.com/blog/openai-compatible-api-base-url-explained?utm_source=github&utm_medium=github&utm_campaign=dev_community
- API error troubleshooting: https://crazyrouter.com/blog/how-to-fix-ai-api-500-502-524-errors?utm_source=github&utm_medium=github&utm_campaign=dev_community
- OpenAI Codex CLI: https://github.com/openai/codex
- Telegram: https://t.me/crzrouter
gpt-5.5-pro is the higher-capability Pro model. Select it in any of these ways.
- One-off run, without changing config:
codex --model gpt-5.5-pro- Set it as the default in
config.toml:
model = "gpt-5.5-pro"
model_provider = "crazyrouter"-
When running the installer, enter
gpt-5.5-proat the default model name step. -
Switch inside a running session with the
/modelcommand (depending on your Codex CLI version).
Availability depends on your Crazyrouter account, enabled routes, and upstream status. Confirm the exact name on the model list if you get a model error. Per-language guides: English · 简体中文 · 日本語 · Русский.
MIT