Endpoints & API Paths
QCode.cc's Anthropic and OpenAI API protocols (the Gemini path is currently unavailable), three access domains, and how to fill in BASE_URL
Need an API key? Sign up →Endpoints & base URLs →
On This Page
This page consolidates how QCode.cc exposes three API protocols, three access domains, and how to set BASE_URL correctly. A single API Key works across all three protocols — the protocol is chosen by the request path, and our backend routes automatically.
A key works the same whichever option you pick. Not chosen yet? See How to Choose a Plan, then get your key in the Dashboard.
1. API Protocols¶
QCode.cc is compatible with the Anthropic Messages and OpenAI protocols. A Google Gemini protocol path also exists, but QCode has temporarily taken all Gemini models offline, so that path is currently unavailable and the Gemini material below is for protocol reference only:
| Protocol | Typical Clients | Path |
|---|---|---|
| Anthropic Messages | Claude Code / Claude Agent SDK / Cline / Aider | /api/v1/messages or equivalently /claude/v1/messages |
| OpenAI Chat Completions | Official OpenAI SDK / LangChain / DeepSeek-TUI / generic clients | /openai/v1/chat/completions |
| OpenAI Responses | Codex CLI (required for Codex) | /openai/v1/responses |
| Google Gemini API | Gemini CLI / OpenCode (google provider) / Google @google/genai SDK |
/gemini/v1beta/models/{model}:generateContent (currently unavailable) |
Request bodies follow the corresponding official schema (Anthropic POST /v1/messages, OpenAI POST /v1/chat/completions, OpenAI POST /v1/responses, Google POST /v1beta/models/{model}:generateContent).
Note:
/api,/claude, and/openai/v1are path prefixes, not standalone endpoints. SDKs automatically append/v1/messages,/chat/completions, or/responses. Runningcurl https://api.qcode.cc/apidirectly returns an HTML landing page (HTTP 200) — that is not an error and does not prove the path works; use the POST self-test in section 5 below.
2. Which Models Work on Which Protocol¶
The protocol is determined by the request path, but not every model family works on every protocol. The table below is the single source of truth; other pages defer to it.
| Model family | Anthropic/api/v1/messages |
OpenAI Chat/openai/v1/chat/completions |
OpenAI Responses/openai/v1/responses |
Gemini/gemini/v1beta/… |
|---|---|---|---|---|
Claude (claude-opus-* / -sonnet-* / -haiku-* / -fable-*) |
✅ | ❌ | ❌ | — |
GPT (gpt-6.1-sol / gpt-6-sol / gpt-5.6-terra) |
❌ | ✅ | ✅ used by Codex | — |
| GLM / Kimi / DeepSeek / Qwen | ✅ | ✅ | ❌ | — |
| Gemini (not offered by QCode for now) | — | — | — | unavailable |
🔴 Claude models only work on the Anthropic protocol. Putting claude-… into
/openai/v1/chat/completions returns:
{"error":{"code":"model_not_available_on_endpoint",
"message":"Model 'claude-sonnet-5' is not available on this endpoint. Claude models are served only through the Anthropic Messages API: use a base URL ending in /api (or /claude) and send POST /v1/messages. OpenAI-compatible endpoints do not serve Claude models. / Claude 模型只能走 Anthropic Messages 接口:BASE_URL 以 /api(或 /claude)结尾,请求 POST /v1/messages;OpenAI 兼容接口不提供 Claude 模型。",
"param":"model",
"type":"invalid_request_error"}}
This check runs before authentication — you get this error even with an invalid key. So
model_not_available_on_endpoint means you picked the wrong protocol, not that your key is
bad; a bad key returns Invalid API key instead. Don't confuse the two.
The restriction is specific to Claude, not a blanket "no cross-protocol" rule:
-
The four Chinese families (GLM / Kimi / DeepSeek / Qwen) work on both the Anthropic endpoint and the OpenAI Chat endpoint
-
GPT models use the two OpenAI endpoints; they do not work on the Anthropic endpoint either
What this means when choosing a tool: clients that only speak the OpenAI protocol and offer no custom Anthropic endpoint (for example DeepSeek-TUI and WorkBuddy) cannot use Claude models through QCode, though GPT and the Chinese models work fine. For Claude, pick a client that speaks the Anthropic protocol (Claude Code, Cline, Zed, or Cursor's Anthropic path).
3. Three Access Domains¶
All three domains serve identical business capabilities; they differ only in network routing:
| Domain | Target Users | Scheme | Notes |
|---|---|---|---|
api.qcode.cc |
Global (Route 53 latency-based) | HTTPS | Primary for outside China, picks nearest node |
us.qcode.cc |
North America / Europe | HTTPS | Los Angeles node |
asia.qcode.cc |
Asia | HTTPS | Asia node (Korea / Taiwan / Hong Kong) |
A single API Key works on all three domains — feel free to switch.
🇨🇳 Note for CN users: We recommend
asia.qcode.cc(Asia node: Korea / Taiwan / Hong Kong); switch toapi.qcode.cc(global Route 53) if unstable. All domains report to probe.qcode.cc — enter your API Key on that page to inspect request details, context length, usage, and more.
4. BASE_URL Cheatsheet¶
Fill in the following based on your tool:
| Tool | Env Var / Config Key | Value | SDK Will Send To |
|---|---|---|---|
| Claude Code | ANTHROPIC_BASE_URL |
https://api.qcode.cc/api |
/api/v1/messages |
| Claude Agent SDK | base_url= constructor arg |
https://api.qcode.cc/api |
/api/v1/messages |
| Cline / Aider | Anthropic mode base URL | https://api.qcode.cc/api |
/api/v1/messages |
| OpenAI Python/JS SDK | base_url= constructor arg |
https://api.qcode.cc/openai/v1 |
/openai/v1/chat/completions |
DeepSeek-TUI (openai provider) |
TOML base_url = or OPENAI_BASE_URL |
https://api.qcode.cc/openai/v1 |
/openai/v1/chat/completions |
| Codex CLI | TOML base_url = |
https://api.qcode.cc/openai |
/openai/v1/responses |
OpenCode (google provider) |
baseURL |
https://api.qcode.cc/gemini/v1beta |
/gemini/v1beta/models/{model}:generateContent |
Gemini CLI / Google @google/genai SDK |
base URL | https://api.qcode.cc/gemini |
/gemini/v1beta/models/{model}:generateContent |
Why two forms for Gemini? OpenCode's
/v1beta/, so thebaseURLmust include it (/gemini/v1beta). Gemini CLI and Google's official@google/genaiSDK do auto-append/v1beta/, so the base URL only goes up to/gemini— appending/v1betayourself would yield/gemini/v1beta/v1beta/...and return 404.⚠️ Gemini currently unavailable: QCode has temporarily taken all Gemini models offline, so the two Gemini base URL rows above are for protocol reference only; please use Claude, GPT, or the Chinese models instead. Separately, Gemini CLI reached end-of-life on 2026-06-18 (consumer account tiers); the official recommendation is the Google Antigravity CLI.
Desktop clients: Cherry Studio lets you enter all four protocol endpoints above as custom providers — see Cherry Studio Integration. For per-tool protocol support and whether Claude works, see Tool Compatibility Overview; for subscriptions vs API keys, see Subscriptions vs API Keys vs QCode Keys.
5. Self-Test with curl¶
Before wiring up a full SDK, you can verify the path and network connectivity with a plain POST:
KEY="cr_your_key"
# Anthropic protocol path test
curl -s -o /dev/null -w '%{http_code}\n' -X POST https://api.qcode.cc/api/v1/messages \
-H "Authorization: Bearer $KEY"
# → 400 = path & key both OK (missing body is expected); 401 = invalid key
# OpenAI Chat Completions path test
curl -s -o /dev/null -w '%{http_code}\n' -X POST https://api.qcode.cc/openai/v1/chat/completions \
-H "Authorization: Bearer $KEY"
# → 400 / 401 as above
# OpenAI Responses (used by Codex)
curl -s -o /dev/null -w '%{http_code}\n' -X POST https://api.qcode.cc/openai/v1/responses \
-H "Authorization: Bearer $KEY"
# → 400 / 401 as above
# Google Gemini protocol path test (QCode does not offer Gemini for now; this path is unavailable, reference only)
curl -s -o /dev/null -w '%{http_code}\n' -X POST "https://api.qcode.cc/gemini/v1beta/models/gemini-2.5-pro:generateContent" \
-H "x-goog-api-key: $KEY"
# → 400 / 401 = path OK
Interpretation: with a key attached, 400 (missing body) or 401 (key issue) both mean the path mapping and network are fine; 404 means a wrong path prefix — fix it against the table in section 4. If a keyed request returns 402 with a code of *_cost_limit_exceeded, the path and key are fine too — that key's quota is simply used up (see Error Codes). Note: hitting these paths without a key returns an HTML intro page (HTTP 200) rather than an error — seeing it means your key wasn't attached.
End-to-end test with a real API Key:
curl -X POST https://api.qcode.cc/api/v1/messages \
-H "x-api-key: YOUR_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"claude-sonnet-5","max_tokens":64,"messages":[{"role":"user","content":"ping"}]}'
Swapping the domain to us.qcode.cc / asia.qcode.cc with the same path should produce the same result — this confirms the alternate domain is usable for you.
6. FAQ¶
Q: Why does curl https://api.qcode.cc/api return an HTML page?
A: /api is a path prefix, not an endpoint; requests that match no API route are sent to a landing page (HTTP 200). The full path is /api/v1/messages — verify it with the POST self-test in section 5 (a 401 means the request reached authentication).
Q: Any difference between /api/v1/messages and /claude/v1/messages?
A: No. Both prefixes route to the Anthropic Messages protocol — use whichever your SDK defaults to. Our docs default to /api because that's what most Claude-ecosystem SDKs expect.
Q: Can one API Key call both Claude and Codex (GPT)?
A: Yes. Keys are protocol-agnostic; the protocol is chosen by the request path. /api/v1/messages means Anthropic, /openai/v1/responses means OpenAI Responses. QCode does not offer Gemini models for now.
Q: Should Gemini's baseURL end with /v1beta or not?
A: (QCode does not offer Gemini for now; the following is protocol reference only.) It depends on the tool. OpenCode's google provider needs it (set baseURL to /gemini/v1beta) because it does not auto-append /v1beta/. Gemini CLI and Google's @google/genai SDK do not (set base URL to /gemini) — the SDK appends /v1beta/ itself, and adding it manually would produce /gemini/v1beta/v1beta/... and return 404.
Q: Which domain should I pick?
A: Mainland China → asia.qcode.cc (Asia node: Korea / Taiwan / Hong Kong) or api.qcode.cc (global Route 53); North America / Europe → us.qcode.cc. If your primary domain stalls, switch to one of the other domains.
Q: Can I see my own request history?
A: Yes. Requests sent through any domain (api.qcode.cc / asia.qcode.cc / us.qcode.cc) are reported to probe.qcode.cc. Enter your API Key there to view the request list, models, tokens, and more.
Q: Should I include a trailing slash in BASE_URL?
A: No. Most SDKs auto-append paths like /v1/messages; a trailing slash would produce //v1/messages and cause 404.
Get started with QCode
One API key for Claude Code, Codex and more — billed per token, per-model prices on qcode.cc/models