Discover and explore top open-source AI tools and projects—updated daily.
griffinmartinSeamless Anthropic API authentication for OpenCode
New!
Top 55.7% on SourcePulse
This plugin provides seamless integration for OpenCode users by leveraging existing Claude Code credentials, eliminating the need for separate API keys or logins. It targets developers and power users of AI coding assistants who utilize both OpenCode and Anthropic's Claude models, offering a convenient way to manage authentication automatically. The primary benefit is a streamlined workflow, allowing users to access Claude models within OpenCode without manual setup or credential management.
How It Works
The plugin operates by registering a custom authentication provider within OpenCode. This provider intercepts all Anthropic API requests, extracts OAuth tokens from the macOS Keychain or a local credentials file (~/.claude/.credentials.json), and caches them in memory with a 30-second Time-To-Live (TTL). It handles the full request lifecycle, including injecting necessary headers like beta flags and user-agent strings, and translates tool names between OpenCode and the Anthropic API. When tokens approach expiry, it automatically triggers a refresh using the Claude CLI.
Quick Start & Requirements
npm install -g opencode-claude-auth. Then, add "opencode-claude-auth" to the plugin array in your opencode.json configuration. An alternative installation method involves fetching a script: Fetch https://raw.githubusercontent.com/griffinmartin/opencode-claude-auth/main/installation.md.claude at least once). OpenCode must also be installed.~/.claude/.credentials.json fallback mechanism.Highlighted Details
auth.json every 5 minutes as a fallback.experimental.chat.system.transform.Maintenance & Community
No specific details regarding maintainers, community channels (like Discord or Slack), or project roadmaps are provided in the README.
Licensing & Compatibility
The project is licensed under the MIT license, which generally permits commercial use and integration into closed-source projects. However, a disclaimer notes potential conflicts with Anthropic's Terms of Service regarding the use of Claude Pro/Max subscription tokens.
Limitations & Caveats
This plugin relies on community workaround methods for authentication, utilizing Claude Code's OAuth tokens. Anthropic's Terms of Service suggest these tokens should only be used with official Anthropic clients, meaning this plugin may cease to function if Anthropic modifies its OAuth infrastructure. Users should proceed with discretion, acknowledging the potential for breakage. Authentication requires Claude Code to be installed and functional first.
1 day ago
Inactive
onecli
cloudflare