opencode
Route opencode through sference: a sference provider in opencode.json with the full catalog in the model picker.
opencode
opencode reads providers from ~/.config/opencode/opencode.json. The sference launcher writes a sference provider there and starts opencode with it selected.
Launch
curl -fsSL https://raw.githubusercontent.com/s-ference/sference/main/install.sh | sh
sference auth login --api-key 'sk_...'
sference launch opencodeWhat the launcher writes
A sference provider using the AI SDK's OpenAI-compatible provider, with the full catalog registered:
{
"provider": {
"sference": {
"npm": "@ai-sdk/openai-compatible",
"name": "Sference",
"options": {
"baseURL": "https://api.sference.com/v1",
"apiKey": "{env:SFERENCE_API_KEY}"
},
"models": {
"deepseek-ai/DeepSeek-V4.1-Flash-1017": { "name": "DeepSeek V4.1 Flash" },
"zai-org/GLM-5.3": { "name": "GLM 5.3" }
}
}
}
}The catalog is fetched live from GET /v1/models, so the picker matches your entitlements. The API key is injected at launch from SFERENCE_API_KEY rather than written into the file.
Options
| Flag | Effect |
|---|---|
--model deepseek-ai/DeepSeek-V4.1-Flash-1017 | Select the active model |
--base-url <url> | Point at a different API base |
--dry-run | Print the provider config and command without launching |
sference launch opencode -- <args> | Forward arguments to opencode |
Reasoning levels
opencode exposes reasoning effort as a model variant. sference models are addressed as sference/<model-id>, and reasoning levels are selected through opencode's variant switcher rather than a separate model id — the launcher registers the base ids and opencode handles the level.
Choosing a model
| Model | Input / output per 1M | Use for |
|---|---|---|
deepseek-ai/DeepSeek-V4.1-Flash-1017 | 0.35 / 1.32 | The default: general coding turns, long context, image input |
zai-org/GLM-5.3-Flash | 0.20 / 0.60 | Fast edits, formatting, small refactors |
zai-org/GLM-5.3 | 1.20 / 4.20 | Hard planning turns |
Cost control
- Prefix caching — keep the system prompt and tool definitions stable and first. See Prompt caching.
- Per-engineer attribution — one key per engineer shows up separately in
GET /v1/usage/by-key. See Usage & analytics.
It is a compatibility layer
Open models plan differently and call tools less reliably than frontier closed models on long repo work. Validate on your own repository first. See SferenceCode for what to expect.