Skip to content

OpenCode v2 support plans? #34

Closed

Description

@balaji-dutt

On AI assistance: Claude (Opus 5.5 / 1M context) helped me narrow down the behavior and draft the wording below, including the repro steps. The actual issue and workflow are mine. — @balaji-dutt

Is OpenCode v2 support on the roadmap? I'm asking now because v2 is starting to reach users through the main install paths:

  • The opencode.ai homepage and download page install v2 (opencode.ai/v2/install, @opencode/cli, anomalyco/tap/opencode-v2).
  • Homebrew core's opencode formula moved to v2 on 2026-09-28 (Homebrew/homebrew-core@480c4e864d), so brew upgrade opencode replaces 1.x with 2.x unless the formula is pinned.

v1 is still published (opencode-ai on npm, opencode.ai/install, anomalyco/tap/opencode), and the README lists "OpenCode v1.2+".

What breaks on v2

From the v2 migration guide and the plugin migration guide:

  • "V1 plugin implementations do not run in V2." The v2 loader (packages/core/src/plugin/module.ts at v2.0.22) only accepts a default export of { id, setup } or { id, effect }. The { id, server } export from Preserve MCP tools for Claude requests #19 fails with "Plugin must export a default definition with an id and an effect or setup function."
  • The bridge's core mechanism, auth.loader returning a custom fetch for the anthropic provider, has no v2 equivalent.

What v2 offers instead

From the guide's hook table and the v2.0.22 plugin types:

  • ctx.session.hook("http.request" | "http.response", ..., { providerID: "anthropic" }) passes a mutable web Request/Response (packages/plugin/src/promise/session.ts, wired in packages/core/src/session/model-request.ts). That looks like it could cover the header and body rewrite and the SSE handling.
  • ctx.integration OAuth method registration and credential resolution (packages/plugin/src/promise/integration.ts) for the auth.methods side.
  • ctx.session.hook("context", ...) in place of experimental.chat.system.transform.
  • The guide's dual-export shape (...Plugin.define({ id, setup }) plus server) lets one package serve v1 and v2.

So a port looks possible, but as a rewrite rather than a rename. Everything above comes from the v2 docs and the v2.0.22 source, not from running the bridge on v2. Open questions: whether http.request sees all Anthropic traffic (it fires for session model requests), and whether v2's built-in anthropic provider accepts the rewritten OAuth request.

Questions

  1. Do you plan to support v2? If so, as a dual v1/v2 package or as a separate major version?
  2. Until then, would you note in the README that the bridge requires OpenCode 1.x?

Activity

  1. added a commit that references this issue on Oct 22, 2026
  2. marc-EnergyEssentials commented on Nov 12, 2026

    @marc-EnergyEssentials

    the fork from @negz worked OK for me

  3. dotCipher commented on Nov 19, 2026

    @dotCipher
    Owner

    OpenCode v2 support is now live in v1.11.0 (merged via #37, initiated by @TomasRichtr and hardened/verified against OpenCode v2.3.2).

    What shipped

    • Single dual-export package (1.11.0): exports { id, setup, server } so OpenCode ≥ 2.0 loads setup() while OpenCode 1.18.29 – 1.x continues using server().
    • Seamless Claude CLI keychain sync: on a fresh OpenCode v2 setup with no Anthropic connection yet, valid claude login tokens are persisted automatically on startup so Anthropic models appear immediately without /connect. Existing ANTHROPIC_API_KEY env vars or stored API keys are never overridden.
    • Native v2 OAuth & hooks: registers the anthropic OAuth method (mode: "auto" + remote redirect-URL paste with CSRF state verification + persisted layered refresh) and provider-scoped http.request / http.response / system-prompt hooks.
    • Install / upgrade on OpenCode v2:
      opencode plugin add opencode-claude-bridge
      # or in ~/.config/opencode/opencode.json:
      # { "plugins": ["opencode-claude-bridge"] }
  4. added a commit that references this issue on Nov 19, 2026
    71daafa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions