OpenCode
OpenCode's built-in anthropic provider is native Anthropic via @ai-sdk/anthropic. Pointing it at Inert is a provider override, with no proxy or translation layer involved.
Config
Override the built-in anthropic provider in opencode.json, either in the project root or ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"anthropic": {
"options": {
"baseURL": "https://api.inert.lol/v1",
"apiKey": "{env:INERT_API_KEY}"
},
"models": {
"fable-5": {},
"opus-5": {}
}
}
}
}baseURL must include /v1 (it appends /messages itself), the opposite of Claude Code's bare host. Using the bare host here 404s.Model selection
Select a model with anthropic/<model-id> syntax, for example anthropic/fable-5. The models block above is what makes that id resolvable: OpenCode validates model ids against its bundled models.dev catalog before it sends any request, and entries in models extend that catalog. GET /v1/models lists every id the gateway serves, but OpenCode never reads it. Add any other id you want to use to the models block.
claude-haiku-4-5, regardless of the model you selected. It bills like any other small request.Troubleshooting
A generic UnknownError from opencode run before any network traffic usually means the model id is missing from the models block. Rerun with --print-logs to see the real ProviderModelNotFoundError.
Next steps
- Kilo CodeAnother native Anthropic custom-provider setup.