Blog4 min read

Use SolCard Inference in OpenCode

Add SolCard Inference to OpenCode as a custom OpenAI-compatible provider: the opencode.json block, which model to pick, a check, and what a session costs.

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.

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:

FieldWhat it’s for
npmThe AI SDK package. @ai-sdk/openai-compatible speaks /v1/chat/completions.
options.baseURLThe API endpoint. Ours ends in /v1.
options.apiKey{env:...} reads the key from an environment variable.
modelsThe ids OpenCode lists. Each key must match our model id exactly.
limitContext and output limits, so OpenCode knows how much room is left.
modelThe 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.

Which model to pick

  • solcard-inference-fast for most turns: reading files, small edits, running tests. It’s the default above.
  • solcard-inference-large for the hard ones: planning a change, a bug you can’t pin down. It always reasons and costs about three times as much.
  • solcard-inference-base when you want a second model’s take.

Switch with /models inside OpenCode. Fast, Large or Base has the details.

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, so a long session sends a lot of input. Most of it is cached, at a tenth of the normal rate:

ModelInputCached inputOutput
Fast$1.25$0.125$2.50
Large$3.75$0.375$6.25
Base$1.25$0.125$3.75

USD per 1M tokens, from the pricing page.

Say a turn on Fast resends 80,000 tokens, 75,000 of them cached, and writes 1,500 tokens:

  • 75,000 cached × $0.125 per million = $0.0094
  • 5,000 new × $1.25 per million = $0.0063
  • 1,500 output × $2.50 per million = $0.0038
  • About $0.02 a turn

The same turn on Large is about $0.06, plus its reasoning, which bills as output. Your usage page shows every request with its tokens and cost.

If you code every day, look at the plans. Starter is $20 a month for 20% more usage than pay as you go, and lifts the limit from 60 to 120 requests a minute, which matters when an agent fires requests in bursts.

Troubleshooting

These are the API’s responses; OpenCode may word them differently.

  • 404 Cannot POST /chat/completions: baseURL is missing /v1. It must be https://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 under models doesn’t match a real id. Use solcard-inference-fast, -large or -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.

Bring the prompt that got refused.

Private. No refusals. In the app, or in the tools you already use.

Pay in crypto. No KYC.