OpenCode download & setup
OpenCode supports custom model providers. This guide uses the officially documented configuration-file method for Xuo, without third-party installers or presets.
1. Official download
Open the official OpenCode download page →
Choose your operating system under OpenCode Desktop. The page also lists terminal and editor integrations; choose Desktop for this guide.
2. Prepare a key and model
Create a Xuo API key, check wallet or subscription credit, and choose a model available to your group in Model Square. This example uses Chat Completions.
| Setting | Value |
|---|---|
| Provider ID | xuo |
| Display name | Xuo |
| Base URL | https://api.xuo.cc/v1 |
| API Key | Your full Xuo API key |
| Model ID | An available model supporting Chat Completions and tool calling |
3. Configure a custom provider
Use your personal global configuration file ~/.config/opencode/opencode.json. ~ means your user directory; on Windows this usually corresponds to %USERPROFILE%\.config\opencode\opencode.json.
Create the file if it does not exist. Otherwise merge provider.xuo into it, preserving other providers and settings. Do not put a configuration containing a real key into a public project repository.
Replace the key placeholder with your key. Replace both occurrences of YOUR_AVAILABLE_MODEL_ID with the same actual model ID:
{
"$schema": "https://opencode.ai/config.json",
"model": "xuo/YOUR_AVAILABLE_MODEL_ID",
"provider": {
"xuo": {
"npm": "@ai-sdk/openai-compatible",
"name": "Xuo",
"options": {
"baseURL": "https://api.xuo.cc/v1",
"apiKey": "YOUR_XUO_API_KEY"
},
"models": {
"YOUR_AVAILABLE_MODEL_ID": {
"name": "Xuo model"
}
}
}
}
}Alternatively use the officially supported environment syntax: "apiKey": "{env:XUO_API_KEY}". The OpenCode process must receive that variable. Setting it only in a terminal does not necessarily pass it to a desktop app launched from the Start menu.
4. Open a project and select the model
Save the file, reopen OpenCode Desktop, open your project and select the Xuo provider and configured model in the model picker. In the terminal version, use /models to list models.
Send a short test message and check the model, actual group and cost in Xuo Usage Logs. Live calls cannot be tested through the production domain until the server is deployed.
Missing models or failed requests
- Check JSON syntax, file location and the spelling of
providerandmodel. - Use
xuoconsistently for the provider ID and the same model ID in both places. - A project-local
opencode.jsoncan override conflicting global settings; check for conflicts. - For 401, check the key. For 404, check the address, model and endpoint. For 429, read rate-limit details and avoid rapid retries.
@ai-sdk/openai-compatibleuses Chat Completions. For a Responses-only model, the official guide specifies@ai-sdk/openai; verify model and channel support. Changing the address alone does not switch protocols.
Do not assign a one-million-token context to every model. Context and output limits depend on the actual model, channel and platform support.
Official references
Custom providers · Configuration locations and variables · Xuo troubleshooting
