Skip to content

Feature: use OpenCode only when Anthropic is unavailable #106

Description

@vinicius91carvalho

Problem

Claude Code currently routes every request through OpenCode when configured with routatic-proxy. Users with a Claude subscription need Anthropic to remain the primary service and OpenCode to take over only when Anthropic is unavailable or usage-limited.

Proposed behavior

  • Add an opt-in Anthropic-first mode for /v1/messages.
  • Preserve Claude Code OAuth and Anthropic capability headers.
  • Fall back on 408, 429, 5xx, and transport failures before response data is sent.
  • Use Retry-After-aware adaptive recovery with a single real-request probe and no synthetic API calls.
  • Keep invalid-request and authentication errors visible.
  • Skip remaining OpenCode Go models after a Go usage-limit response and continue with configured Zen fallbacks.

Acceptance criteria

Streaming and non-streaming requests, subscription exhaustion, recovery probing, context continuity, and current OpenCode Go/Zen fallback models are covered by automated and Claude Code end-to-end tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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