Repository navigation
feat: add claude-haiku-4-5-20251001 model support - #2375
Conversation
- Add model to Claude ModelList - Add model ratio (0.5, $1/1M input tokens) - Add completion ratio support (5x, $5/1M output tokens) - Add cache read ratio (0.1, $0.10/1M tokens) - Add cache write ratio (1.25, $1.25/1M tokens) Model specs: - Context window: 200K tokens - Max output: 64K tokens - Release date: October 1, 2025
WalkthroughThis PR adds support for the "claude-haiku-4-5-20251001" model variant across the system's model registry and pricing configuration by adding entries to model lists, cache ratio maps, and model cost ratio maps, along with minor logic extension for Claude-4 model recognition. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 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)
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
relay/channel/claude/constants.go(1 hunks)setting/ratio_setting/cache_ratio.go(2 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/claude/constants.go
🔇 Additional comments (4)
setting/ratio_setting/model_ratio.go (2)
564-564: LGTM! Completion ratio logic correctly extended.The pattern
"claude-haiku-4"will correctly match"claude-haiku-4-5-20251001", and the 5x completion ratio aligns with the stated output pricing of $5 per 1M tokens. This approach is consistent with how other Claude 4 model families are handled.
140-140: Model ratio value requires clarification on pricing tier.The official Anthropic pricing shows claude-haiku-4-5-20251001 at $1.00 per 1M input tokens (standard) or $0.50 per 1M (batch, 50% discount). A ratio of 0.5 needs verification against the codebase's ratio calculation method and reference model to confirm whether this represents batch pricing or a proportional discount from a base model. The comment's statement that "0.5 correctly reflects $1 per 1M tokens" is mathematically inconsistent.
setting/ratio_setting/cache_ratio.go (2)
46-46: LGTM! Cache read ratio correctly configured.The cache read ratio of 0.1 aligns with the stated pricing of $0.10 per 1M tokens and is consistent with other Claude models.
68-68: LGTM! Cache write ratio correctly configured.The cache write ratio of 1.25 aligns with the stated pricing of $1.25 per 1M tokens and is consistent with other Claude models.
…haiku-4-5 feat: add claude-haiku-4-5-20251001 model support
…haiku-4-5 feat: add claude-haiku-4-5-20251001 model support
…haiku-4-5 feat: add claude-haiku-4-5-20251001 model support
Summary
claude-haiku-4-5-20251001model to Claude ModelListModel Specs (from Anthropic docs)
claude-haiku-4-5-20251001Test plan
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.