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
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
Benefits