OpenCode

Add SipToken as a provider in OpenCode and code with SipToken models.

Before you start

  • A SipToken key in the Official group. If you don't have one yet, see Quickstart.
  • Base URL: https://api.siptoken.ai/v1. Include /v1.
  • OpenCode V2. This page uses the V2 config format. If you're still on V1, see the FAQ at the end.

In OpenCode, SipToken is added as a custom provider that uses the OpenAI format. For Claude models you can add a second provider that uses the Anthropic format, described below.

Install

macOS / Linux:

curl -fsSL https://opencode.ai/v2/install | bash

On macOS / Linux you can also use Homebrew:

brew install anomalyco/tap/opencode-v2

npm works on all three systems. Use it on Windows:

npm install -g @opencode/cli

There's no winget, Scoop or similar package for Windows. If you'd rather not use npm, download the zip or the desktop app from opencode.ai. If you have V1 installed, uninstall it first. Install docs: opencode.ai/docs.

Check the version after installing:

opencode --version

Configure

Config file location

ScopemacOS / LinuxWindows
Global~/.config/opencode/opencode.json%USERPROFILE%\.config\opencode\opencode.json
Projectopencode.json in the project root, or .opencode/opencode.jsonSame

You can also use the .jsonc extension, which allows comments. The steps below use the global file, so every project picks it up.

macOS / Linux:

mkdir -p ~/.config/opencode
nano ~/.config/opencode/opencode.json

Windows PowerShell:

New-Item -ItemType Directory -Force "$env:USERPROFILE\.config\opencode" | Out-Null
notepad "$env:USERPROFILE\.config\opencode\opencode.json"

File contents

The contents are the same on both systems:

{
  "$schema": "https://opencode.ai/config.json",
  "providers": {
    "siptoken": {
      "name": "SipToken",
      "package": "@opencode/ai/providers/openai-compatible",
      "env": ["SIPTOKEN_API_KEY"],
      "settings": {
        "baseURL": "https://api.siptoken.ai/v1"
      },
      "models": {
        "gpt-6.1-sol": { "name": "gpt-6.1-sol" },
        "gpt-6.2-astra": { "name": "gpt-6.2-astra" },
        "deepseek-v4-pro": { "name": "deepseek-v4-pro" },
        "kimi-k3.1-pro": { "name": "kimi-k3.1-pro" },
        "glm-5.3": { "name": "glm-5.3" },
        "qwen4-max": { "name": "qwen4-max" },
        "grok-4.7": { "name": "grok-4.7" }
      }
    }
  },
  "model": "siptoken/gpt-6.1-sol"
}
  • siptoken is the provider ID. You can rename it. When picking a model, write siptoken/<model ID>.
  • env tells OpenCode to read the key from the SIPTOKEN_API_KEY environment variable. You can skip the variable and enter the key with /connect instead (next section).
  • The keys under models must match SipToken model IDs exactly. Add or remove models as needed.
  • model is the default model.
  • If the file already has other settings, add only the siptoken block to the existing providers. Don't overwrite the whole file.

Enter the key

We recommend /connect. You enter the key once and it's kept:

  1. Run opencode.
  2. Type /connect and pick SipToken.
  3. Paste your key.

You can also do it from the command line:

opencode auth login siptoken --method key

The key is stored locally in ~/.local/share/opencode/opencode.db. opencode auth list shows which providers have a key.

Use an environment variable

You can use the SIPTOKEN_API_KEY environment variable instead. Note that OpenCode V2 normally sends requests from a background service process, and that process has to see the variable.

To try it in the current terminal only, start with --standalone.

macOS / Linux:

export SIPTOKEN_API_KEY="sk-xxxxxxxx"
opencode --standalone

Windows PowerShell:

$env:SIPTOKEN_API_KEY = "sk-xxxxxxxx"
opencode --standalone

To make it permanent, set the variable on the background service:

opencode service set env SIPTOKEN_API_KEY sk-xxxxxxxx

Claude models over the Anthropic format (optional)

We recommend the Anthropic format for claude-* models. In the same file, add a second provider under providers, next to siptoken:

{
  "providers": {
    "siptoken-claude": {
      "name": "SipToken Claude",
      "package": "@opencode/ai/providers/anthropic-compatible",
      "env": ["SIPTOKEN_API_KEY"],
      "settings": {
        "baseURL": "https://api.siptoken.ai/v1"
      },
      "models": {
        "claude-opus-5-5": { "name": "claude-opus-5-5" },
        "claude-sonnet-5-5": { "name": "claude-sonnet-5-5" },
        "claude-haiku-5-5": { "name": "claude-haiku-5-5" }
      }
    }
  }
}

This baseURL also includes /v1. Unlike most Anthropic-format clients, OpenCode only appends /messages. Pick these models as siptoken-claude/claude-sonnet-5-5. If you use /connect, enter the key for this provider too.

Verify

opencode run --model siptoken/gpt-6.1-sol "Reply with exactly: ok"

If it returns ok, you're connected. If you set up Claude, test siptoken-claude/claude-sonnet-5-5 as well.

In the TUI, /models lists the SipToken models. After editing the config file, run /reload in the TUI. No restart needed.

If it fails, test the key itself with the curl commands in Quickstart. If curl works and OpenCode doesn't, the problem is in the configuration.

Common errors

ErrorCause and fix
Model unavailable: siptoken/…The model ID isn't under models, or the provider ID is wrong. Check the config, then run /reload.
No model is available for session …No default model is set, or its provider has no key yet. Set model, then enter the key with /connect.
401, "invalid token"Usually the key isn't being sent or is wrong. Check opencode auth list. If you use an environment variable, make sure the background service can see it.
403, mentions quotaUsually your balance or the key's quota is used up. Top up on the Wallet page or raise the key's quota.
404Usually baseURL is missing /v1. Set both providers to https://api.siptoken.ai/v1.
429You've hit 120 requests per minute. One task sends many requests in a row. Wait a moment and retry.
503, "no available channel"Usually a key under models doesn't match a SipToken ID. Fix it to match what GET /v1/models returns.
Timeout, 5xxUsually a temporary failure or a very long generation. Retry, and check the status page. For long tasks, raise headerTimeout and chunkTimeout under settings.

FAQ

My config changes don't apply

Check the JSON first, for example a trailing comma. Then make sure you edited the global file and that no opencode.json in the project sets a different value. Run /reload in the TUI after editing.

The context length looks wrong

OpenCode doesn't know the context length of custom models. Add limit to the model, using the numbers from the model list:

"gpt-6.1-sol": {
  "name": "gpt-6.1-sol",
  "limit": { "context": 200000, "output": 32000 }
}

The numbers above are only an example.

Can I use Gemini models?

You can add gemini-4-argon and the others under models in siptoken. They then use the OpenAI format.

I'm still on V1

V1 uses a different shape: the key is provider, the package goes in npm, and the URL goes under options.

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "siptoken": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "SipToken",
      "options": {
        "baseURL": "https://api.siptoken.ai/v1",
        "apiKey": "{env:SIPTOKEN_API_KEY}"
      },
      "models": {
        "gpt-6.1-sol": { "name": "gpt-6.1-sol" }
      }
    }
  }
}

We recommend upgrading to V2. Don't install V1 and V2 side by side.

No key yet?Sign up and top up, then create one on the Tokens page in the console.
Create one in the console →