Docs

Get started with CodeRoute

Pick a client to view its setup guide, copy the command, and connect to CodeRoute.

Node.js setup

Install Node.js LTS on Windows, macOS, or Linux, and verify node/npm are available.

Windows

Download the LTS installer from the Node.js website and run it, or use a package manager:

powershell
choco install nodejs-lts
powershell
scoop install nodejs-lts

macOS

Download the macOS installer from the Node.js website, or use Homebrew:

bash
brew install node

Linux

bash
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
bash
curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
sudo yum install -y nodejs

Verify the install

After installing, run in your terminal:

bash
node --version
npm --version

If both print versions, Node.js and npm are ready.

Next

With the environment ready, continue to the Claude Code, Codex, or other client guides to connect to CodeRoute.

Claude Code setup

Install and connect Claude Code to CodeRoute with a one-click script. It checks for Node.js and Claude Code, installs them if missing, and writes the config. Copied commands never include your key.

Choose a one-click script by OS

Copy the command for your OS, run it, and enter your API key when prompted.

powershell
irm https://coderoute.cc/install/claude-code.ps1 | iex
powershell
curl -fsSL https://coderoute.cc/install/claude-code.sh | bash
💡
After the config is written, restart any open CLI so it picks up the new settings. Same for Claude Code terminals.

Manual install Claude Code

⚠️
Complete the Node.js setup guide before installing manually.

Step 1: Install Claude Code

bash
sudo npm install -g @anthropic-ai/claude-code
bash
npm install -g @anthropic-ai/claude-code
bash
curl -fsSL https://claude.ai/install.sh | bash
bash
irm https://claude.ai/install.ps1 | iex

Verify the install:

bash
claude --version

Step 2: Configure environment variables

Set the values below in your current terminal or system environment.

Temporary (current session)

powershell
$env:ANTHROPIC_BASE_URL = "https://api.coderoute.cc"
$env:ANTHROPIC_AUTH_TOKEN = "your-key"
$env:CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = "1"
cd your-project
claude
powershell
export ANTHROPIC_BASE_URL=https://api.coderoute.cc
export ANTHROPIC_AUTH_TOKEN=your-key
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
cd your-project
claude

Persistent

powershell
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.coderoute.cc", [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "your-key", [System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable("CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC", "1", [System.EnvironmentVariableTarget]::User)
powershell
echo 'export ANTHROPIC_BASE_URL=https://api.coderoute.cc' >> ~/.zshrc
echo 'export ANTHROPIC_AUTH_TOKEN=your-key' >> ~/.zshrc
echo 'export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1' >> ~/.zshrc
source ~/.zshrc
powershell
echo 'export ANTHROPIC_BASE_URL=https://api.coderoute.cc' >> ~/.bashrc
echo 'export ANTHROPIC_AUTH_TOKEN=your-key' >> ~/.bashrc
echo 'export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1' >> ~/.bashrc
source ~/.bashrc

Step 3: Start using

In your project directory, run:

bash
claude

Claude Code analyzes the current directory and provides intelligent coding help.

See the Anthropic docs for more.

Codex (OpenAI) setup

Install and configure Codex to connect to CodeRoute via ~/.codex.

Choose a one-click script by OS

The script checks for Node.js and the Codex CLI, installs them if missing, then prompts for your API key and writes the ~/.codex config. Copied commands never include your key.

powershell
irm https://coderoute.cc/install/codex.ps1 | iex
powershell
curl -fsSL https://coderoute.cc/install/codex.sh | bash
💡
After writing ~/.codex, both Codex CLI and the Codex App pick it up. Restart any open CLI to load the new config.

Manual install Codex

⚠️
Complete the Node.js setup guide before installing manually.

Step 1: Install Codex

bash
sudo npm install -g @openai/codex@latest
bash
npm install -g @openai/codex@latest

The command above installs the latest Codex from the npm registry.

bash
codex --version

If it prints a version, you’re set.

Step 2: Create the config files

Codex uses config files — you need to create config.toml and auth.json.

bash
# Create the config directory (the commands below overwrite existing config — back it up first)
mkdir -p ~/.codex

# Create config.toml
cat > ~/.codex/config.toml << 'EOF'
model_provider = "codex"
model = "gpt-5.6-sol"
review_model = "gpt-5.6-sol"
model_reasoning_effort = "high"
disable_response_storage = true
network_access = "enabled"
windows_wsl_setup_acknowledged = true
model_context_window = 272000
model_auto_compact_token_limit = 272000
effective_context_window_percent = 95

[model_providers.codex]
name = "codex"
base_url = "https://api.coderoute.cc/v1"
wire_api = "responses"
requires_openai_auth = true
supports_websockets = false
http_headers = { "x-openai-actor-authorization" = "coderoute" }
EOF

# Create auth.json
cat > ~/.codex/auth.json << 'EOF'
{
  "OPENAI_API_KEY": "YOUR_API_KEY"
}
EOF
bash
# Create the config directory (the commands below overwrite existing config — back it up first)
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.codex" | Out-Null
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)

# Create config.toml
$config = @'
model_provider = "codex"
model = "gpt-5.6-sol"
review_model = "gpt-5.6-sol"
model_reasoning_effort = "high"
disable_response_storage = true
network_access = "enabled"
windows_wsl_setup_acknowledged = true
model_context_window = 272000
model_auto_compact_token_limit = 272000
effective_context_window_percent = 95

[model_providers.codex]
name = "codex"
base_url = "https://api.coderoute.cc/v1"
wire_api = "responses"
requires_openai_auth = true
supports_websockets = false
http_headers = { "x-openai-actor-authorization" = "coderoute" }
'@
[System.IO.File]::WriteAllText("$env:USERPROFILE\.codex\config.toml", $config, $utf8NoBom)

