OpenCode
Point the open-source terminal coding agent at the gateway.
The example below uses OpenCode's
provider / npm configuration format. If your installation uses V2's providers / package format, follow the matching official provider reference, retaining the gateway endpoint and a key for the intended group.OpenCode supports custom providers through its config file. For Claude, use the native Anthropic package; its base URL must end in /v1.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"gateway": {
"npm": "@ai-sdk/anthropic",
"name": "API gateway",
"options": {
"baseURL": "https://aiprimetech.io/v1",
"apiKey": "{env:GATEWAY_API_KEY}"
},
"models": {
"claude-sonnet-5": {"name": "Claude Sonnet 5"},
"claude-opus-5-5": {"name": "Claude Opus 5.5"}
}
}
},
"model": "gateway/claude-sonnet-5"
}
Config lives at ~/.config/opencode/opencode.json or opencode.json in the project root. Restart OpenCode and select the provider.
OpenCode is under fast development and its config schema moves. If the block above is rejected, check the provider section of OpenCode's own docs — the values you need are always base URL
https://aiprimetech.io/v1, your key, and exact model ids.