Use /model in OpenCode

Add /model to OpenCode as a provider in opencode.json, with the models you want and their limits.

Checked November 23, 2026

OpenCode reads its providers from a config file. Add /model as a provider, list the models you want, and pick one.

Before you start

Set it up

  1. Put your key in the SLASHMODEL_API_KEY environment variable.
  2. Add the provider below to ~/.config/opencode/opencode.json, or to opencode.json in a project.
  3. Run opencode. It starts with the model set in model.
opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "model": "slashmodel/claude-sonnet-5-5",
  "providers": {
    "slashmodel": {
      "name": "slashmodel",
      "env": ["SLASHMODEL_API_KEY"],
      "package": "@opencode/ai/providers/openai-compatible",
      "settings": { "baseURL": "https://api.slashmodel.com/v1" },
      "models": {
        "claude-sonnet-5-5": { "name": "Claude Sonnet 5.5", "limit": { "context": 1000000, "output": 64000 } },
        "claude-opus-5-5": { "name": "Claude Opus 5.5", "limit": { "context": 1000000, "output": 128000 } },
        "gpt-6.1-sol": { "name": "GPT-6.1 Sol", "limit": { "context": 1050000, "output": 128000 } }
      }
    }
  }
}
  • The provider's name, slashmodel here, is yours to choose. A model is then slashmodel/ followed by its id.
  • Give each model its real limits, from its page under Models. For a model it doesn't know, OpenCode assumes a 200K context and 32K output.

Claude in Anthropic's format

To send Claude requests in Anthropic's format, add a second provider with "package": "@opencode/ai/providers/anthropic-compatible" and the same base URL, with /v1.

One key for every model here.

Top up from $10, change one URL, and pay only for the tokens you use.