OpenCode with UberLLM: a cheaper provider in opencode.json
Add an "uberllm" provider to ~/.config/opencode/opencode.json with npm "@ai-sdk/openai-compatible", baseURL https://api.uberllm.dev/v1 and the models you want, give it your UberLLM key (environment variable or /connect), then pick uberllm/<model id> with /models.
Steps
- Make a key on your keys page and add credit.
- Open (or create)
~/.config/opencode/opencode.json. For one project only, useopencode.jsonin the project folder instead. - Add the provider:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"uberllm": {
"npm": "@ai-sdk/openai-compatible",
"name": "UberLLM",
"options": {
"baseURL": "https://api.uberllm.dev/v1",
"apiKey": "{env:UBERLLM_API_KEY}"
},
"models": {
"moonshotai/kimi-k3": { "name": "moonshotai/kimi-k3" },
"deepseek/deepseek-v4.1-flash": { "name": "deepseek/deepseek-v4.1-flash" },
"deepseek/deepseek-v4.1-flash": { "name": "deepseek/deepseek-v4.1-flash" }
}
}
},
"model": "uberllm/moonshotai/kimi-k3",
"small_model": "uberllm/deepseek/deepseek-v4.1-flash"
}
- Give OpenCode the key. Either set the variable the config reads:
export UBERLLM_API_KEY=ull_your_key
or run /connect inside OpenCode, scroll to Other, enter uberllm as the provider id and paste the key. The id must match the name in provider exactly. If you use /connect, you can delete the apiKey line.
- Start
opencode, type/modelsand pick one of the UberLLM models.
Why the model id has two slashes
OpenCode names a model <provider>/<model>, and UberLLM ids already contain a slash (deepseek/…). OpenCode splits on the first slash only, so uberllm/moonshotai/kimi-k3 means provider uberllm, model moonshotai/kimi-k3. The key under models must be the UberLLM id exactly as it is on uberllm.dev/models.
Tell OpenCode the context size
OpenCode uses the context size to know when to compact a long session. Add a limit to each model, using the numbers on its model page:
"moonshotai/kimi-k3": {
"name": "moonshotai/kimi-k3",
"limit": { "context": 1000000, "output": 64000 }
}
The numbers above are an example; copy the real ones for the model you choose.
Use the right package
Keep "npm": "@ai-sdk/openai-compatible". That package calls /v1/chat/completions, the route every UberLLM model is tested on.
Troubleshooting
ProviderModelNotFoundError: the model you picked is not in themodelslist, or the key there differs from the id in"model". Add it with the exact UberLLM id.- 401 / no answer:
{env:UBERLLM_API_KEY}becomes empty when the variable is not set in the shell that started OpenCode. Export it, or use/connect. /connectkey not used: the provider id you typed there is notuberllm. Runopencode auth listto see what is stored.- 404: check
baseURLends in/v1, and the npm package is the openai-compatible one. - 402 insufficient credits: add credit on the credits page.
Keep reading
- Reference page: OpenCode doc
- Kilo Code setup (same config format)
- Claude Code on UberLLM
- Cheapest Claude API