01
Create and copy your key
Create an API key in the dashboard. Copy the full key immediately and store it somewhere safe.
API key guide
Connect an API key from your dashboard to Codex, Claude Code, Cherry Studio, TRAE, Hermes, OpenClaw, opencode, or any OpenAI-compatible client.
Site base URL
https://cn.caiaiu.com
01
Create an API key in the dashboard. Copy the full key immediately and store it somewhere safe.
02
Keys must be bound to an available group. If a model is unavailable, billing looks wrong, or traffic hits the wrong group, check the key group first.
03
OpenAI-compatible clients usually need a Base URL ending in /v1. Claude Code gateway settings usually use the site Base URL without /v1.
Codex
This is the easiest way to point official Codex at CaiAI. You download a small config helper, paste your URL and key, click Use, then restart. The helper only rewrites local Codex settings. It does not take over your OpenAI account. Switching back to official Codex uses the same screen.
Open this GitHub page in a browser. On the right, click Releases, then download the installer for your computer. Apple Silicon Mac: CodexPlusPlus-*-macos-arm64.dmg. Intel Mac: macos-x64.dmg. Windows: windows-x64-setup.exe. Install it, then open 「Codex++ 管理工具」 — that is the settings window. Do not open the official Codex app yet.
https://github.com/BigPizzaV3/CodexPlusPlus

On caiaiu.com, click API Keys in the left menu. Click Create key, give it any name, pick a plan or balance group, then create. Copy the full key immediately — you will paste it in the next step. If you lose it, create another one.


In 「Codex++ 管理工具」, click 供应商配置 on the left. Click 添加供应商. Fill only the fields below and leave everything else at the default. Mainland China URL is https://cn.caiaiu.com — do not add /v1.
https://cn.caiaiu.com

On the same form, click 从上游获取. Wait for the model list to appear — you do not need to edit it. Click 保存. Back on the provider list, find the Caiai card and click 使用 until it shows 使用中. Filling the form is not enough; 使用 is what actually switches Codex.

