OpenCode
OpenCode reaches OpenAI-compatible APIs through the
@ai-sdk/openai-compatible package. Add TOKEN as a provider in
opencode.json (in your project, or in ~/.config/opencode/ for every
project):
{ "$schema": "https://opencode.ai/config.json", "provider": { "token": { "npm": "@ai-sdk/openai-compatible", "name": "TOKEN", "options": { "baseURL": "https://api.thetoken.dev/v1", "apiKey": "{env:TOKEN_API_KEY}" }, "models": { "moonshotai/kimi-k3": { "name": "Kimi K3" }, "zai-org/glm-5.3": { "name": "GLM-5.3" }, "zai-org/glm-5.3-flash": { "name": "GLM-5.3 Flash" }, "deepseek/deepseek-v4-pro": { "name": "DeepSeek V4 Pro" } } } }}options.apiKeyreads the key from theTOKEN_API_KEYenvironment variable. Instead, you can leaveapiKeyout, run/connectin OpenCode, choose Other, enter the provider IDtokenand paste the key; OpenCode then stores it in its own credentials file.- The keys under
modelsare TOKEN model IDs;nameis only the label OpenCode shows. Add any model from the models page that has tool calling. - Pick the model with
/modelsin OpenCode; it is listed astoken/<model ID>.
Choosing a model: OpenCode’s agent calls tools on most steps; use
moonshotai/kimi-k3, zai-org/glm-5.3 or deepseek/deepseek-v4-pro, and a
cheaper model such as zai-org/glm-5.3-flash for small tasks.