[PR #7437] feat: add Claude Code CLI provider for subscription auth #12401

Closed
opened 2026-02-16 18:17:19 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/7437

State: closed
Merged: No


Summary

Adds a new provider that shells out to the Claude CLI binary for authentication, similar to how Goose by Block handles Claude Code subscription auth. This allows users with Claude Code subscriptions to use OpenCode without needing separate API keys.

Reference implementation: https://github.com/block/goose

  • New claude-code-cli provider that spawns the claude CLI binary
  • Uses --tools "" to disable Claude's built-in tools so OpenCode handles tool execution
  • Parses JSON output with --print --verbose for text and tool_use blocks
  • Auto-detects Claude CLI availability and registers provider if found
  • Supports sonnet, opus, and haiku models

Test plan

  • Verified Claude CLI is detected when installed
  • Tested doGenerate returns correct text response
  • Confirmed tool_use blocks are parsed from assistant messages
  • TypeScript compiles without errors
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/7437 **State:** closed **Merged:** No --- ## Summary Adds a new provider that shells out to the Claude CLI binary for authentication, similar to how Goose by Block handles Claude Code subscription auth. This allows users with Claude Code subscriptions to use OpenCode without needing separate API keys. Reference implementation: https://github.com/block/goose - New `claude-code-cli` provider that spawns the `claude` CLI binary - Uses `--tools ""` to disable Claude's built-in tools so OpenCode handles tool execution - Parses JSON output with `--print --verbose` for text and tool_use blocks - Auto-detects Claude CLI availability and registers provider if found - Supports sonnet, opus, and haiku models ## Test plan - [x] Verified Claude CLI is detected when installed - [x] Tested doGenerate returns correct text response - [x] Confirmed tool_use blocks are parsed from assistant messages - [x] TypeScript compiles without errors
yindo added the pull-request label 2026-02-16 18:17:19 -05:00
yindo closed this issue 2026-02-16 18:17:19 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12401