Start typing to search the documentation.

Docs navigation

Claude Agent

Use your Claude plan or another Claude Code login. Claude Agent runs Claude Code on your machine, so install Claude Code 2.1.248 or later and sign in first.

claude auth login

Then connect Claude Agent and choose a model. The model list comes from Claude Code. Effort levels are variants, such as claude-agent/opus#high.

/connect
# Select Claude Agent.
/models

You can also connect from the CLI with auth login claude-agent.

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

How it works

Claude Code calls the model, and OpenCode does everything else.

  • Claude gets Claude Code’s system prompt, plus your agent’s prompt, AGENTS.md files, skills, and MCP instructions.
  • Claude uses OpenCode’s tools and permissions instead of Claude Code’s built-in tools.
  • Your Claude Code settings, CLAUDE.md files, hooks, MCP servers, skills, and memory are not loaded.
  • OpenCode runs compaction and subagents.
  • You can switch between Claude Agent and other models in the same session.

Cost

Cost depends on how Claude Code is signed in.

LoginCost shown
Claude subscriptionNone, your plan covers it
Anthropic API key, or Claude Platform on AWS or Google CloudAnthropic prices
Amazon BedrockBedrock prices, or Anthropic prices on Bedrock Mantle
Google VertexVertex prices
Microsoft FoundryAzure prices
Custom base URLNone

Configure

Connection settings on the claude-agent provider are passed to Claude Code. They override the same variables set in your shell.

opencode.jsonc
{
  "$schema": "https://opencode.ai/config.json",
  "providers": {
    "claude-agent": {
      "settings": {
        "baseURL": "https://llm-proxy.example.com/anthropic",
      },
      "headers": {
        "X-Gateway-Tenant": "engineering",
      },
    },
  },
}
ConfigClaude Code variable
settings.baseURLANTHROPIC_BASE_URL
settings.apiKeyANTHROPIC_API_KEY
settings.authTokenANTHROPIC_AUTH_TOKEN
settings.headerTimeoutAPI_TIMEOUT_MS
settings.chunkTimeoutCLAUDE_STREAM_IDLE_TIMEOUT_MS
headersANTHROPIC_CUSTOM_HEADERS
bodyCLAUDE_CODE_EXTRA_BODY

Set them on a model to override the provider’s values for that model.

Limitations

  • Claude Code must be installed on the same machine as the OpenCode server. Claude Agent is not available in remote workspaces.
  • Claude Code’s system prompt replaces OpenCode’s built-in prompt. Custom agent prompts still apply.
  • Temperature, top-p, top-k, seed, and stop sequences are not supported.
  • Plugin http.request and http.response hooks do not run, because Claude Code makes the API calls.
  • Claude Code features such as /usage, /loop, auto mode, and agent teams are not available.

Errors

Error or symptomCheck
Claude Code is not installedInstall Claude Code, or set OPENCODE_CLAUDE_PATH to its path.
Claude Code is not logged inRun claude auth login, then connect Claude Agent again.
Claude Code ... is too oldRun claude update.