OpenCode¶
OpenCode is configured through a JSON config file that declares custom model providers. Point it at Mango Inference's Anthropic-compatible endpoint by adding a provider entry with the Mango Inference base URL and API key.
Prerequisites¶
- A Mango Inference API key.
- OpenCode installed.
1. Add a Mango Inference provider¶
Add a provider entry to your OpenCode config (opencode.json, project-local
or global):
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"mangoinference": {
"name": "Mango Inference",
"npm": "@ai-sdk/anthropic",
"options": {
"baseURL": "https://api.mangoboost.io/v1",
"apiKey": "<your-api-key>"
},
"models": {
"zai-org/GLM-5.3": {}
}
}
}
}
The @ai-sdk/anthropic provider sends the API key in the x-api-key header,
matching how Mango Inference authenticates /v1/messages requests. See
Authentication.
The config schema is OpenCode's, and it moves
Provider config keys, config file locations, and the syntax for reading the key from an environment variable are defined by OpenCode and change between releases. Check opencode.ai for the shape your version expects. Only three values are Mango Inference's: the base URL, the API key, and the model ID. If the surrounding structure differs in your version, keep those three and adjust the rest.
2. Select the model¶
opencode --model mangoinference/zai-org/GLM-5.3
The provider/model form is the general pattern; as with the config schema,
the exact flag is OpenCode's to define. If the flag has moved in your version,
selecting the model from within OpenCode's own model picker does the same job.