Repository navigation
feat: support claude-haiku-4-5-20251001 on vertex - #2393
Conversation
WalkthroughThis PR registers a new Claude model variant ("claude-haiku-4-5-20251001") in the Vertex adaptor mapping and adds its default cost ratio plus extended hardcoded Claude haiku matching logic in model ratio configuration. Changes
Sequence Diagram(s)(omitted — changes are small mappings/config and do not introduce a multi-component control flow requiring a sequence diagram) Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
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 |
|
dup with #2375 |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
relay/channel/vertex/adaptor.go(1 hunks)setting/ratio_setting/model_ratio.go(2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: neotf
Repo: QuantumNous/new-api PR: 1511
File: setting/ratio_setting/model_ratio.go:118-123
Timestamp: 2025-08-05T17:14:17.246Z
Learning: Claude models handle "-thinking" variants differently from Gemini models. For Claude models, only the base model (without "-thinking") gets an entry in defaultModelRatio map. The "-thinking" variants rely on the Claude relay handler stripping the suffix using strings.TrimSuffix(textRequest.Model, "-thinking") before looking up the ratio, so they automatically use the base model's ratio.
📚 Learning: 2025-08-05T17:14:17.246Z
Learnt from: neotf
Repo: QuantumNous/new-api PR: 1511
File: setting/ratio_setting/model_ratio.go:118-123
Timestamp: 2025-08-05T17:14:17.246Z
Learning: Claude models handle "-thinking" variants differently from Gemini models. For Claude models, only the base model (without "-thinking") gets an entry in defaultModelRatio map. The "-thinking" variants rely on the Claude relay handler stripping the suffix using strings.TrimSuffix(textRequest.Model, "-thinking") before looking up the ratio, so they automatically use the base model's ratio.
Applied to files:
setting/ratio_setting/model_ratio.gorelay/channel/vertex/adaptor.go
🔇 Additional comments (2)
relay/channel/vertex/adaptor.go (1)
42-42: LGTM!The model mapping follows the established pattern for Vertex API model name transformation, consistent with other Claude 4.5 variants like
claude-sonnet-4-5andclaude-opus-4-5.setting/ratio_setting/model_ratio.go (1)
562-568: LGTM!Adding
claude-haiku-4to the completion ratio logic ensures consistency across all Claude 4.x model variants. The completion ratio of 5 aligns with other Claude models in this block.
| "claude-3-7-sonnet-20250219-thinking": 1.5, | ||
| "claude-sonnet-4-20250514": 1.5, | ||
| "claude-sonnet-4-5-20250929": 1.5, | ||
| "claude-haiku-4-5-20251001": 0.5, |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
Anthropic Claude Haiku 4.5 model pricing per token 2024 2025
💡 Result:
Short answer:
-
2025 (Claude / Anthropic — Haiku 4.5): $1 per million input tokens and $5 per million output tokens — i.e. $0.000001 per input token and $0.000005 per output token. [1][2]
-
2024 (prior Haiku baseline — Haiku 3.5 / earlier pricing for comparison): ~ $0.80 per million input and $4 per million output — i.e. $0.0000008 per input token and $0.000004 per output token. [3]
Sources: Anthropic/Claude model & pricing docs. [1] [2] [3]
🌐 Web query:
Anthropic Claude 3.5 Sonnet pricing per token input output 2025
💡 Result:
Claude 3.5 Sonnet (2025) — price per million tokens: input $3 / MTok, output $15 / MTok. That equals $0.000003 per input token and $0.000015 per output token. [1][2]
Sources:
[1] Anthropic announcement — Claude 3.5 Sonnet (model & pricing).
[2] Anthropic model/pricing docs (per-MTok table).
Correct the ratio to approximately 0.33 instead of 0.5 for accurate pricing.
The Claude Haiku 4.5 model pricing is $1 per million input tokens and $5 per million output tokens ($0.000001 and $0.000005 per token), while Claude 3.5 Sonnet is $3 per million input and $15 per million output ($0.000003 and $0.000015 per token). This gives a ratio of approximately 0.33 (1/3), not 0.5. The current assignment of 0.5 overstates Haiku's cost relative to Sonnet. Update line 147 to use the correct ratio.
🤖 Prompt for AI Agents
In setting/ratio_setting/model_ratio.go around line 147, the ratio for
"claude-haiku-4-5-20251001" is incorrectly set to 0.5; update that entry to
reflect the correct cost ratio versus Claude 3.5 Sonnet (approximately 1/3).
Replace the 0.5 value with ~0.333333 (or 0.33) so the mapping accurately
reflects Haiku's pricing relative to Sonnet.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.