Skip to content

feat: auto-select Anthropic provider for Anthropic models#117

Merged
neuromechanist merged 8 commits into
developfrom
feature/issue-116-anthropic-provider
Jan 27, 2026
Merged

feat: auto-select Anthropic provider for Anthropic models#117
neuromechanist merged 8 commits into
developfrom
feature/issue-116-anthropic-provider

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Jan 27, 2026

Copy link
Copy Markdown
Member

Summary

Automatically routes Anthropic models (anthropic/*) to Anthropic's infrastructure for optimal performance by overriding the provider parameter.

Changes

  • Auto-detect Anthropic models by prefix check
  • Override provider to 'Anthropic' regardless of config defaults
  • Add debug logging when auto-selection occurs
  • Update docstring to document this behavior
  • Add comprehensive unit tests (16 tests, all passing)

Why

When using Anthropic models through OpenRouter, routing through Anthropic's infrastructure provides better performance than using other providers' proxies.

Testing

  • Unit tests: 16 tests covering provider selection logic
    • Anthropic models auto-select Anthropic provider
    • Anthropic models override any specified provider
    • Non-Anthropic models use specified provider
    • General configuration (temperature, max_tokens, headers, etc.)
    • Caching wrapper integration
  • Coverage: 62% on modified file (provider selection logic fully covered)
  • All tests pass (16/16)

Closes #116

neuromechanist and others added 5 commits January 26, 2026 22:38
…fix-0.5.3

chore: strip dev suffix for stable release 0.5.3
Override provider parameter to use 'Anthropic' when model starts with
'anthropic/' for optimal performance. Adds debug logging and updates
docstring to document this behavior.

Closes #116
Add 16 unit tests covering:
- Anthropic models auto-selecting Anthropic provider
- Anthropic models overriding any specified provider
- Non-Anthropic models using specified provider
- General LLM configuration (temperature, max_tokens, etc.)
- Caching wrapper integration

All tests pass (16/16)
@neuromechanist

Copy link
Copy Markdown
Member Author

Code Review Summary

Ran comprehensive code review with pr-review-toolkit:code-reviewer.

Issues Identified

Important (addressed):

Missing unit tests for provider auto-selection logic - FIXED

  • Added 16 comprehensive unit tests in tests/test_core/test_litellm_llm.py
  • Tests cover all provider selection scenarios
  • All tests pass (16/16)
  • Coverage: 62% on modified file

Minor (addressed):

Docstring clarity - IMPROVED

  • Updated provider parameter description to be more explicit
  • Now clearly states that provider is "Ignored for Anthropic models"

Summary

All identified issues have been addressed. The provider auto-selection logic is now fully tested and documented.

Make docstring more explicit about provider parameter being completely
ignored for Anthropic models, addressing code review feedback.
Resolved conflicts in tests/test_core/test_litellm_llm.py by combining:
- Provider auto-selection tests (this branch)
- Comprehensive caching wrapper tests (develop)

Result: 33 tests total (30 passed, 1 skipped, 2 async failures pre-existing from develop)
@neuromechanist neuromechanist linked an issue Jan 27, 2026 that may be closed by this pull request
The merge incorrectly kept version 0.5.3 instead of 0.5.3.dev0.
Develop and feature branches should always have .dev suffix.
Version suffix stripping should only happen on main branch releases.
@neuromechanist neuromechanist merged commit f02c81c into develop Jan 27, 2026
5 checks passed
@neuromechanist neuromechanist deleted the feature/issue-116-anthropic-provider branch January 27, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-select Anthropic provider for Anthropic models

1 participant