Skip to content

About

Hardened fork of opencode-anthropic-auth: retry logic, model-aware beta handling, SSE-safe streaming, env-driven config

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Moved

This repository moved to https://github.com/sainzs/agent-workbench/tree/main/integrations/opencode-anthropic-auth-plus. History was preserved via subtree, and this repository is frozen at its last version. What lives in the monorepo is the hardened feat/modular-auth-hardening line of this plugin, not the older fork README on this branch.


OpenCode Anthropic Auth Plugin

An OpenCode plugin that provides Anthropic OAuth authentication, enabling Claude Pro/Max users to use their subscription directly with OpenCode.

Anthropic OAuth login flowing into an OpenCode run

This solves the ".opencode" -> ".Claude" issues too!

renaming.jpg

Usage

Add the plugin to your OpenCode configuration:

{
  "plugins": ["@ex-machina/opencode-anthropic-auth"]
}

Authentication Methods

The plugin provides three authentication options:

  • Claude Pro/Max - OAuth flow via claude.ai for Pro/Max subscribers. Uses your existing subscription at no additional API cost.
  • Create an API Key - OAuth flow via console.anthropic.com that creates an API key on your behalf.
  • Manually enter API Key - Standard API key entry for users who already have one.

How It Works

For Claude Pro/Max authentication, the plugin:

  1. Initiates a PKCE OAuth flow against Anthropic's authorization endpoint
  2. Exchanges the authorization code for access and refresh tokens
  3. Automatically refreshes expired tokens
  4. Injects the required OAuth headers and beta flags into API requests
  5. Zeros out model costs (since usage is covered by the subscription)

Development

Publishing

Bump the version and push to main -- CI will publish to npm automatically:

bun bump            # patch bump (0.0.13 -> 0.0.14)
bun bump minor      # minor bump (0.0.13 -> 0.1.0)
bun bump major      # major bump (0.0.13 -> 1.0.0)
bun bump -- --dry-run  # preview without changes

License

MIT

About

Hardened fork of opencode-anthropic-auth: retry logic, model-aware beta handling, SSE-safe streaming, env-driven config

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages