tool_use / tool_result flows, reduces unnecessary premium request consumption, and enables Claude-native beta features like interleaved-thinking and advanced-tool-use that are unavailable through the plain Chat Completions path.
When to use this integration
Use this integration instead of OpenCode’s built-in Copilot provider when you want:- Anthropic Messages semantics — requests stay in the native Messages API format rather than being translated to Chat Completions
- Premium request optimizations — warmup and tool-continuation traffic is routed to a small model to avoid spending premium quota
- Claude-native beta features —
interleaved-thinking,advanced-tool-use, andcontext-managementbetas that require the Messages API path - Phase-aware
gpt-5.4commentary — the model emits a short user-facing update before tool calls so long-running actions are easier to follow
Start the proxy
Start Copilot API using the OpenCode OAuth app. This approach uses the same OAuth credentials as OpenCode’s built-in Copilot provider, which means there is no additional Terms of Service risk:Configure OpenCode
Add the following provider configuration to~/.config/opencode/opencode.json. This tells OpenCode to use the @ai-sdk/anthropic npm package as the AI SDK provider, pointing it at the local proxy:
Key configuration fields
| Field | Value | Why it matters |
|---|---|---|
npm | "@ai-sdk/anthropic" | Tells OpenCode to use the Anthropic SDK — requests use Anthropic Messages semantics instead of OpenAI Chat Completions |
options.baseURL | "http://localhost:4141/v1" | Points the Anthropic SDK at the local proxy; the SDK appends /messages, /models, and /messages/count_tokens automatically |
options.apiKey | "dummy" | The Anthropic SDK requires a non-empty key; any placeholder works unless you configure auth.apiKeys in the proxy |
model / agent.build.model / agent.plan.model | "local/gpt-5.4" | Routes build and plan work to the full-capability model |
small_model / agent.explore.model | "local/gpt-5-mini" | Routes exploration and background work to a cheaper fast model to preserve premium quota |
If you configure
auth.apiKeys in config.json, replace "dummy" with one of your configured keys. Otherwise any non-empty placeholder is fine.AGENTS.md recommended content
Add the following reminders to yourAGENTS.md file. They instruct the model to use the question tool for user interactions rather than outputting free-form questions: