Skip to content

feat: add claude-haiku-4-5-20251001 model support - #2375

Merged
seefs001 merged 1 commit into
QuantumNous:mainfrom
FlowerRealm:feat/add-claude-haiku-4-5
Dec 8, 2025
Merged

seefs001 merged 1 commit into
QuantumNous:mainfrom
FlowerRealm:feat/add-claude-haiku-4-5

Conversation

@FlowerRealm

@FlowerRealm FlowerRealm commented Dec 5, 2025 •

Copy link
Copy Markdown
Contributor

Summary

  • Add claude-haiku-4-5-20251001 model to Claude ModelList
  • Add model pricing ratio (0.5, based on $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 (from Anthropic docs)

  • Model ID: claude-haiku-4-5-20251001
  • Context window: 200K tokens
  • Max output: 64K tokens
  • Input price: $1 / 1M tokens
  • Output price: $5 / 1M tokens
  • Cache read: $0.10 / 1M tokens
  • Cache write: $1.25 / 1M tokens

Test plan

  • Code compiles successfully
  • Model appears in Claude channel model list
  • Pricing ratios are correctly configured

Summary by CodeRabbit

  • New Features
    • Added support for the Claude Haiku 4.5 model with optimized pricing and intelligent caching configurations, enabling more cost-effective API operations and improved resource utilization across your applications.
    • Enhanced Claude 4 model recognition to improve pricing tier classification, ensuring accurate and consistent billing calculations for all Claude-based operations on the platform.

✏️ Tip: You can customize this high-level summary in your review settings.

- 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
@coderabbitai

coderabbitai Bot commented Dec 5, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This 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

Cohort / File(s) Summary
Claude Model Registry
relay/channel/claude/constants.go
Added new model entry "claude-haiku-4-5-20251001" to the exported ModelList slice
Cache Ratio Configuration
setting/ratio_setting/cache_ratio.go
Added "claude-haiku-4-5-20251001" entries to both defaultCacheRatio map (value: 0.1) and defaultCreateCacheRatio map (value: 1.25)
Model Ratio Configuration
setting/ratio_setting/model_ratio.go
Added "claude-haiku-4-5-20251001" entry to defaultModelRatio map (value: 0.5); extended completion model ratio logic to recognize "claude-haiku-4" pattern with ratio value 5

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Verify that the new model identifier is spelled consistently across all three files
  • Confirm that ratio values (0.1, 1.25, 0.5) align with pricing strategy for this model tier
  • Check that the "claude-haiku-4" pattern extension doesn't inadvertently affect existing models

Possibly related PRs

Suggested reviewers

  • seefs001

Poem

🐰 A whisker-twitching addition, swift and lean,
Claude's newest kin joins the roster scene—
Haiku-4-5 hops into cache and ratio,
Pricing tiers aligned, all set to go! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding support for a new Claude model. It is concise, clear, and directly reflects the primary objective of the pull request.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b9f6a5 and c3c119a.

📒 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.go
  • relay/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.

Comment thread relay/channel/claude/constants.go Resolved
@seefs001
seefs001 merged commit 5eae6a3 into QuantumNous:main Dec 8, 2025
@FlowerRealm
FlowerRealm deleted the feat/add-claude-haiku-4-5 branch December 9, 2025 12:06
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
…haiku-4-5

feat: add claude-haiku-4-5-20251001 model support
@coderabbitai coderabbitai Bot mentioned this pull request May 29, 2026
8 of 11 tasks
salem-2007 added a commit to salem-2007/new-api that referenced this pull request Sep 10, 2026
…haiku-4-5

feat: add claude-haiku-4-5-20251001 model support
junjundesk pushed a commit to junjundesk/new-api that referenced this pull request Oct 3, 2026
…haiku-4-5

feat: add claude-haiku-4-5-20251001 model support
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.

2 participants