OpenCode
Last updated:
On this page
Run OpenCode against staik via the Anthropic endpoint — Swedish GPU infrastructure with prompt caching on reused context.
Configuration
Add staik as an Anthropic provider in ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"staik": {
"npm": "@ai-sdk/anthropic",
"name": "staik",
"options": {
"baseURL": "https://api.staik.se/v1",
"apiKey": "{env:STAIK_API_KEY}"
},
"models": {
"qwen3.6:35b-a3b": {
"name": "Qwen 35B (staik)",
"limit": { "context": 262144, "output": 32768 }
},
"qwen3.5:9b": {
"name": "Qwen 9B (staik)",
"limit": { "context": 262144, "output": 8192 }
},
"gemma4:31b": {
"name": "Gemma 4 31B (staik)",
"limit": { "context": 262144, "output": 32768 }
}
}
}
}
}export STAIK_API_KEY=sk-st-your-keyThe key is sent as x-api-key. baseURL points at /v1 — OpenCode appends
/messages itself. No other changes needed.
Prompt caching
Agent loops resend the same large context (system prompt, repo files, history)
every turn. Via the Anthropic endpoint, OpenCode marks the stable part with
cache_control, and staik bills it as discounted cache_read instead of full
price each time. You can see it in the response:
"usage": {
"input_tokens": 101,
"output_tokens": 2,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 560
}Details on TTL and breakpoints are in the Messages reference.
Models
qwen3.6:35b-a3b (default) has a 262K context window — enough for large repo
contexts. qwen3.5:9b for fast simpler tasks, gemma4:31b for review. See
Models.
Thinking aliases on /v1/messages
The thinking aliases (…-thinking) are stripped in the Anthropic
translation — they behave like the base model without separate reasoning
output. If you need thinking, use
chat completions for that call.
Want to run Claude Code or the Anthropic SDK instead? See Claude Code.