Look at the top-right of the settings window and click 重启 Codex++. After it restarts, always launch Codex from this helper. If you open official Codex by itself, the new settings will not load.
Switch back to official Codex
Same screen: select the 官方登录 provider, click 使用, then click 重启 Codex++. This only rewrites local config files. Your OpenAI account is unchanged.
Codex
Node.js is required. After install, check that codex starts cleanly.
npm install -g @openai/codex
codex --versionAdd a custom provider that points at the CaiAI OpenAI-compatible endpoint. Replace the model name with one supported by your key group.
model_provider = "caiai"
model = "glm-5.2"
review_model = "glm-5.2"
model_reasoning_effort = "high"
disable_response_storage = true
network_access = "enabled"
[model_providers.caiai]
name = "CaiAI API"
base_url = "https://cn.caiaiu.com"
env_key = "CAIAI_API_KEY"
wire_api = "responses"
[features]
goals = trueDo not commit real keys. Replace YOUR_API_KEY with the key copied from the dashboard.
export CAIAI_API_KEY="YOUR_API_KEY"
codex$env:CAIAI_API_KEY="YOUR_API_KEY"
codexcurl "https://cn.caiaiu.com/v1/models" \
-H "Authorization: Bearer YOUR_API_KEY"Claude Code
Prefer the official install script. Use npm only if that fits your environment better.
curl -fsSL https://claude.ai/install.sh | bash
claude --versionirm https://claude.ai/install.ps1 | iex
claude --versionGood for a first test. Values disappear when the shell closes — write them into a user-level config once they work.
export ANTHROPIC_BASE_URL="https://cn.caiaiu.com"
export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
export CLAUDE_CODE_ATTRIBUTION_HEADER=0
claude$env:ANTHROPIC_BASE_URL="https://cn.caiaiu.com"
$env:ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
$env:CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"
$env:CLAUDE_CODE_ATTRIBUTION_HEADER="0"
claudeThis is the user-level config for long-term use. Do not put real keys into a project-local .claude/settings.json.
{
"env": {
"ANTHROPIC_BASE_URL": "https://cn.caiaiu.com",
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"CLAUDE_CODE_ATTRIBUTION_HEADER": "0"
}
}Cherry Studio
Open Cherry Studio provider settings and add a custom OpenAI-compatible provider. Use the /v1 Base URL and the API key from your dashboard.
Provider: OpenAI Compatible / Custom OpenAI
API Key: YOUR_API_KEY
Base URL: https://cn.caiaiu.com/v1
Model: glm-5.2After saving, add a model name supported by your key group, such as glm-5.2. If the model list fails to load, verify Base URL and API key with curl first.
curl "https://cn.caiaiu.com/v1/models" \
-H "Authorization: Bearer YOUR_API_KEY"TRAE
In TRAE model or AI settings, choose a custom OpenAI-compatible provider. Use the /v1 Base URL and your dashboard API key.
Provider: OpenAI Compatible / Custom OpenAI
API Key: YOUR_API_KEY
Base URL: https://cn.caiaiu.com/v1
Model: glm-5.2Hermes
Point Hermes at an OpenAI-compatible endpoint. If the UI exposes baseUrl, fill in the /v1 address. Keep the same address in env vars or config files.
{
"provider": "openai",
"baseUrl": "https://cn.caiaiu.com/v1",
"apiKey": "YOUR_API_KEY",
"model": "glm-5.2"
}OpenClaw
Note: OpenClaw cache reuse can be unreliable
Long sessions, frequent model switches, or cross-project jumps may prevent OpenClaw from reusing context cache stably, so real spend can be higher than expected. Validate with small tasks before broader use.
Add an OpenAI-compatible endpoint in OpenClaw provider or model settings. Use the /v1 Base URL and a dashboard API key.
Provider: OpenAI Compatible / Custom OpenAI
API Key: YOUR_API_KEY
Base URL: https://cn.caiaiu.com/v1
Model: glm-5.2opencode
Note: opencode cache reuse can be unreliable
opencode may replay context or reshape requests during some tasks, which can lower cache hit rate. Use a separately capped key for opencode.
Add a provider in the opencode config and point baseURL at the CaiAI OpenAI-compatible /v1 endpoint. The sample disables store and pins build/plan agents to the same model for more stable cost and behavior.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"caiai": {
"name": "CaiAI API",
"options": {
"baseURL": "https://cn.caiaiu.com/v1",
"apiKey": "YOUR_API_KEY"
},
"models": {
"glm-5.2": {
"name": "GLM-5.2",
"options": {
"store": false
}
}
}
}
},
"agent": {
"build": {
"model": "caiai/glm-5.2",
"options": {
"store": false
}
},
"plan": {
"model": "caiai/glm-5.2",
"options": {
"store": false
}
}
}
}Manual
If the client supports a custom OpenAI Base URL, fill in the baseURL below plus your API key.
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.CAIAI_API_KEY,
baseURL: "https://cn.caiaiu.com/v1"
});
const response = await client.chat.completions.create({
model: "glm-5.2",
messages: [{ role: "user", content: "Hello" }]
});
console.log(response.choices[0]?.message?.content);Confirm network, key, and Base URL with a minimal request before configuring an IDE or CLI tool.
curl "https://cn.caiaiu.com/v1/models" \
-H "Authorization: Bearer YOUR_API_KEY"Checklist
Check that the API key was copied in full, the environment variable is active in the current shell, and the key is still enabled.
Confirm whether Base URL has an extra or missing /v1. OpenAI-compatible clients usually need a URL ending in /v1.
The model name must exist in the current key group. Check recommended models in available channels or the key usage dialog.
The key limit, account balance, or group quota may be exhausted. Check balance and key limits in the dashboard.