An OpenCode plugin that registers Claude Code (Agent SDK) as a provider, allowing users to use their existing claude login subscription without API keys.
- No API Key Required: Uses your existing Claude Code CLI authentication (
claude login) - Flat-Rate Pricing: Costs are zeroed out since you're using your subscription
- Three Models Available:
claude-code/sonnet- Fast and capableclaude-code/opus- Most powerfulclaude-code/haiku- Fastest, most cost-effective
- Built-in Tool: Includes
claude-code-querytool for explicit Agent SDK calls
-
You must have Claude Code CLI installed and authenticated:
npm install -g @anthropic-ai/claude-code claude login
-
OpenCode must be installed (the plugin will be loaded by OpenCode)
# Clone the repository
git clone <repository-url>
cd opencode-claude-code-provider
# Install dependencies
bun install
# Build the plugin
bun run build
# Symlink to OpenCode plugins directory
ln -s $(pwd) ~/.config/opencode/plugins/opencode-claude-code-provider# Build the plugin
bun run build
# Copy to OpenCode plugins directory
cp -r dist ~/.config/opencode/plugins/opencode-claude-code-providerOnce installed, OpenCode will automatically detect the plugin. You can select Claude Code models in your OpenCode configuration:
{
"model": "claude-code/sonnet"
}Or use the explicit query tool:
{
"tool": "claude-code-query",
"args": {
"model": "opus",
"prompt": "Your prompt here"
}
}This plugin uses:
ai-sdk-provider-claude-code- Wraps the Claude Agent SDK for Vercel AI SDK compatibility@anthropic-ai/claude-agent-sdk- The official Claude Code SDK
The plugin registers claude-code as a provider and zeros out cost tracking since you're using your flat-rate Claude Code subscription rather than per-token API pricing.
# Install dependencies
bun install
# Build
bun run build
# Watch mode for development
bun run devMIT