Skip to content

feat: support claude-haiku-4-5-20251001 on vertex - #2393

Merged
seefs001 merged 3 commits into
QuantumNous:mainfrom
prnake:fix-claude-haiku
Jan 3, 2026
Merged

seefs001 merged 3 commits into
QuantumNous:mainfrom
prnake:fix-claude-haiku

Conversation

@prnake

@prnake prnake commented Dec 8, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added support for Claude Haiku 4.5 (2025-10-01): the model is now available with a configured default ratio (0.5) and is integrated into existing Claude handling so it follows the same performance/pricing behavior as other Claude variants.
    • No public API or signature changes.

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

@coderabbitai

coderabbitai Bot commented Dec 8, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This 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

Cohort / File(s) Summary
Model Mapping
relay/channel/vertex/adaptor.go
Added mapping: "claude-haiku-4-5-20251001" → "claude-haiku-4-5@20251001" in claudeModelMap.
Model Ratio Configuration
setting/ratio_setting/model_ratio.go
Added "claude-haiku-4-5-20251001": 0.5 to defaultModelRatio; extended getHardcodedCompletionModelRatio to treat claude-haiku-4 names like other Claude haiku/sonnet/opus variants (returns 5).

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

  • seefs001

Poem

"I hopped through code with tiny feet,
A haiku model now complete,
Mapped and counted, tuned just right,
I nibble bugs away at night. 🐇✨"

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 'feat: support claude-haiku-4-5-20251001 on vertex' directly and specifically describes the main change: adding support for a new Claude model variant on the Vertex platform.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 681b37d and 2c2dfea.

📒 Files selected for processing (2)
  • relay/channel/vertex/adaptor.go
  • setting/ratio_setting/model_ratio.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • relay/channel/vertex/adaptor.go
  • setting/ratio_setting/model_ratio.go

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.

@prnake

prnake commented Dec 8, 2025

Copy link
Copy Markdown
Contributor Author

dup with #2375

@prnake prnake closed this Dec 8, 2025

@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 681b37d.

📒 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.go
  • relay/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-5 and claude-opus-4-5.

setting/ratio_setting/model_ratio.go (1)

562-568: LGTM!

Adding claude-haiku-4 to 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.

Comment thread setting/ratio_setting/model_ratio.go Outdated
"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,

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.

⚠️ Potential issue | 🔴 Critical

🧩 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.

@prnake prnake reopened this Dec 26, 2025
@seefs001
seefs001 merged commit 43c671b into QuantumNous:main Jan 3, 2026
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
salem-2007 added a commit to salem-2007/new-api that referenced this pull request Sep 10, 2026
junjundesk pushed a commit to junjundesk/new-api that referenced this pull request Oct 3, 2026
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