Guide · Updated November 2026 · Last reviewed
Use your Claude plan inside OpenCode
You already pay for Claude, and you want OpenCode's tools and permission prompts. OpenCode's Claude Agent provider is the path for that. Claude Code, signed in on your machine, calls the model. OpenCode supplies the tools, the permissions, compaction, and subagents. This guide is the setup, what actually loads, what shows up as a cost, and the limits. The steps come from OpenCode's Claude Agent docs, checked on November 2, 2026, with install commands from Anthropic's Claude Code setup page the same day. It expands the Hotfix of the Day in issue #9.
1. At a glance
OpenCode added this provider in 2.2.3 on October 30, 2026. 2.2.4, later the same day, added a guided setup in the provider picker. The release notes say choosing Claude Agent there copies claude auth login, installs Claude Code, and verifies the connection before model selection. The steps below are the ones on the current docs page.
| Step | What you run | What the docs say it does |
|---|---|---|
| 1. Claude Code 2.1.248 or later | Install or update, then claude --version | OpenCode requires this version. An older copy raises Claude Code ... is too old. |
| 2. Sign in | claude auth login | This is the Claude Code login Claude Agent uses. |
| 3. Connect | /connect, then Claude Agent. Or, in OpenCode's CLI, auth login claude-agent | Connects the provider. The 2.2.4 release notes also describe a guided setup in the provider picker. |
| 4. Pick a model | /models | The model list comes from Claude Code. Effort levels are variants. The docs' example is claude-agent/opus#high. |
Anthropic's setup page gives these installers. Native installs update in the background. claude update applies an update now. Then sign in the way OpenCode documents:
# macOS, Linux, or WSL
curl -fsSL https://claude.ai/install.sh | bash
# Windows PowerShell
irm https://claude.ai/install.ps1 | iex
claude --version
claude auth login
Anthropic also documents a Windows CMD installer, plus Homebrew, WinGet, apt, dnf, and apk. Homebrew, WinGet, apt, dnf, and apk copies do not auto-update through Claude Code. Upgrade those with the package manager. For Homebrew that is brew upgrade claude-code or brew upgrade claude-code@latest. For WinGet it is winget upgrade Anthropic.ClaudeCode. The setup page has the apt, dnf, and apk commands.
Anthropic's setup page says you can also start claude and follow the browser prompts. If ANTHROPIC_API_KEY is set and you approve it when asked, Claude Code skips the login prompt and uses the key. That is a different bill. See what it costs.
OpenCode: Claude Agent · Claude Code setup · OpenCode 2.2.3 · OpenCode 2.2.4
OpenCode and Claude Code both ship often
Hotfix Daily flags the changes that matter, with the source. Free, weekdays, about 3 minutes.
Join free and get 13 ready-to-paste Starter Prompts for coding agents, vibe coding and game dev right away.
2. How it works
OpenCode's line for this provider: "Claude Code calls the model, and OpenCode does everything else."
| Piece | In a Claude Agent session |
|---|---|
| Who calls the model | Claude Code, on your machine |
| System prompt | Claude gets Claude Code's system prompt. It replaces OpenCode's built-in prompt. Your custom agent prompt still applies. |
| Project instructions | Claude gets your agent prompt, AGENTS.md files, skills, and MCP instructions |
| Tools, permissions, compaction, subagents | OpenCode's. Claude uses OpenCode's tools and permissions instead of Claude Code's built-in tools. OpenCode runs compaction and subagents. |
Claude Code settings, CLAUDE.md, hooks, MCP servers, skills, memory | Not loaded |
| Other models | You can switch between Claude Agent and other models in the same session |
Read the two "skills" rows as the docs split them. The loaded list sits next to your agent prompt and AGENTS.md. The unloaded list is "your Claude Code" settings, CLAUDE.md files, hooks, MCP servers, skills, and memory. A CLAUDE.md that Claude Code follows on its own stays out of this session. Put shared rules in AGENTS.md, which the same page says Claude receives.
Our take: if a rule matters, it belongs in AGENTS.md before you start the session. Finding out mid-task that the Claude Code copy of your rules never loaded is a bad time to learn it.
OpenCode: Claude Agent, How it works and Limitations
3. What it costs
Cost depends on how Claude Code is signed in. This is OpenCode's table, including the "Cost shown" wording. "None" means OpenCode displays no price for that login.
| Login | Cost shown |
|---|---|
| Claude subscription | None, your plan covers it |
| Anthropic API key, or Claude Platform on AWS or Google Cloud | Anthropic prices |
| Amazon Bedrock | Bedrock prices, or Anthropic prices on Bedrock Mantle |
| Google Vertex | Vertex prices |
| Microsoft Foundry | Azure prices |
| Custom base URL | None |
For a custom base URL, the docs stop at "None." They do not say the server behind that URL is free.
Anthropic's pricing page, checked the same day, says the Pro plan includes Claude Code, and Max and Ultra include everything in Pro. It also says Claude Code is included in all paid plans and shares that plan's usage limits with the rest of Claude, including chat on the web, desktop, and mobile. A subscription row in OpenCode still spends your plan's allowance. The OpenCode page does not name Pro, Max, or a dollar price. Anthropic says heavy coding sessions can switch to pay-as-you-go API credits through a Console account, which matches the API-key row above.
OpenCode: Claude Agent, Cost · Claude plans and pricing
4. Point OpenCode at the Claude Code you want
OpenCode finds claude on your PATH. To use another copy, set OPENCODE_CLAUDE_PATH on the server:
opencode service set env OPENCODE_CLAUDE_PATH /opt/claude/bin/claude
Connection settings on the claude-agent provider are passed through to Claude Code. They override the same variables set in your shell. OpenCode's example:
{
"$schema": "https://opencode.ai/config.json",
"providers": {
"claude-agent": {
"settings": {
"baseURL": "https://llm-proxy.example.com/anthropic"
},
"headers": {
"X-Gateway-Tenant": "engineering"
}
}
}
}
| OpenCode config | Claude Code variable |
|---|---|
settings.baseURL | ANTHROPIC_BASE_URL |
settings.apiKey | ANTHROPIC_API_KEY |
settings.authToken | ANTHROPIC_AUTH_TOKEN |
settings.headerTimeout | API_TIMEOUT_MS |
settings.chunkTimeout | CLAUDE_STREAM_IDLE_TIMEOUT_MS |
headers | ANTHROPIC_CUSTOM_HEADERS |
body | CLAUDE_CODE_EXTRA_BODY |
Set the same fields on a model to override the provider's values for that model. The sample baseURL above is OpenCode's placeholder, not a service you need.
OpenCode: Claude Agent, Configure
5. Limits from the docs
- Same machine. Claude Code has to be installed on the same machine as the OpenCode server. Claude Agent is not available in remote workspaces.
- Prompt. Claude Code's system prompt replaces OpenCode's built-in prompt. Custom agent prompts still apply.
- Sampling. Temperature, top-p, top-k, seed, and stop sequences are not supported.
- Plugin HTTP hooks. Plugin
http.requestandhttp.responsehooks do not run, because Claude Code makes the API calls. - Some Claude Code features.
/usage,/loop, auto mode, and agent teams are not available.
OpenCode: Claude Agent, Limitations
6. Errors the docs name
| Error or symptom | What OpenCode says to check |
|---|---|
Claude Code is not installed | Install Claude Code, or set OPENCODE_CLAUDE_PATH to its path. |
Claude Code is not logged in | Run claude auth login, then connect Claude Agent again. |
Claude Code ... is too old | Run claude update. OpenCode requires 2.1.248 or later. |
If Claude Code came from Homebrew, WinGet, apt, dnf, or apk, Anthropic says those installs do not auto-update through Claude Code. Upgrade with the package manager, then run claude --version. Homebrew is brew upgrade claude-code or brew upgrade claude-code@latest. WinGet is winget upgrade Anthropic.ClaudeCode. The setup page has the apt, dnf, and apk commands. You can also point OPENCODE_CLAUDE_PATH at a binary that is 2.1.248 or newer.
OpenCode: Claude Agent, Errors · Claude Code setup: updates
7. Permissions, and whose login is on the machine
Claude uses OpenCode's tools and permissions, not Claude Code's built-in tools. Keep OpenCode's permission rules on. OpenCode's permissions page says each rule has an action, a resource, and an effect of allow, deny, or ask. If no rule matches, OpenCode asks. The last matching rule wins. Their common setup asks before shell commands, allows routine git inspection, and blocks git push:
{
"$schema": "https://opencode.ai/config.json",
"permissions": [
{ "action": "shell", "resource": "*", "effect": "ask" },
{ "action": "shell", "resource": "git status *", "effect": "allow" },
{ "action": "shell", "resource": "git diff *", "effect": "allow" },
{ "action": "shell", "resource": "git push *", "effect": "deny" }
]
}
OpenCode's V2 docs use permissions, shell, and subagent. V1 used different names. A shell pattern ending in * also matches the command without arguments, so git status * matches both git status and git status --short.
The habits in How to run AI coding agents safely still apply: start in a project folder, keep approvals on, and keep secrets out of reach. That guide covers Claude Code, Cursor, Codex, Copilot, Cline, and Gemini CLI. It does not document OpenCode's permission file. Use it for the habits, and use OpenCode's permissions page for the rules.
Claude Agent spends whatever Claude Code login is on the OpenCode server, and Anthropic says that usage draws from the same pool as your chats. Keep a personal Claude login on a machine you control. A shared team server is a poor place for it, because anyone who can start a session there spends your plan. That is practical advice about whose account is signed in. This guide does not take it from Anthropic's terms.
OpenCode: Permissions · Claude Agent limitations · Claude pricing: shared usage
Checklist
claude --versionis 2.1.248 or later. If it is older, runclaude update, or upgrade the package-manager install.- You signed in with
claude auth login, or you meant to use an API key and you know that bills at Anthropic prices. - Claude Agent is connected, and
/modelsshows a model you picked. - Rules you care about are in
AGENTS.md. ACLAUDE.mdalone will not load. - OpenCode permission rules still ask before shell commands you want to approve yourself.
- The Claude login on that machine is one you are willing to spend. It is not a personal login on a shared team server.
FAQ
Can I use Claude Pro or Max inside OpenCode?
Yes, when Claude Code accepts that login. OpenCode shows no separate price for a Claude subscription and says your plan covers it. Anthropic's pricing page, checked November 2, 2026, says the Pro plan includes Claude Code, and Max and Ultra include everything in Pro. Claude Code is included in all paid plans and shares that plan's usage limits with the rest of Claude, including chat. OpenCode's Claude Agent page does not list plan names or dollar prices.
Does Claude Agent load my CLAUDE.md, hooks, and Claude Code MCP servers?
Those Claude Code files stay out of the session. OpenCode's docs say your Claude Code settings, CLAUDE.md files, hooks, MCP servers, skills, and memory are not loaded. Claude does get Claude Code's system prompt, plus your agent prompt, AGENTS.md files, skills, and MCP instructions. Put rules you want this session to follow in AGENTS.md.
Does a Claude subscription show a separate cost in OpenCode?
No separate price is shown. OpenCode's cost table says a Claude subscription is covered by your plan. An Anthropic API key, or Claude Platform on AWS or Google Cloud, is billed at Anthropic prices. Amazon Bedrock, Google Vertex, and Microsoft Foundry show those platforms' prices, and Bedrock Mantle shows Anthropic prices. A custom base URL shows no price in OpenCode. The docs do not say whether the server behind that URL bills you.
Can I use Claude Agent with a remote OpenCode workspace?
Claude Code has to be installed on the same machine as the OpenCode server. OpenCode's docs say Claude Agent is not available in remote workspaces. Keep a personal Claude login on a machine you control, because that login is the one the session spends against. That is practical advice about whose account is signed in. This guide does not take it from Anthropic's terms.
What do I do when OpenCode says Claude Code is missing, logged out, or too old?
Not installed: install Claude Code, or set OPENCODE_CLAUDE_PATH to the binary. Not logged in: run claude auth login, then connect Claude Agent again. Too old: run claude update. OpenCode requires Claude Code 2.1.248 or later. If you installed with Homebrew, WinGet, apt, dnf, or apk, Anthropic says those copies do not auto-update through Claude Code, so upgrade with the package manager.
Found this useful? Hotfix Daily covers practical agent setup every weekday. Get the updates free, plus 13 Starter Prompts. Or share it on X.
Related
These are other Hotfix Daily guides. They do not walk through OpenCode's Claude Agent setup.
- Which AI coding agent should you use? Pick by budget and use case
- How to run AI coding agents safely: folders, sandboxes, approvals and secrets
- What are the best AI coding agents? Compared (October 2026)
- How to review AI-written code: a checklist for agent PRs
- Issue #9: the Hotfix of the Day this guide expands
How we write these: we read OpenCode's Claude Agent and permissions docs, Anthropic's Claude Code setup and pricing pages, and the OpenCode 2.2.3 and 2.2.4 release notes on November 2, 2026, and we link the page for every step we name. "Our take" is our opinion. Commands change, so check the linked page before you rely on a detail. This guide has no affiliate links.
Get the next issue in your inbox
Five things worth your attention in AI, agents, vibe coding and game dev, every weekday. Plus 13 free Starter Prompts and the AI Builder Starter Stack PDF when you join.