ianjwhite99/opencode-with-claude

OpenCode plugin to use your Claude Max/Pro subscription with OpenCode via Meridian

opencode-with-claude – A plugin that bundles the Claude‑Max proxy for OpenCode

What it does

  • Provides an OpenCode plugin that automatically starts and stops the Meridian proxy (a local server that talks to Anthropic’s Claude Max via the Claude Agent SDK).
  • The proxy is launched when you start OpenCode and shut down when you quit, so you only have one process to manage.
  • Supports both OpenCode 1.x (the original CLI) and OpenCode 2 (@opencode/cli) from the same npm package.
  • Handles session‑tracking headers and lets multiple OpenCode windows run side‑by‑side, each getting its own free port if the default 3456 is taken.

How to use it

  1. Install globally with npm or Homebrew.
  2. Install the Claude Agent SDK (@anthropic-ai/claude-code) and log in once (claude auth login).
  3. Add the plugin name (or a file URL when using Homebrew) to your opencode.json (different key names for the two OpenCode generations).
  4. Run opencode; the plugin starts the proxy, rewrites the Anthropic provider’s baseURL to point at the local server, and forwards requests.

Key features

  • Lifecycle management – OpenCode owns the proxy, eliminating the need for a separate CLI or Docker container.
  • Multi‑instance support – each OpenCode process gets its own proxy port.
  • Profile handling – reads Meridian’s profiles.json and settings.json so you can switch between personal, work, or token‑based Claude accounts.
  • Runtime configuration – you can point the plugin at a newer Meridian build via the MERIDIAN_PATH env‑var without waiting for a new plugin release.
  • Session headers – the plugin adds explicit x‑meridian‑profile and other identity headers, keeping OpenCode’s hidden title/summary requests out of the session lease.

Installation & updates

  • npm: npm install -g opencode-with-claude and npm update -g opencode-with-claude.
  • Homebrew: brew install ianjwhite99/tap/opencode-with-claude and brew upgrade opencode-with-claude (the formula is auto‑bumped after each npm publish).

Troubleshooting tips

  • Ensure the Claude CLI is installed (npm install -g @anthropic-ai/claude-code).
  • Run claude auth login to create a valid session.
  • If the proxy won’t start, check authentication status, internet connectivity, and that the chosen port isn’t already in use.
  • You can expose the proxy beyond localhost by setting CLAUDE_PROXY_HOST (use with caution).

Development notes

  • Written in TypeScript; the src/ folder contains the plugin entry point, proxy lifecycle code, and helpers for reading Meridian config.
  • Unit tests live in test/unit/; a script test/run.sh launches OpenCode 1.x with the built plugin for manual testing.
  • The plugin exports a single object with id, server() (for OpenCode 1) and setup() (for OpenCode 2).

License – MIT.

Bottom line – If you use OpenCode and have a Claude Max subscription, this plugin gives you a seamless, single‑process way to route OpenCode’s Anthropic‑style requests through the official Claude Agent SDK, with profile management and easy updates.

Related

  • Project
  • Project
  • Project
  • Project
  • Project