Integration
opencode with an LLMcode provider
opencode keeps providers in opencode.json. The LLMcode entry is a standard OpenAI-compatible provider with a models map you control.
Updated
The provider entry
Add a provider named llmcode with the @ai-sdk/openai-compatible package, the base URL https://llmcode.io/v1 and the key read from LLMCODE_API_KEY. The models map lists every published slug you want to offer.
Each profile in the map becomes a selectable model. A token without a model allowlist may use all published profiles; a token with one is limited to that list, and anything else returns 403.
Autocomplete versus chat
opencode uses the same provider for chat and inline completion. Pointing completion at a fast, cheap profile and chat at a larger one keeps latency down without splitting the billing: both go through one balance.
- baseURL: https://llmcode.io/v1
- apiKey: {env:LLMCODE_API_KEY}
- models: published slugs from /models
When the provider does not appear
Validate the JSON first — a trailing comma hides the whole file. Then reload the editor window so the engine rereads the provider list; the config is parsed at startup.
If the model list is empty, run GET /v1/models with the same key. An empty answer means the key is restricted, not that the config is wrong.
Connect
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"llmcode": {
"npm": "@ai-sdk/openai-compatible",
"name": "LLMcode",
"options": {
"baseURL": "https://llmcode.io/v1",
"apiKey": "{env:LLMCODE_API_KEY}"
},
"models": {
"claude-sonnet-5-5": {},
"deepseek-flash": {}
}
}
}
}curl https://llmcode.io/v1/models \
-H "Authorization: Bearer $LLMCODE_API_KEY"Published model prices
USD per 1M tokens. The numbers come from the public catalog on every page rebuild — this is the sale price, not an estimate.
| Model | Input | Output | Cache |
|---|---|---|---|
| Claude Opus 5.5 | $2.70 | $8.00 | $0.14 |
| DeepSeek Flash | $0.50 | $2.00 | $0.01 |
| Claude Sonnet 5.5 | $1.33 | $6.67 | $0.07 |
| DeepSeek V4 Pro | $2.20 | $6.60 | $0.07 |
Top-up from $10, balance in USD. 1 USD = 1,000,000 UT. No subscription and no auto-charge.
Questions
Where does opencode.json live?
In ~/.config/opencode/opencode.json for a global setup, or in the project directory for a per-repository configuration.
Which package name should the provider use?
@ai-sdk/openai-compatible — the provider is OpenAI-compatible, so opencode needs no custom adapter.
Can several profiles share one key?
Yes. The model is chosen per request; the key is not bound to a single profile unless you set an allowlist.
Does streaming work in opencode?
Chat completions stream over SSE. The /v1/responses endpoint does not stream in this version and returns 400 with stream: true.