Use OpenCode with amazee.ai¶
OpenCode is an open-source terminal coding agent that supports multiple AI providers. Connect it to amazee.ai to use Claude and other models through your regional endpoint.
Prerequisites¶
- OpenCode installed (installation guide)
- An amazee.ai API key
Connect OpenCode to amazee.ai¶
Create or edit .opencode.json in your home directory or project root:
{
"provider": "openai",
"providers": {
"openai": {
"apiKey": "your-amazee-ai-api-key",
"baseURL": "https://llm.[your-region].amazee.ai/v1"
}
},
"model": "claude-sonnet-4-5"
}
Replace [your-region] with your region code (e.g. ch103, us103, de103).
Alternatively, use environment variables:
export OPENAI_API_KEY="your-amazee-ai-api-key"
export OPENAI_BASE_URL="https://llm.[your-region].amazee.ai/v1"
Start OpenCode¶
Switching models¶
Change the model field in .opencode.json to any model from Available Models.
Troubleshooting¶
- Auth errors
- Check that your API key is correct in
.opencode.jsonor the environment variable. - Model not found
- Use the exact model ID from Available Models.
- Config not loading
- OpenCode checks
$HOME/.opencode.json,$XDG_CONFIG_HOME/opencode/.opencode.json, and./.opencode.jsonin the current directory.