Skip to content

[DOCS] OpenCode integration guide — wrap, MCP, plugin, and manual setup #78

Description

@chopratejas

Summary

Write comprehensive documentation for using Headroom with OpenCode, covering all integration paths from simplest to most advanced.

Context

OpenCode integration has unique challenges compared to Claude Code or Codex:

  • ANTHROPIC_BASE_URL env var doesn't work reliably (Vercel AI SDK path construction differs)
  • Claude OAuth was removed from OpenCode in March 2026 (Anthropic legal action)
  • The reliable path is @ai-sdk/openai-compatible provider config
  • OpenCode supports MCP servers and NPM plugins for deeper integration

Users need clear guidance on which integration path to use and how to set it up.

Documentation structure

1. Quick start (30 seconds)

pip install headroom-ai[proxy]
headroom wrap opencode

What it does, what to expect, model naming (headroom/claude-sonnet-4-6).

2. Manual setup (without headroom wrap)

For users who want to understand what's happening or customize:

  • Start proxy manually: headroom proxy --port 8787
  • Add to opencode.json:
    {
      "provider": {
        "headroom": {
          "npm": "@ai-sdk/openai-compatible",
          "options": { "baseURL": "http://127.0.0.1:8787/v1" },
          "models": { ... }
        }
      }
    }
  • Explain why ANTHROPIC_BASE_URL doesn't work and why this approach is needed

3. MCP integration

  • How to add Headroom MCP tools to OpenCode
  • CCR workflow explanation with examples
  • Config for both remote (proxy) and local (stdio) MCP modes

4. Plugin installation

  • npm install headroom-opencode
  • What it provides (auto-proxy, tools, commands)
  • Configuration options

5. Troubleshooting

  • "Route not found" errors (Vercel AI SDK path issue)
  • Model not available (API key permissions)
  • Proxy not starting (port conflicts)
  • Claude models not working (Anthropic API key required, OAuth removed)

6. FAQ

  • "Can I use Claude Max/Pro subscription with OpenCode?" → No, Anthropic blocked OAuth. API keys only.
  • "Why do I need to use headroom/model-name instead of anthropic/model-name?" → Routing through proxy requires openai-compatible provider
  • "Does this work with OpenCode Zen/Go gateways?" → Yes, but compression is less useful since gateway pricing already includes infrastructure

Location

  • docs/integrations/opencode.md in the Headroom repo
  • Link from main README under "Integrations" section
  • Cookbook example in examples/opencode/

Depends on

Metadata

Metadata

Assignees

No one assigned

    Labels

    LowMinor bugs and issues that do not prevent usabilitydocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions