OpenCode
OpenCode routes Anthropic and OpenAI models through pluggable providers. Point the anthropic block at API-AI and you're done.
Configure
Config path: ~/.config/opencode/opencode.json (or opencode.jsonc). Create the file if it doesn’t exist.
json
{
"provider": {
"anthropic": {
"options": {
"baseURL": "https://api-ai.app",
"apiKey": "mdf-your-key"
},
"npm": "@ai-sdk/anthropic"
}
},
"$schema": "https://opencode.ai/config.json"
}The API key can be set inline (as above) or via the /connect command inside OpenCode — both paths write to the same config file.
Routing gpt-* models too
To use OpenAI-format models too, add a second provider block. Both live in the same file; OpenCode picks the block that matches the model id.
json
{
"provider": {
"anthropic": { "options": { "baseURL": "https://api-ai.app", "apiKey": "mdf-your-key" }, "npm": "@ai-sdk/anthropic" },
"openai": { "options": { "baseURL": "https://api-ai.app/v1", "apiKey": "mdf-your-key" }, "npm": "@ai-sdk/openai" }
}
}Default model
After saving, run
/model inside OpenCode to set a default — claude-sonnet-5-5 for Anthropic, gemini-3.6-flash for OpenAI.Last updated: October 2, 2026Found a bug? admin@minedom-france.fr