Hand this tutorial to your agent in one click

A key section of this article is locked, and an agent opening the link cannot see it either. Unlock it first, then copy the full text for your agent in one click.

Hook Your Claude Account Into OpenCode and Learn What Doesn't Carry Over

Intermediate tutorial: get Claude Code signed in with claude auth login, choose Claude Agent under /connect in OpenCode, learn which Claude Code settings stay behind, and have your AI agent move your rules into AGENTS.md. Includes 2 copy-ready prompts.

Machine translation. Read the original

What you'll get

OpenCode's Claude Agent is a model source built into OpenCode starting with v2.2.3. Once Claude Code is on your machine and signed in with claude auth login, you open /connect in OpenCode and choose Claude Agent. From there you can use Claude models through your own Claude account, with no separate API key. This guide walks through the connection, explains what changes once you're hooked up, and gives you two prompts to hand to your AI agent.

Set your expectations first: once connected, only the brain changes. The way you work stays the OpenCode way. Your Claude Code settings, CLAUDE.md file, skills, and MCP servers don't come along, and that's the main reason you'll need to move a few things over by hand.

The flow for using Claude Agent in OpenCode: install Claude Code, log in, connect it in /connect, pick a model, and keep working

The whole setup goes like this: install and log in to Claude Code, connect Claude Agent inside OpenCode, pick a Claude model, then work as you normally would. OpenCode still handles the tools and permissions.

How it works

OpenCode calls the claude program already installed on your computer, using Anthropic's official Claude Agent SDK. Three things to know:

  • It never touches your login. OpenCode doesn't read the sign-in that Claude Code saves. It only records that you chose this option. You sign in through claude itself, in the terminal.
  • Any Claude Code login works. If Claude Code itself runs with it (plan, key or cloud login), OpenCode can use it too.
  • It uses your quota. Requests go through your own Claude Code, so they count against that account's usage.

Step 1: Install Claude Code and log in

In your terminal, confirm that Claude Code is installed and up to date. You need 2.1.248 or newer. Then run:

claude auth login

Make sure you run claude auth login in the terminal, not /login inside Claude Code. OpenCode v2.2.4 fixed a prompt that pointed people to the wrong command.

Step 2: Connect Claude Agent in OpenCode

In OpenCode, open /connect (on desktop, go to Settings → Providers) and choose Claude Agent. Starting with v2.2.4, it sits near the top of the list, right after Anthropic. When you select it, you'll see setup instructions first instead of an immediate save:

OpenCode's Connect Claude Agent dialog: a copyable claude auth login command, plus Connect and Install Claude Code buttons

Click Connect, and OpenCode checks whether claude is usable:

  • If everything is fine, you move on to picking a model.
  • If Claude Code isn't installed, isn't signed in, or fails to start, the dialog tells you why. Fix the problem, then click Check again.

When Claude Code isn't installed, OpenCode stops in the dialog and explains what's missing

The screenshots above come from OpenCode's pull request #60603. If claude isn't in a standard location, set the OPENCODE_CLAUDE_PATH environment variable to point to it.

Step 3: Know what doesn't carry over

This is the step people most often skip, and it's where most problems start. To keep OpenCode feeling the same no matter which model you pick, Claude Agent turns off a lot of what Claude Code brings with it:

In Claude Code In OpenCode
Built-in tools (reading and writing files, running commands) Turned off. OpenCode's tools take over, and permission prompts go through OpenCode
Your ~/.claude settings, per-project .claude settings, and CLAUDE.md Not read. OpenCode reads AGENTS.md instead
Hooks, MCP servers, skills Not read. You have to set them up again in OpenCode
Auto-compacting sessions and auto-memory Turned off. OpenCode handles compaction itself
Plan mode Not used. OpenCode's Plan agent replaces it

One more difference: tools run one at a time, not in parallel. That keeps each result matched to the call that produced it. If you ask for a lot of files at once, it can feel slower than it does in Claude Code.

If you've built up a lot of rules and skills in Claude Code, have your AI agent move them to places OpenCode can read:

Sign in to unlock this key section

New accounts get 10 free credits, plus 1 more for each daily check-in. Spend 1 credit to unlock and it stays open for you.

The order matters. Listing everything first shows you how much there is to move. Moving the rules first and confirming the rest one by one makes mistakes easy to undo. And because the originals stay untouched, Claude Code keeps working exactly as before.

Step 4: Pick a model and get to work

Once you're connected, choose a Claude model from OpenCode's model list and use it like any other model. You can switch to a different provider mid-session. The history format is shared, so switching back and forth won't scramble anything.

To have your AI agent run a full check in one go, send this:

Check whether Claude Agent in OpenCode is ready to use:
1. Check whether claude is installed, whether the version is 2.1.248 or newer, and whether I'm signed in. Only run read-only commands, and don't sign in for me.
2. Check whether OpenCode is v2.2.3 or newer. If it's older, ask me before upgrading.
3. If everything looks good, tell me where to click in OpenCode to connect Claude Agent. If something's wrong, explain in plain language which step is stuck.

FAQ

Can OpenCode use my Claude subscription? Yes. Starting with v2.2.3, choosing Claude Agent uses your own Claude Code sign-in. Plans, keys and cloud logins are all fine.

Should I use OpenCode or Claude Code? If you like OpenCode's interface and want to switch between several model providers in one place, use OpenCode with Claude Agent. If you rely heavily on Claude Code's skills, hooks, and plugins, stick with Claude Code. Those don't run inside OpenCode, so it's the simpler choice.

Why isn't my CLAUDE.md working in OpenCode? That's by design. Claude Agent doesn't read any of Claude Code's settings files. Put your rules in AGENTS.md, which OpenCode reads.

What do I do if OpenCode shows "Needs sign-in"? Run claude auth login in your terminal to sign in again, then go back to OpenCode and click Check again. In the desktop app, you can also click Needs sign-in in Settings to reopen the setup flow.

Does OpenCode charge extra for Claude Agent? No. OpenCode doesn't add a fee. Usage counts against your Claude account, and the exact limits depend on your Claude plan.

Watch out

  • Check your versions: Claude Agent needs OpenCode v2.2.3 or newer. Guided setup needs v2.2.4 or newer. Claude Code needs 2.1.248 or newer.
  • Config doesn't move on its own: Don't assume your rules still apply after switching. Check AGENTS.md before you start.
  • Tools run one at a time: Reading a lot of files can be slower than in Claude Code.
  • Read the terms first: Before using a Claude subscription through a third-party interface, check Anthropic's rules on usage and on how the plan can be used. If you're not sure, use an API key.

New to OpenCode? Start with Get your AI agent to keep working until the goal is done.

References

Done with this one? Mark it to track your path.Sign in
Save it for laterSign in
Questions about this piece?Ask AI about this

Comments (0)

No comments yet. Start the conversation.

Sign in to join the discussion.Sign in