Contents
OpenCode takes any OpenAI-compatible API as a custom provider: add a provider block to opencode.json that uses the @ai-sdk/openai-compatible package, set baseURL to https://api.solcardinference.ai/v1, and list the model ids. The block below is the one we ran on November 1, 2026, and OpenCode chatted and used its tools through it. Using Kilo Code? See Use SolCard Inference in Kilo Code. Using Goose? See Use SolCard Inference in Goose. Using Crush? See Use SolCard Inference in Crush. Using Pi? See Use SolCard Inference in the Pi coding agent.
What you need
- A SolCard Inference API key. Make one on the dashboard’s API keys page. Keys start with
sk-si-and are shown once. - Some balance or a plan. One prepaid USD balance pays for every key and model; see how billing works.
- OpenCode. We tested version 1.19.5.
Put the key in an environment variable so it stays out of the config file:
export SOLCARD_INFERENCE_API_KEY=sk-si-...
The opencode.json block
Save this as opencode.json in your project, or point the OPENCODE_CONFIG variable at it:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"solcard-inference": {
"npm": "@ai-sdk/openai-compatible",
"name": "SolCard Inference",
"options": {
"baseURL": "https://api.solcardinference.ai/v1",
"apiKey": "{env:SOLCARD_INFERENCE_API_KEY}"
},
"models": {
"solcard-inference-fast": { "name": "SolCard Inference Fast", "limit": { "context": 256000, "output": 32768 } },
"solcard-inference-large": { "name": "SolCard Inference Large", "limit": { "context": 256000, "output": 32768 } },
"solcard-inference-base": { "name": "SolCard Inference Base", "limit": { "context": 256000, "output": 32768 } }
}
}
},
"model": "solcard-inference/solcard-inference-fast"
}
What each part does, per OpenCode’s provider docs:
| Field | What it’s for |
|---|---|
npm | The AI SDK package. @ai-sdk/openai-compatible speaks /v1/chat/completions. |
options.baseURL | The API endpoint. Ours ends in /v1. |
options.apiKey | {env:...} reads the key from an environment variable. |
models | The ids OpenCode lists. Each key must match our model id exactly. |
limit | Context and output limits, so OpenCode knows how much room is left. |
model | The default, as provider-id/model-id. |
Every model writes at most 32,768 tokens per request, so keep output at that. If you’d rather read the key from a file, "apiKey": "{file:~/path/to/key}" works too.
OpenCode’s docs say to use @ai-sdk/openai instead if a provider speaks the Responses API. Our API serves both, but the block above, on Chat Completions, is the one we tested. To call our models from your own code with the same package, see the Vercel AI SDK guide.
Switching models
Start on solcard-inference-fast, the default above, and switch with /models inside OpenCode when a change needs planning or a bug won’t give. solcard-inference-large always reasons and costs about three times as much. Fast, Large or Base compares the three.
Check it works
List what OpenCode sees:
opencode models solcard-inference
It should print solcard-inference/solcard-inference-fast, -large and -base. Then send one prompt:
opencode run "Say hello in five words."
In the TUI, the header shows the model in use, for example build · solcard-inference-fast.
What a session costs
OpenCode sends the whole conversation every turn, mostly at the cached rate. A turn on Fast that resends 80,000 tokens, 75,000 of them cached, and writes 1,500 tokens is about $0.02; on Large it’s about $0.06 plus its reasoning. Check your usage page after your first long session: it lists every request with its tokens and cost. How billing works has the price list and the plans.
Troubleshooting
These are the API’s responses; OpenCode may word them differently.
404 Cannot POST /chat/completions:baseURLis missing/v1. It must behttps://api.solcardinference.ai/v1.401 invalid_api_key: the key is missing, mistyped, or revoked. Check the variable is set in the shell that started OpenCode.400 model_not_found: a key undermodelsdoesn’t match a real id. Usesolcard-inference-fast,-largeor-base.400 unsupported_content: you pasted an image or file. Our models take text only.
The errors page lists every code.
FAQ
Can I keep my other providers in OpenCode?
Yes. The block adds one provider; the others stay. Pick between them with /models.
Why don’t my models show up?
Check that opencode.json is in the project you run opencode in, or that OPENCODE_CONFIG points at it, and that the JSON parses.
Are my prompts stored? No. Prompts and responses aren’t stored or logged, on any model; keeps nothing follows one request through.
Can I use Claude Code or Codex too? Yes, with one sentence: see Claude Code and Codex.