Skip to content

Feature Request: Support Anthropic Advisor Strategy (advisor_20260301) #21789

@ChungHwemo

Description

@ChungHwemo

Summary

Anthropic released the Advisor Strategy on April 9, 2026 — a server-side tool (advisor_20260301) that enables a cost-efficient executor model (Sonnet/Haiku) to consult a high-capability advisor model (Opus) within a single /v1/messages API call. This dramatically improves quality while reducing cost.

OpenCode does not currently support this tool type. This issue requests adding advisor_20260301 to the provider tool handling pipeline.

What is the Advisor Strategy?

  • Tool type: advisor_20260301 (Anthropic server-side tool, like bash or text_editor)
  • How it works: The executor model (e.g., Sonnet 4.6) runs as usual. When it encounters a hard problem, it invokes the advisor tool. Anthropic's API transparently routes that call to Opus, returns guidance, and the executor continues — all within one API request.
  • Beta header: anthropic-beta: advisor-tool-2026-03-01

API Schema

{
  "tools": [
    {
      "type": "advisor_20260301",
      "name": "advisor",
      "model": "claude-opus-4-6",
      "max_uses": 3
    }
  ]
}

Supported Model Combinations

Executor Advisor
Claude Haiku 4.5 Claude Opus 4.6
Claude Sonnet 4.6 Claude Opus 4.6
Claude Opus 4.6 Claude Opus 4.6

Benchmarks (from Anthropic)

  • SWE-bench Verified: Sonnet 4.6 + Opus advisor = +2.7% accuracy, 11.9% cheaper than Opus alone
  • BrowseComp: Haiku 4.5 + Opus advisor = 19.7% → 41.2% (2x improvement)
  • Advisor overhead: Typically 400–700 text tokens per consultation

Current State in OpenCode

After analyzing the OpenCode binary (v1.3.17–v1.4.3), the Anthropic provider tool types are handled via a switch/case pattern in the compiled Go binary:

case "anthropic.code_execution_20260120": { ... }
case "anthropic.text_editor_20250124": { ... }
case "anthropic.text_editor_20250429": { ... }
case "anthropic.text_editor_20250728": { ... }
case "anthropic.bash_20250124": { ... }
case "anthropic.web_search_20260209": { ... }
case "anthropic.memory_20250818": { ... }
// ❌ No case for "anthropic.advisor_20260301"

The advisor_20260301 type is not present in any released version, nor in the current dev branch (verified via GitHub code search).

What Needs to Change

  1. Add advisor_20260301 to the provider tool switch/case in the Anthropic provider implementation (likely in pkg/provider/anthropic/ or equivalent)
  2. Support the beta header anthropic-beta: advisor-tool-2026-03-01 — the existing beta header plumbing (providers.anthropic.options.headers["anthropic-beta"]) may already handle this, but it needs to be verified
  3. Config support — allow users to configure the advisor tool in opencode.json, e.g.:
    {
      "provider": {
        "anthropic": {
          "models": {
            "sonnet": {
              "tools": {
                "advisor": {
                  "type": "advisor_20260301",
                  "model": "claude-opus-4-6",
                  "max_uses": 3
                }
              }
            }
          }
        }
      }
    }

Why This Matters

The advisor strategy is particularly valuable for OpenCode's use case:

  • Cost savings: Run Sonnet as the primary agent, consult Opus only when stuck → same quality, lower cost
  • Better architecture decisions: Executor handles routine code, advisor handles complex reasoning
  • Native API support: No prompt engineering needed — Anthropic handles the model routing server-side

References

Environment

  • opencode-ai: v1.3.17 (installed) / v1.4.3 (latest)
  • OS: macOS (arm64)

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions