Skip to content

OpenCode

OpenCode supports OpenAI-compatible providers via @ai-sdk/openai-compatible. Add a custom provider in opencode.json, then register your key with /connect.

{
"$schema": "https://opencode.ai/config.json",
"provider": {
"opengateway-oss": {
"npm": "@ai-sdk/openai-compatible",
"name": "OpenGateway OSS",
"options": {
"baseURL": "https://api.opengateway.one/oss/v1"
},
"models": {
"claude-turbo-hub-qwen3-coder": { "name": "Qwen3 Coder" },
"claude-turbo-hub-gpt-oss-120b": { "name": "GPT-OSS 120B" }
}
},
"opengateway-frontier": {
"npm": "@ai-sdk/openai-compatible",
"name": "OpenGateway Frontier",
"options": {
"baseURL": "https://api.opengateway.one/frontier/v1"
},
"models": {
"turbo-agent-model-claude-sonnet-4-6": { "name": "Claude Sonnet 4.6" }
}
}
},
"model": "opengateway-oss/claude-turbo-hub-qwen3-coder"
}

Inside OpenCode, run /connect, select the custom provider, paste your key, then run /models.

  • The npm adapter chooses the wire protocol: @ai-sdk/openai-compatible → Chat Completions; @ai-sdk/openai → Responses; @ai-sdk/anthropic → Messages.
  • Models are declared in config, so no live /v1/models call is required.
  • Per-model context and reasoning options map onto the AI SDK fields (limit.context, reasoning params).