Registry /
llm-agents / opencode-claude-code-auth
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
configurePlugin
✓ import { configurePlugin } from 'opencode-claude-code-auth/cli';
While end-users typically interact via the `npx opencode-claude-code-auth configure` CLI, this is a hypothetical programmatic entry point for internal or advanced OpenCode-plugin development to trigger the configuration logic.
AnthropicAuthPlugin
✓ import { AnthropicAuthPlugin } from 'opencode-claude-code-auth';
This represents the main plugin class or entry point that OpenCode's plugin system would internally instantiate. Direct programmatic import by end-user applications is not the primary use case, as interaction is usually through OpenCode's configuration and CLI.
AnthropicProvider
✓ import type { AnthropicProvider } from 'opencode-claude-code-auth/types';
This is a type import for the internal Anthropic provider interface, useful for TypeScript developers who might be extending or understanding the plugin's internal workings within the OpenCode framework. Not for direct end-user consumption.
This quickstart demonstrates how to add the plugin to `opencode.json`, authenticate with Anthropic via the CLI, and then test model access.
{
"plugin": ["opencode-claude-code-auth"]
}
# Save the above JSON to your opencode.json file
# Then, in your terminal:
opencode auth login -p anthropic
# Follow the prompts to pick a login path (Claude Code session, browser sign-in, or API key).
# If OpenCode asks to configure Anthropic models, say yes.
# Verify your setup:
opencode run "Hello, Claude! What's new?" -m anthropic/claude-sonnet-4-5
Debug
Known issues
breakingOpenCode v1.3.x and newer versions removed built-in Anthropic authentication, making this plugin necessary to restore the functionality. Without it, direct Anthropic integration in OpenCode will fail.fixEnsure `opencode-claude-code-auth` is added to your `opencode.json` plugin array and you have completed the `opencode auth login -p anthropic` process.
affects: >=1.3.0 (for OpenCode), all versions (for this plugin)
gotchaThe package requires Node.js version 20 or higher. Running with older Node.js versions will result in execution errors.fixUpgrade your Node.js environment to version 20 or newer. Check your Node.js version with `node -v`.
affects: <0.1.0
gotchaWhen using the 'Claude Code session' login path, the plugin relies on the `claude` CLI being installed and configured to read credentials from the macOS Keychain (or `~/.claude/.credentials.json` on Linux/Windows). If the `claude` CLI is not present or its tokens are invalid, this authentication method will fail.fixInstall the Anthropic `claude` CLI and ensure you are logged in via `claude login`. Alternatively, use the 'Browser sign-in' or 'API key' methods.
affects: all
gotchaToken refresh mechanisms differ significantly between the 'Claude Code session' and 'Browser sign-in' paths. Developers should be aware of these differences, especially in automated environments where manual intervention for refreshes is undesirable.fixFor 'Claude Code session', ensure the `claude` CLI can be spawned. For 'Browser sign-in', ensure network access to Anthropic's OAuth endpoints for refresh token usage. API key is generally most straightforward for non-interactive use.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'opencode-claude-code-auth'
The `opencode-claude-code-auth` plugin was not correctly specified in `opencode.json` or OpenCode failed to install it automatically.
fixVerify that `"opencode-claude-code-auth"` is present in the `plugin` array within your `opencode.json` file. Ensure OpenCode has internet access to download npm packages.
Authentication Failed: Anthropic API returned a 401 or 403 error.
Your authentication tokens (session, OAuth, or API key) have expired, are invalid, or lack the necessary permissions.
fixRun `opencode auth login -p anthropic` again to re-authenticate and refresh your tokens. If using an API key, double-check its validity.
node: --enable-source-maps is not allowed in NODE_OPTIONS
This error typically indicates an incompatible Node.js version, especially when `NODE_OPTIONS` conflicts with internal module loading or features not present in older versions.
fixUpgrade your Node.js environment to version 20 or higher, as required by the package. Use `nvm install 20` or your preferred Node.js version manager.
Audit
Dependencies
No dependency data recorded yet.