Skip to content

Auto-select Anthropic provider for Anthropic models #116

@neuromechanist

Description

@neuromechanist

Problem

When using Anthropic models through OpenRouter, the default provider routing may not route to Anthropic's infrastructure, resulting in suboptimal performance.

Solution

Automatically override the provider parameter to use "Anthropic" when the model starts with "anthropic/", ensuring Anthropic models always route to Anthropic's infrastructure for best performance.

Implementation

  • Detect Anthropic models by prefix (anthropic/*)
  • Override provider parameter regardless of config defaults
  • Add debug logging when auto-selection occurs
  • Update docstring to document this behavior

Benefits

  • Better performance for Anthropic models
  • Transparent to users (happens automatically)
  • Still respects explicit provider choice for non-Anthropic models

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Priority 2: Important, fix when possibleenhancementNew feature or request

    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