[FEATURE]: Local Claude Code CLI Provider
Feature hasn't been suggested before.
- [x] 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:
This issue might be related to existing feature requests and discussions:
- #9461: [FEATURE]: Claude-style Tool Search Tool Implementation in OpenCode - Discusses integrating Claude Code features into OpenCode
- #9628: [FEATURE]: enable responses API in openai compatible provider - Related to provider configuration flexibility
- #9499: [FEATURE]: Merged commands and skills, parity with claude-code - Discusses achieving parity with Claude Code features
- #9575: [FEATURE]: model fallback in specific agents - Related to model/provider configuration
Please review these issues to see if they address your specific use case or if this represents a distinct feature request for local Claude CLI integration.
This issue might be related to existing feature requests and discussions:
- [FEATURE]: Claude-style Tool Search Tool Implementation in OpenCode #9461: [FEATURE]: Claude-style Tool Search Tool Implementation in OpenCode - Discusses integrating Claude Code features into OpenCode
- [FEATURE]: enable responses API in openai compatible provider #9628: [FEATURE]: enable responses API in openai compatible provider - Related to provider configuration flexibility
- [FEATURE]: Merged commands and skills, parity with claude-code #9499: [FEATURE]: Merged commands and skills, parity with claude-code - Discusses achieving parity with Claude Code features
- [FEATURE]: model fallback in specific agents #9575: [FEATURE]: model fallback in specific agents - Related to model/provider configuration
Please review these issues to see if they address your specific use case or if this represents a distinct feature request for local Claude CLI integration.
None of these implement this feature
As mentioned by @rekram1-node in the PR https://github.com/anomalyco/opencode/pull/10097 I will close this issue and create a plugin for that.
Looks like a good solution, did you create a plugin?
Looks like a good solution, did you create a plugin?
Yes and no I did locally, but opencode doesnt provide way to introduce custom language model implementations via plugins. I think it will take a while, if at all this will be there in the future. So for now if you wanna use it you need to pull my branch from my fork and just run it locally.
Cool, will do. Thanks for doing this. Sorry they didnt take the PR
Cool, will do. Thanks for doing this. Sorry they didnt take the PR
Yeah no problem. Btw i just found out that anthropic walked back and the native 'opencode auth login' with max subscription works again. Probably still against TOS but atleast it works again natively
@dkraemerwork where did you hear that?
@dkraemerwork where did you hear that?
Well, I'm using it.
Any chance you can publicly release this? I am working on a huge GUI based opensource platform somewhat like opencode and this is my last big issue, bridging the Claude Code CLI. I am curious how you are doing it and if it is going well.
hi, based on the idea and the PR from @dkraemerwork, I created the plugin https://github.com/unixfox/opencode-claude-code-plugin
Amazing
Drive-by note for anyone landing here looking for a Claude Code CLI provider in opencode: there is a maintained plugin on npm that wires this up today, no fork of opencode required.
- Package: https://www.npmjs.com/package/@khalilgharbaoui/opencode-claude-code-plugin
- Repo: https://github.com/khalilgharbaoui/opencode-claude-code-plugin
It is a fork of @unixfox opencode-claude-code-plugin with a few regressions fixed and published under my scope since the original looked dormant. Drop it into the plugin array in your opencode.json and you are set — the README covers the quirks (selective tool proxying, MCP bridge discovery, plan mode, MultiEdit pass-through) so worth a quick skim before configuring.
cc @dkraemerwork @strudel333 in case it scratches the same itch.