fix(routing): use fully qualified Anthropic model ID#592
Conversation
The default routing model "anthropic/claude-sonnet-4" is not a valid model identifier for the Anthropic API. This causes failures when using OAuth authentication (Claude Pro/Max subscription) since the API requires the fully qualified model ID with date suffix. Changes both the Default impl and defaults_for_provider to use "anthropic/claude-sonnet-4-20250514". Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe default Anthropic model for routing is updated from the unversioned ChangesAnthropic Model Version Bump
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/llm/routing.rs (1)
39-39: ⚡ Quick winCentralize the Anthropic default model ID in a constant.
This string is now duplicated in multiple default paths; extracting a single constant will prevent future drift when the dated model ID is bumped again.
♻️ Suggested refactor
+const DEFAULT_ANTHROPIC_MODEL: &str = "anthropic/claude-sonnet-4-20250514"; + impl Default for RoutingConfig { fn default() -> Self { - Self::for_model("anthropic/claude-sonnet-4-20250514".into()) + Self::for_model(DEFAULT_ANTHROPIC_MODEL.into()) } } @@ - "anthropic" => RoutingConfig::for_model("anthropic/claude-sonnet-4-20250514".into()), + "anthropic" => RoutingConfig::for_model(DEFAULT_ANTHROPIC_MODEL.into()),Also applies to: 167-167
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/llm/routing.rs` at line 39, Extract the Anthropic default model ID literal into a single constant (e.g. ANTHROPIC_DEFAULT_MODEL: &str = "anthropic/claude-sonnet-4-20250514") and replace all duplicated string occurrences (such as in the Self::for_model("anthropic/claude-sonnet-4-20250514".into()) call and the other occurrence around line 167) with ANTHROPIC_DEFAULT_MODEL (use .into() where needed). Add the const near the top of routing.rs (module scope) so functions like the referenced Self::for_model use the centralized constant.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/llm/routing.rs`:
- Line 39: Extract the Anthropic default model ID literal into a single constant
(e.g. ANTHROPIC_DEFAULT_MODEL: &str = "anthropic/claude-sonnet-4-20250514") and
replace all duplicated string occurrences (such as in the
Self::for_model("anthropic/claude-sonnet-4-20250514".into()) call and the other
occurrence around line 167) with ANTHROPIC_DEFAULT_MODEL (use .into() where
needed). Add the const near the top of routing.rs (module scope) so functions
like the referenced Self::for_model use the centralized constant.
Centralizes the Anthropic default model identifier to prevent future drift when the dated model ID is bumped. Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Summary
"anthropic/claude-sonnet-4"is not a valid model identifier"anthropic/claude-sonnet-4-20250514"Changes
src/llm/routing.rs: Update both default model references to use fully qualified IDTest plan
🤖 Generated with Claude Code
via Happy