OpenCode with a custom API endpoint
I run qcode.cc, an independent API service (not official Anthropic, OpenAI or Google). The examples use QCode paths; swap the host for any compatible gateway.
Provider Base URLs
Each OpenCode provider appends its own path, so each needs a different Base URL:
| Provider | baseURL | Why |
|---|---|---|
anthropic | https://api.qcode.cc/claude/v1 | The SDK appends /messages. /claude and /api are equivalent prefixes on QCode. |
openai | https://api.qcode.cc/openai/v1 | Built-in provider uses the Responses API for gpt-* models. |
google | https://api.qcode.cc/gemini/v1beta | The google provider does not append /v1beta, unlike the Gemini CLI and @google/genai. |
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"anthropic": { "options": { "baseURL": "https://api.qcode.cc/claude/v1" } },
"openai": { "options": { "baseURL": "https://api.qcode.cc/openai/v1" } },
"google": { "options": { "baseURL": "https://api.qcode.cc/gemini/v1beta" } }
},
"model": "anthropic/claude-opus-5-5"
}
Config lives at ~/.config/opencode/opencode.json (Windows: %USERPROFILE%\.config\opencode\opencode.json). Add the cr_ key through OpenCode's credential flow (/connect) for each provider you use; a missing key shows up as "API key is missing".
Which models go where
- Claude models: Anthropic provider only. Putting a
claude-*id on the OpenAI path returnsmodel_not_available_on_endpoint. - GPT models (
gpt-6.2-sol,gpt-6.2-astra): OpenAI provider. - Gemini (
gemini-4-neon): google provider only. - GLM, Kimi, DeepSeek, Qwen: work on Anthropic and OpenAI Chat, not on Responses. Add a separate
@ai-sdk/openai-compatibleprovider withbaseURLhttps://api.qcode.cc/openai/v1and amodelsmap for them.
Live model list and prices: qcode.cc/models. Full OpenCode walkthrough: docs.qcode.cc OpenCode. Endpoint reference: endpoints and API paths. See also the Gemini setup guide.
Facts checked against docs.qcode.cc on 2026-12-05. I run qcode.cc. Pricing: qcode.cc/pricing (no free quota). Contact: hi@qcode.cc.