Use QCode with 9router

Add QCode.cc as a custom provider in 9router, a local multi-provider router, for cross-provider fallback and unified management

Use QCode with 9router

9router is a local multi-provider AI routing proxy: it runs an OpenAI-compatible service on your own machine (default http://localhost:20128/v1), takes over requests from tools like Claude Code, Cursor, Cline, and Codex, and forwards them to multiple upstream providers according to your rules (including automatic fallback / switching when a quota is exhausted / output compression to save tokens, etc.). Conceptually it's similar to QCode's own CCR — the difference is that 9router runs on your own machine and is managed by you.

For exact features, ports, and UI, refer to the 9router official repo; this article only covers "how to add QCode to it".

When you need it

  • Connecting to QCode directly is simpler and more stable: if you only use QCode, just point your tool's BASE_URL at api.qcode.cc — you don't need 9router.
  • When 9router makes sense: when you want to mix QCode with other providers (subscription plans, free credits, self-hosted, etc.) and need a unified entry point, automatic fallback, cross-provider switching, or token compression, you can register QCode as one of 9router's providers (as the primary or as a fallback layer).

Add QCode as a provider

  1. Start 9router per its docs and open the local console (default http://localhost:20128).
  2. Under Providers, add a custom / OpenAI-compatible (Compatible Node) provider:

  3. Endpoint / Base URL:

    • Chat (GPT family): https://api.qcode.cc/openai/v1
    • Chat (Claude family, if 9router supports Anthropic-protocol nodes): https://api.qcode.cc/api
    • Image (optional): https://api.qcode.cc/qcode-img/v1 (see the note below)
    • In mainland China, swap the domain for asia.qcode.cc for lower latency.
  4. API Key: your QCode API Key (starts with cr_).
  5. Models / aliases: register claude-opus-4-8, claude-sonnet-4-6, gpt-5.5, gpt-5.4, gpt-5.3-codex, etc. as needed.
  6. Put this QCode provider into your tier / fallback chain (e.g. as the primary, or as a fallback layer once other providers run out of quota).
  7. Point your tools (Claude Code / Cursor / Cline, etc.) at 9router's local entry point http://localhost:20128/v1 — from then on 9router decides when to route to QCode.

Direct QCode vs via 9router

Direct QCode Via 9router
Config complexity Low (one BASE_URL) Medium (need to set up provider / tier / aliases)
Multi-provider fallback None Yes (QCode can be primary or fallback)
Team sharing Yes (cloud service) No (9router is local only; config isn't shared across members)
Usage stats Accurate via QCode dashboard probe.qcode.cc 9router only reflects its own routing choices; quotas still follow the QCode dashboard
Stability Direct is most stable One extra local proxy layer

Notes

  • Local only: 9router runs locally, and its config is not shared between team members.
  • Image routing needs your own testing: 9router exposes /v1/images/generations, but "calling QCode's gpt-image-2 via 9router" is untested and may need extra configuration; if you need reliability, route images via direct image-2.
  • Quotas follow the QCode dashboard: 9router's stats are not the same as your actual QCode account quota (per-Key daily limits, etc. follow the QCode dashboard / probe.qcode.cc).
  • Protocol-to-path mapping: /openai/v1 uses the OpenAI protocol, /api uses the Anthropic protocol, and /qcode-img/v1 is for images — see Endpoints and API formats.

One API Key works across three protocols (Anthropic / OpenAI / Gemini), whether you connect directly or through a router like 9router. Learn about QCode.cc pricing.

Related Documents

gpt-image-2 Image Generation and Editing
OpenAI-compatible gpt-image-2 text-to-image + image-edit API: drop in by switching base_url, multi-region endpoints, unified billing with your QCode key
Image Input (Vision)
Feed images to Claude Code: paste, drag-and-drop, or reference a file path so the model can read screenshots, mockups, architecture diagrams, and charts. Powered by QCode.cc vision models — one API Key works across every endpoint.
Adaptive Thinking Configuration Guide
Adaptive thinking on Claude Opus 4.8 / Sonnet 4.6 / Haiku 4.5: thinking + effort parameters, differences from the legacy budget_tokens, and quality vs. cost trade-offs
🚀
Get Started with QCode — Claude Code & Codex
One plan for both Claude Code and Codex, Asia-Pacific low latency
View Pricing Plans → Create Account
Team of 3+?
Enterprise: dedicated domain + sub-key management + ban protection, from ¥250/person/mo
Learn Enterprise →