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
- A /model API key: create one on the API keys page and add credit on the credits page.
Set it up
- Put your key in the
SLASHMODEL_API_KEYenvironment variable. - Add the provider below to
~/.config/opencode/opencode.json, or toopencode.jsonin a project. - Run
opencode. It starts with the model set inmodel.
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,
slashmodelhere, is yours to choose. A model is thenslashmodel/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.