Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
Use this skill when the user asks about Claude Code provider setup, GPT/ChatGPT OAuth via raine/claude-code-proxy or clawgate, MiMo, DeepSeek, Gemini/Vertex, local tier routers, cc-switch, claude-router, claude-gpt, claude-gemini, or fallback launchers.
This skill is intentionally conservative: inspect first, avoid changing providers unless the user explicitly asks, and never print API keys or OAuth tokens.
Known Entrypoints
Common entrypoints:
claude-router: Claude Code through a local tier router, default local proxy 127.0.0.1:8084.
raine-claude-code-proxy: GPT/Codex OAuth backend, default local proxy 127.0.0.1:18765.
claude-gpt: legacy Claude Code through clawgate, default local proxy 127.0.0.1:8082.
claude-gemini: Claude Code through an Anthropic-compatible Gemini/Vertex proxy, default local proxy 127.0.0.1:8083.
cc-switch use mimo && claude: MiMo Token Plan via Anthropic-compatible endpoint.
cc-switch use deepseek && claude: DeepSeek official Claude Code integration.
Final target routing:
Opus / primary -> GPT-5.5 through raine-claude-code-proxy.
Sonnet -> DeepSeek deepseek-v4-pro.
Haiku -> MiMo mimo-v2.5-pro.
SubAgent and unmatched model names -> Gemini/Vertex proxy.
Important: a fallback launcher such as claude-auto may run or , so it can change the default provider. For diagnosis, prefer individual entrypoints.
cc-switch use mimo
cc-switch use deepseek
Router Architecture
The router (router.py) is a FastAPI proxy that sits between Claude Code and multiple LLM backends. It implements intelligent fallback inspired by LiteLLM.
Request Flow
Claude Code → Router (:8084) → Backend
├─ Success → Return response
├─ Retryable error (429, 5xx, quota) → Cooldown + Try next fallback
├─ Fallback error (4xx) → Try next fallback (no cooldown)
└─ All backends exhausted → 502
Error Classification
The router classifies errors into two categories:
Class
Behavior
Trigger
retryable
Cooldown + fallback
429, 502, 503, 504, per-backend extra codes, quota exhaustion in body
fallback
Fallback only, no cooldown
4xx (except 429)
Per-Backend Configurable Retryable Statuses
Some backends return non-standard status codes for quota exhaustion. For example, GPT (raine/claude-code-proxy) returns 400 for "no quota". Configure via .env:
# GPT returns 400 for "no quota" — treat as retryable
GPT_EXTRA_RETRYABLE=400
Cooldown
Failed backends are placed on cooldown for COOLDOWN_SECONDS (default 300s). If the backend returns a Retry-After header, that value is used instead.
This setup uses mixed authentication. The router is not a vault for every provider credential:
Hop
Auth mechanism
Stored where
Claude Code -> router
Local placeholder token such as ANTHROPIC_AUTH_TOKEN=local-router
~/.claude/settings.json or wrapper env
router -> GPT
No API key in router; raine-claude-code-proxy performs Codex/ChatGPT device auth
~/.config/claude-code-proxy/codex/auth.json
router -> Gemini
No API key in router; Gemini proxy performs Google/Vertex auth
service-account JSON, ADC, or Gemini OAuth files
router -> DeepSeek
Router injects DEEPSEEK_API_KEY
router .env
router -> MiMo
Router injects MIMO_API_KEY
router .env
GPT_API_KEY and GEMINI_API_KEY are normally unset in this architecture. Do not copy OAuth refresh tokens, Google service-account JSON contents, or ChatGPT session data into the router .env.
Provider-specific diagnostic order:
GPT: check raine-claude-code-proxy codex auth status, local port 18765, and the raine proxy log.
Gemini: check Google/Vertex credentials and local port 8083.
DeepSeek and MiMo: check router .env keys and endpoint URLs.
Router: check local port 8084, health endpoint, fallback stats, and cooldowns.
Route meanings:
router/opus -> gpt-5.5 through raine-claude-code-proxy.
router/sonnet -> DeepSeek deepseek-v4-pro.
router/haiku -> MiMo mimo-v2.5-pro.
router/subagent and unmatched model names -> Gemini proxy.
Use clawgate as a fallback only. In the local integration, clawgate ChatGPT mode did not reliably satisfy the GPT-5.5 target.
Pitfalls
Do not run curl | bash installers blindly. Inspect installer scripts, download binaries manually when possible, and verify checksums.
clawgate --version may not exist. Use clawgate help, clawgate status, and clawgate account list.
ChatGPT/Codex device auth and clawgate device auth can be separate flows. codex login --device-auth can succeed while clawgate login --default still waits for a different code.
clawgate may not stay resident reliably with plain nohup. Use setsid ... >log 2>&1 < /dev/null &.
clawgate ChatGPT mode warned that gpt-5.5 was not in its known Codex model allowlist, and Opus requests through clawgate timed out under the 20 second acceptance window.
raine/claude-code-proxy v0.0.13 successfully handled GPT-5.5 with Codex device auth in the tested setup.
GPT and Gemini usually do not need API keys in router .env; their upstream auth is handled by local proxy login/credential files.
cc-switch status can show custom providers as Active: unknown. Check the URL and profile config.
Do not use old DeepSeek deepseek-chat / deepseek-reasoner mappings for Claude Code if the official docs specify v4 Claude Code models.
Do not copy terminal style artifacts like [1m] into model names. Treat them as ANSI formatting remnants unless the provider model list explicitly includes them.
Gemini cannot be added to clawgate directly. Use a Gemini/Vertex Anthropic-compatible proxy or call Gemini CLI separately.
A Gemini proxy must run from its repository directory. Starting uvicorn server:app elsewhere can fail with Could not import module "server".
Some Gemini proxies only map Claude model names containing sonnet or haiku; set Claude defaults accordingly to trigger Gemini model mapping.
Some Gemini proxy whitelists lag behind Google model releases. Add model IDs such as gemini-3.1-pro-preview and gemini-3.1-flash-lite before setting them in .env.
gcloud auth application-default login can fail in non-interactive shells at the verification code prompt. Existing GOOGLE_APPLICATION_CREDENTIALS service account JSON can be used where appropriate.
Avoid fallback launchers during quiet audits if they mutate provider state.
Claude Code settings can override shell-level ANTHROPIC_MODEL=... exports. For reliable route validation, update settings or use an entrypoint that fully controls the process environment.
The router must strip incoming auth headers before forwarding. Do not pass authorization, x-api-key, anthropic-api-key, or anthropic-auth-token from Claude Code into arbitrary provider backends.
Claude Code's native --fallback-model only works in --print mode and only handles overloaded (529) errors. It does NOT support cross-provider fallback (different API endpoints). The router is the correct solution for multi-provider fallback.
Safe Workflow
For status-only tasks:
Run the bundled diagnostic script.
Read masked provider config.
For GPT/Gemini, inspect local proxy auth and listener state before looking for router API keys.
For DeepSeek/MiMo, inspect router .env key presence and endpoint URLs.
Avoid running cc-switch use ... unless the user asked to switch providers.
Avoid claude-auto unless the user accepts provider mutation.
For forced router route checks, prefer updating Claude Code settings or using a controlled wrapper. Shell-only overrides can be ignored when ~/.claude/settings.json has an env block.
For MiMo or DeepSeek health checks, tell the user that cc-switch use will change the current default provider before running:
cc-switch use mimo && claude -p '只回复 OK'
cc-switch use deepseek && claude -p '只回复 OK'
--health checks claude-gpt and claude-gemini only. It intentionally does not check MiMo or DeepSeek because that would require cc-switch use, which changes the default provider.