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 opencode

What 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": {
        "zai-org/GLM-5.3": { "name": "GLM 5.3" },
        "moonshotai/Kimi-K3": { "name": "Kimi K3" }
      }
    }
  }
}

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

FlagEffect
--model zai-org/GLM-5.3Select the active model
--base-url <url>Point at a different API base
--dry-runPrint 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

ModelInput / output per 1MUse for
zai-org/GLM-5.3-Flash0.20 / 0.60Fast edits, formatting, small refactors
zai-org/GLM-5.31.20 / 4.20General coding turns
deepseek-ai/DeepSeek-V4.1-Flash0.50 / 1.50Long-context work at low cost
moonshotai/Kimi-K33.00 / 15.00Hard 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 /control/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.