# Create auth.json
$auth = @'
{
  "OPENAI_API_KEY": "YOUR_API_KEY"
}
'@
[System.IO.File]::WriteAllText("$env:USERPROFILE\.codex\auth.json", $auth, $utf8NoBom)

Step 3: Start using

In your project directory, run:

bash
codex

See the OpenAI docs for more.

TRAE SOLO setup

Add custom models in TRAE SOLO to connect to the Codex and Claude channels.

Step 1: Open custom model config

  1. Open Settings
  2. Add model
  3. Custom config

Step 2: Fill in by model type

Codex model config

Use https://api.coderoute.cc/v1 for the OpenAI / Codex endpoint.

Claude model config

Use https://api.coderoute.cc for the Claude / Anthropic endpoint.

OpenClaw setup

Connect OpenClaw to CodeRoute. The one-click script lets you pick the Anthropic (Claude) or OpenAI (Codex) channel.

Recommended: interactive one-click script

Run it, pick a channel, enter your API key, and it writes the OpenClaw config.

bash
curl -fsSL https://coderoute.cc/install/openclaw.sh | bash
bash
irm https://coderoute.cc/install/openclaw.ps1 | iex

Manual install OpenClaw

Install globally via npm:

bash
npm install -g @openclaw/cli

Anthropic (Claude)

Do not add /v1 to the Claude / Anthropic endpoint. Example model: claude-opus-4-6.

bash
export ANTHROPIC_API_KEY="YOUR_API_KEY"
openclaw onboard --auth-choice custom-api-key \
  --custom-base-url https://api.coderoute.cc \
  --custom-api-key-env ANTHROPIC_API_KEY \
  --custom-compatibility anthropic \
  --custom-model claude-opus-4-6

OpenAI (Codex)

The OpenAI / Codex endpoint must include /v1. Example model: gpt-5.6-sol.

Step 3: Start using

bash
openclaw

Hermes setup

Connect Hermes to CodeRoute. The one-click script picks a channel and writes the config.

Recommended: interactive one-click script

Run it, pick a channel, enter your API key, and it writes ~/.hermes/config.yaml.

bash
curl -fsSL https://coderoute.cc/install/hermes.sh | bash
bash
irm https://coderoute.cc/install/hermes.ps1 | iex

Manual install Hermes

Install via pipx:

bash
pipx install hermes-agent

Write the config file manually:

yaml
mkdir -p ~/.hermes
cat > ~/.hermes/config.yaml << 'EOF'
model:
  default: claude-opus-4-7
  provider: coderoute-claude
providers:
  coderoute-claude:
    api_mode: anthropic_messages
    base_url: https://api.coderoute.cc
    api_key: YOUR_API_KEY
    default_model: claude-opus-4-7
    models:
      - claude-opus-4-7
EOF

Step 3: Start using

bash
hermes

API scripts

Examples covering text, vision, image, and video endpoints. Replace YOUR_API_KEY with your key before running.

OpenAI Responses text + vision

The newer OpenAI endpoint for chat, image understanding, and streaming.

bash
curl https://api.coderoute.cc/v1/responses \
  -H "Authorization: Bearer $CODEROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-sol",
    "input": "Write a quicksort in Python",
    "stream": false
  }'

OpenAI Chat Completions text + vision

The classic OpenAI Chat format — easy migration for existing clients.

bash
curl https://api.coderoute.cc/v1/chat/completions \
  -H "Authorization: Bearer $CODEROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kimi-k2.7-code",
    "messages": [
      {"role": "user", "content": "Write a quicksort in Python"}
    ]
  }'

Anthropic Messages text + vision

Claude / Anthropic Messages format; image mode base64-encodes before submit.

bash
curl https://api.coderoute.cc/v1/messages \
  -H "x-api-key: $CODEROUTE_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-4-6",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Write a quicksort in Python"}
    ]
  }'

gpt-image-2 image generation

Text-to-image goes to /v1/images/generations; reference-image edits go to /v1/images/edits.

bash
curl https://api.coderoute.cc/v1/images/generations \
  -H "Authorization: Bearer $CODEROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "an orange cat in glasses, pixel art",
    "size": "1024x1024"
  }'

gpt-image-2 image edit

Upload an image and edit per the prompt; save the result via streaming events.

bash
curl https://api.coderoute.cc/v1/images/edits \
  -H "Authorization: Bearer $CODEROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "image": {"url": "https://example.com/a.png"},
    "prompt": "change the background to a cyberpunk city"
  }'
⚠️
Common error: if you see “expected struct ImageUrl”, the image field was a raw string. Correct: {"image": {"url": "..."}}; for local files, use a data URL like data:image/png;base64,<BASE64>.

grok-imagine-video video generation

Async video: submit a job to get a request_id, poll until done, then download.

bash
# Submit a generation job
curl https://api.coderoute.cc/v1/videos/generations \
  -H "Authorization: Bearer $CODEROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-imagine-video",
    "prompt": "city night timelapse, 4K",
    "resolution": "720p",
    "duration": 8
  }'

# Poll the job status
# GET /v1/videos/{request_id}  →  returns status and video.url
# When done, download the bytes via GET /v1/videos/{request_id}/content

resolution supports 480p / 720p; duration defaults to 8s, range 1–15s, billed per second. video.url is a temporary signed link — download and save it promptly.

About supported clients

CodeRoute offers both OpenAI- and Anthropic-compatible protocols across GLM, DeepSeek, Kimi and Qwen coding models, so any client that speaks either protocol works (Claude Code, Codex, Cursor, OpenAI SDK, OpenClaw, Hermes, Continue, Cline, and others).

Client config options may change between versions; refer to each client’s official docs. Scan the code to reach the team if you run into setup issues.