Published · Last updated
Short answer: To add Qora API to OpenCode, define a custom OpenAI-compatible provider with base URL https://qoraapi.com/v1, your Qora API key and the model IDs you want, then pick it with /models. As of November 18, 2026 OpenCode documents two config formats: V1 (provider + npm: @ai-sdk/openai-compatible) and the newer V2 (providers + package + settings.baseURL). Both are shown below.
This guide uses Qora API, an OpenAI-compatible gateway for non-mainland-China users, but the same steps work for any OpenAI-compatible endpoint. Config fields come from OpenCode’s providers docs (V2), the V1 providers docs and the V1 to V2 migration guide.
How do you add a custom provider to OpenCode?
- Create a Qora API key (minimum top-up is $50; new users can ask for a $5 trial via X @QoraAPI or [email protected]).
- Export the key:
export QORA_API_KEY="sk-..." - Add the config below to
opencode.json(project root) or your global OpenCode config. - Start OpenCode, run
/modelsand choose aqora/...model.
V1 config (provider + @ai-sdk/openai-compatible)
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"qora": {
"npm": "@ai-sdk/openai-compatible",
"name": "Qora API",
"options": {
"baseURL": "https://qoraapi.com/v1",
"apiKey": "{env:QORA_API_KEY}"
},
"models": {
"deepseek/deepseek-v4.1-flash": { "name": "DeepSeek V4.1 Flash" },
"glm-5.2": { "name": "GLM-5.2" }
}
}
}
}
V2 config (providers + package + settings)
OpenCode’s migration guide says V2 renames provider to providers, npm to package (AI SDK packages get an aisdk: prefix) and moves baseURL/apiKey into settings:
{
"$schema": "https://opencode.ai/config.json",
"providers": {
"qora": {
"name": "Qora API",
"package": "aisdk:@ai-sdk/openai-compatible",
"settings": {
"baseURL": "https://qoraapi.com/v1",
"apiKey": "{env:QORA_API_KEY}"
},
"models": {
"deepseek/deepseek-v4.1-flash": { "name": "DeepSeek V4.1 Flash" },
"glm-5.2": { "name": "GLM-5.2" }
}
}
}
}
The provider key (qora) is the ID you use in model references, for example qora/glm-5.2. Not sure which version you run? Use the format that matches the docs for your installed release; OpenCode’s own V2 page says its example is the V2 shape.
Can you add the key with /connect instead?
Yes, in V1: run /connect, scroll to Other, enter a provider ID such as qora, then paste the key. OpenCode warns this only stores the credential; you still need the opencode.json block so it knows the base URL and models. The provider ID in /connect must equal the ID in your config.
Which models should you use with OpenCode through Qora?
As of November 18, 2026 these are Qora’s default-group prices per 1M tokens, read from the live pricing page (up to 70% off official prices):
| Model ID | Qora input / output | Official input / output | Good for |
|---|---|---|---|
deepseek/deepseek-v4.1-flash |
$0.15 / $0.45 | $0.30 / $1.20 | Cheap everyday coding and agents |
glm-5.2 |
$0.42 / $1.32 | $1.40 / $4.40 | Coding with a stronger model |
deepseek/deepseek-v4-pro |
$0.51 / $1.05 | see DeepSeek pricing | Harder reasoning tasks |
Model pages: DeepSeek V4.1 Flash and GLM-5.2. Prices can change, so check /pricing before budgeting. Note that DeepSeek’s own off-peak and cache-hit rates can undercut a gateway on some tokens.
Why is my OpenCode custom provider not showing up?
The custom provider usually does not show because the config is not being read, the format does not match your OpenCode version, or the provider ID differs between credentials and config. Work through this list:
- Wrong key name for your version. Using
provider/npmon a V2 build, orproviders/packageon a V1 build, means the block is ignored. Check the migration guide. - ID mismatch. The ID typed in
/connectmust match the key in your config. Runopencode auth listto see stored credentials (V1 troubleshooting step). - Models missing. Only models listed under
modelsappear. Each ID must match the gateway’s model ID exactly; list them withcurl https://qoraapi.com/v1/models -H "Authorization: Bearer $QORA_API_KEY". - Wrong base URL. It must end in
/v1and have no trailing path such as/chat/completions. - Env var not set.
{env:QORA_API_KEY}resolves to nothing if the variable is missing in the shell that launched OpenCode.
Why does the custom provider return errors or not work?
Test the endpoint outside OpenCode first; if curl works, the problem is in the config.
curl https://qoraapi.com/v1/chat/completions
-H "Authorization: Bearer $QORA_API_KEY"
-H "Content-Type: application/json"
-d '{"model":"deepseek/deepseek-v4.1-flash","messages":[{"role":"user","content":"Say hi"}]}'
- 401: key missing or wrong, or sent with the wrong header. Re-check the env var.
- Model not found: the model ID in config differs from the gateway ID.
- Responses API models: OpenCode’s docs say
@ai-sdk/openai-compatibletargets/v1/chat/completions, and@ai-sdk/openaiis for models that use/v1/responses. Qora lists chat completions and responses endpoints per model on its pricing data. - Context shown wrong: add
"limit": {"context": 200000, "output": 65536}to a model so OpenCode can track remaining context (documented V1 option; set the numbers from the model’s real limits).
How do you set reasoning effort or custom headers?
OpenCode lets you add headers to a provider and, in V2, merge JSON fields into every request with body, or define named variants per model. Use these only for parameters the target model actually accepts; unsupported parameters are rejected by some models. Qora passes OpenAI-format requests through to the model.
How much does OpenCode cost with Qora?
Example: a coding session that uses 2M input and 200K output tokens costs about $0.39 on deepseek/deepseek-v4.1-flash through Qora (2 x $0.15 + 0.2 x $0.45) versus about $0.84 at the official $0.30 / $1.20 list price. The same session on glm-5.2 is about $1.10 (2 x $0.42 + 0.2 x $1.32).
Using another editor? See the Zed OpenAI-compatible provider guide or the SillyTavern DeepSeek V4.1 Flash setup. Create your Qora API key to get started.
OpenCode custom provider FAQ
What base URL do I use for Qora API in OpenCode?
Use https://qoraapi.com/v1, with the @ai-sdk/openai-compatible package for chat completions.
Do I need /connect if I put the key in the config?
No. Setting apiKey to {env:QORA_API_KEY} in the provider options (V1) or settings (V2) is enough; /connect is an alternative way to store the key.
Where does opencode.json go?
Put it in your project root for per-project settings; OpenCode also reads a global config. Project config is the simplest place to start.
Can I use Claude or GPT models this way?
Yes if they are listed on the pricing page with an OpenAI-compatible endpoint; add their exact IDs under models. Prices differ by model group.
Is Qora available in mainland China?
No. Qora API only serves users outside mainland China.
Using workflow automation? See our n8n OpenAI-compatible API setup guide for the same base URL in n8n.
Using Kilo Code? See how to add Qora API as a custom provider in Kilo Code.

Leave a Reply