同一套中转站,Claude Code 和 Codex 的配置差一个 /v1,方向还相反。这是 404 的第一大来源。
| Claude Code | Codex / OpenAI 兼容 | |
|---|---|---|
| base | https://ai.tt2066.top | https://ai.tt2066.top/v1 |
| 鉴权 | x-api-key | Authorization: Bearer |
| 实际路径 | /v1/messages | /v1/chat/completions |
python3 relay_switch.py --client claude-code --base https://ai.tt2066.top --key sk-xxx
# export ANTHROPIC_BASE_URL="https://ai.tt2066.top"
# export ANTHROPIC_AUTH_TOKEN="sk-xxx"
python3 relay_switch.py --client codex --base https://ai.tt2066.top --key sk-xxx --write
脚本会自动把 base 校正成该客户端要的形状,--write 追加进 ~/.bashrc 并带起止标记,重复执行不会重复写。
/v1,客户端又拼一次 → /v1/v1/messages;