Docs menu

OpenCode

Wire: OpenAI. Base URL: https://sator-api.princep.org/v1. State: verified against OpenCode's provider configuration docs.

Install#

Follow opencode.ai for your platform. Any current version works.

Configure#

Put your key in the environment — OpenCode substitutes {env:…} at load time, so the key never sits in the file:

bash
export SATOR_API_KEY=sk-sator-v1-...

Add a sator provider to ~/.config/opencode/opencode.json (or a project's opencode.json). List each model you want under models, with its context and output limits from Models, because OpenCode does not discover limits for a custom provider:

json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "sator": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Princeps Sator",
      "options": {
        "baseURL": "https://sator-api.princep.org/v1",
        "apiKey": "{env:SATOR_API_KEY}"
      },
      "models": {
        "deepseek-v4-flash": {
          "name": "DeepSeek V4 Flash",
          "limit": { "context": 1000000, "output": 384000 }
        }
      }
    }
  },
  "model": "sator/deepseek-v4-flash"
}

Models are addressed as sator/<model id> — the provider key you chose, a slash, the id from the catalog.

Verify#

Start opencode in a project and ask for something small:

> Reply with exactly: ok
ok

The model picker (/models) lists Princeps Sator with the models you configured. The request appears in your dashboard under the key you used, within a minute.

Troubleshooting#

  • 404 on every request — the baseURL is missing its /v1. This wire needs it.
  • Incorrect API key providedSATOR_API_KEY is not set in the shell OpenCode was started from, or the key was revoked. {env:SATOR_API_KEY} is substituted at startup, so export it before launching.
  • The model is missing from the picker — the id under models must match the catalog exactly (deepseek-v4-flash, not DeepSeek-V4-Flash). Check GET /v1/models.
  • Responses cut off earlylimit.output is what OpenCode sends as max_tokens; set it to the model's max output.