Skip to content

[FEATURE]: Local Claude Code CLI Provider #9677

Description

@dkraemerwork

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

If this feature is desired I can create a pull request. Its already implemented

Describe the enhancement you want to request

Summary:

Add support for using Claude Code CLI as a backend provider in OpenCode, allowing users to leverage their local Claude CLI installation directly within OpenCode's interface.

Motivation

  • Users with Claude Code CLI installed can use it through OpenCode without needing separate API keys
  • Enables access to Claude's full agentic capabilities (tool use, file editing, bash execution) via OpenCode's UI
  • Provides a bridge for users who prefer OpenCode's interface but want to use their existing Claude CLI setup

Configuration

Provider should be configurable via OpenCode config with options for:

  • CLI path (cliPath)
  • Working directory (cwd)
  • Permission mode
  • Tool routing preferences (handleToolsInOpenCode)
    Dependencies
  • Requires Claude Code CLI installed locally (claude command available)

Requirements

  • Implement LanguageModelV2 provider that spawns and communicates with Claude CLI
  • Support JSON streaming protocol for real-time responses
  • Handle tool call routing between Claude CLI and OpenCode
  • Map tool names between Claude CLI (PascalCase) and OpenCode (lowercase)
  • Support permission handling modes (default, acceptEdits, bypassPermissions, plan)
  • Enable session persistence across messages
  • Support multimodal input (images, PDFs)
  • Handle AskUserQuestion tool for interactive prompts
  • Properly communicate tool errors back to Claude for recovery
  • Manage child processes efficiently (reuse, cleanup)

This is how it looks:

Image Image Image Image

Metadata

Metadata

Assignees

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussion

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions