OpenCode
Set up automatically#
Run the Gradiated wizard:
npx -y @gradiated/wizard --agent opencode
The wizard adds the provider and current model list to your user configuration. It backs up the file before making changes. If you already have a default model from another provider, the wizard keeps it; otherwise it sets the Gradiated model you chose as the default.
Start OpenCode after the wizard finishes:
opencode
Run /models and choose Gradiated when you want to switch models.
Set up manually#
Use manual setup if you do not want the wizard to change your configuration.
Set your Gradiated API key in the shell that starts OpenCode:
export GRADIATED_API_KEY="grad_..."
Add Gradiated to opencode.json#
Add this provider to your project or user configuration. Keep the API key in the environment.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"gradiated": {
"npm": "@ai-sdk/openai-compatible",
"name": "Gradiated",
"options": {
"baseURL": "https://api.gradiated.com",
"apiKey": "{env:GRADIATED_API_KEY}"
},
"models": {
"YOUR_MODEL": {
"name": "Your model name"
}
}
}
}
}
Replace YOUR_MODEL with a chat model from models and pricing.
The adapter adds the Chat Completions path. Keep baseURL set to https://api.gradiated.com.
Select the model#
Start OpenCode and run:
/models
Choose the Gradiated provider and model.
Configure model limits#
Add the model context and output limits if you want OpenCode to enforce them:
{
"models": {
"YOUR_MODEL": {
"name": "Your model name",
"limit": {
"context": 128000,
"output": 4096
}
}
}
}
Copy the limits from models and pricing.
Troubleshooting#
- Check that
GRADIATED_API_KEYis set in the same shell that starts OpenCode. - Check that
baseURLishttps://api.gradiated.com. - Check that the model matches the catalog response.
- Check that the workspace has billing capacity.
- Run
opencode auth listif OpenCode reports a provider authentication error.
Uninstall#
Run the uninstall command:
npx -y @gradiated/wizard uninstall
Select OpenCode. The wizard removes the provider and stored credential, and it keeps a timestamped backup of the configuration file.
OpenCode's provider documentation covers custom provider settings and the /models command.