Skip to main content
OpenCode already includes a built-in GitHub Copilot provider, so you do not need this integration for basic usage. Use it when you want OpenCode to communicate with Copilot using Anthropic Messages semantics end-to-end — which preserves native 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 featuresinterleaved-thinking, advanced-tool-use, and context-management betas that require the Messages API path
  • Phase-aware gpt-5.4 commentary — 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

If you configure auth.apiKeys in config.json, replace "dummy" with one of your configured keys. Otherwise any non-empty placeholder is fine.
Add the following reminders to your AGENTS.md file. They instruct the model to use the question tool for user interactions rather than outputting free-form questions:

Install the OpenCode plugin

Install the subagent marker plugin to enable session tracking and correct subagent classification. The plugin prepends a session marker to subagent chat messages and sets a session ID header, which lets the proxy preserve root session context and correctly classify subagent-originated traffic. See the Plugin Integrations guide for installation instructions.