Skip to content

xujfcn/crazyrouter-codex-cli

Repository files navigation

Crazyrouter Codex CLI

Run OpenAI Codex CLI through Crazyrouter with a clean one-command setup for Windows, macOS, and Linux.

English · 简体中文 · 日本語 · Русский

OpenAI Compatible Codex CLI Windows macOS Linux License


Project In Four Languages

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.

Choose Your Guide

Language Full guide
English README.en.md
简体中文 README.zh-CN.md
日本語 README.ja.md
Русский README.ru.md

What You Get

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.


Fast Start

Existing Codex CLI, Switch To Crazyrouter

Windows PowerShell:

$env:CRAZYROUTER_CODEX_MODE='switch'; iwr -UseB https://raw.githubusercontent.com/xujfcn/crazyrouter-codex-cli/main/install-crazyrouter-codex.ps1 | iex

macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/xujfcn/crazyrouter-codex-cli/main/install-crazyrouter-codex.sh | bash -s -- --switch

New Machine, Full Setup

Windows PowerShell:

iwr -UseB https://raw.githubusercontent.com/xujfcn/crazyrouter-codex-cli/main/install-crazyrouter-codex.ps1 | iex

macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/xujfcn/crazyrouter-codex-cli/main/install-crazyrouter-codex.sh | bash

Configuration Written By The Scripts

The 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

Important Notes

  • Keep /v1 in 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.

Useful Links


Use gpt-5.5-pro

gpt-5.5-pro is the higher-capability Pro model. Select it in any of these ways.

  1. One-off run, without changing config:
codex --model gpt-5.5-pro
  1. Set it as the default in config.toml:
model = "gpt-5.5-pro"
model_provider = "crazyrouter"
  1. When running the installer, enter gpt-5.5-pro at the default model name step.

  2. Switch inside a running session with the /model command (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 · 简体中文 · 日本語 · Русский.

License

MIT

About

Use OpenAI Codex CLI with Crazyrouter — Save 45% on API costs. Setup guide and examples.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors