Skip to content

feat: add claude-opus-4-5-20251101 - #2293

Merged
seefs001 merged 2 commits into
QuantumNous:mainfrom
prnake:claude-opus-4-5
Nov 25, 2025
Merged

feat: add claude-opus-4-5-20251101#2293
seefs001 merged 2 commits into
QuantumNous:mainfrom
prnake:claude-opus-4-5

Conversation

@prnake

@prnake prnake commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added support for Claude Opus 4-5 model variants, including a new thinking-capable version, now available across AWS, Vertex AI, and other supported cloud regions with optimized caching and pricing configurations.

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

@coderabbitai

coderabbitai Bot commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This PR introduces support for the Claude Opus 4.5 (20251101) model variant and its thinking variant across AWS, Claude, Vertex, and configuration modules. Changes include AWS model ID mappings, cross-region permissions, model lists, adaptor mappings, and pricing ratios.

Changes

Cohort / File(s) Summary
AWS Model Mappings
relay/channel/aws/constants.go
Adds Claude Opus 4.5 (20251101) to awsModelIDMap with corresponding target ID and extends cross-region support (US, AP, EU regions) for the new model variant.
Claude Channel Models
relay/channel/claude/constants.go
Extends ModelList with two new entries: "claude-opus-4-5-20251101" and "claude-opus-4-5-20251101-thinking".
Vertex Adaptor Mappings
relay/channel/vertex/adaptor.go
Adds mapping in claudeModelMap for "claude-opus-4-5-20251101" → "claude-opus-4-5@20251101".
Cache Ratio Configuration
setting/ratio_setting/cache_ratio.go
Adds both model variants to defaultCacheRatio and defaultCreateCacheRatio with values 0.1 and 1.25 respectively.
Model Ratio Configuration
setting/ratio_setting/model_ratio.go
Adds "claude-opus-4-5-20251101" to defaultModelRatio with value 2.5.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Homogeneous pattern: All changes follow the same model-addition pattern across configuration files
  • No logic changes: Only data additions to existing maps and slices
  • Potential attention areas:
    • Verify consistency of model variant naming across all five files
    • Confirm that both model variants (base and thinking) are added where applicable
    • Cross-check AWS region mapping with other model variants for consistency

Possibly related PRs

Suggested reviewers

  • seefs001

Poem

🐰 A Hop of New Models!
Opus four-point-five arrives with style,
Model ratios balanced, cross-regions compile,
Cache and config dance in harmony's file,
New thinking, new power—one model, one smile! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add claude-opus-4-5-20251101' accurately describes the main change: adding support for a new Claude model variant across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2f80e3f and 79682dc.

📒 Files selected for processing (5)
  • relay/channel/aws/constants.go (2 hunks)
  • relay/channel/claude/constants.go (1 hunks)
  • relay/channel/vertex/adaptor.go (1 hunks)
  • setting/ratio_setting/cache_ratio.go (2 hunks)
  • setting/ratio_setting/model_ratio.go (1 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
  • setting/ratio_setting/cache_ratio.go
  • relay/channel/vertex/adaptor.go
  • relay/channel/claude/constants.go
🔇 Additional comments (6)
relay/channel/vertex/adaptor.go (1)

42-42: LGTM!

The mapping entry for claude-opus-4-5-20251101 follows the established pattern and correctly maps to the Vertex AI format claude-opus-4-5@20251101.

setting/ratio_setting/cache_ratio.go (1)

58-59: LGTM!

The cache ratio entries for claude-opus-4-5-20251101 and its thinking variant are consistent with other Claude-4 models. Both base and thinking variants are appropriately included in defaultCacheRatio (0.1) and defaultCreateCacheRatio (1.25).

Also applies to: 79-80

relay/channel/claude/constants.go (1)

24-25: LGTM!

The addition of claude-opus-4-5-20251101 and its thinking variant to ModelList is consistent with the pattern established for other Claude-4 models.

relay/channel/aws/constants.go (2)

21-21: LGTM!

The model ID mapping follows the established AWS Bedrock format correctly.


80-84: Based on the verification through web searches, I have found relevant information about Claude Opus 4.5 being available in Amazon Bedrock via global cross region inference in multiple locations. The documentation shows that Opus 4.5 model IDs should use the format "global.anthropic.claude-opus-4-5-20251101-v1:0".

However, the code in relay/channel/aws/constants.go (lines 80-84) uses the model ID format "anthropic.claude-opus-4-5-20251101-v1:0" without the global. prefix, while configuring it with regional flags (us, ap, eu). This differs from the documented format shown in AWS examples.

Additionally, Claude Opus 4.1 was US-only (available in US West (Oregon), US East (N. Virginia), and US East (Ohio)), so the review comment's observation about broader cross-region availability for Opus 4.5 compared to previous versions is valid.

The review comment's core claim about broader regional availability is correct, but the model ID format requires verification against actual AWS Bedrock implementation to ensure it will work correctly across the intended regions.


Confirm the model ID format for Opus 4.5 in AWS Bedrock matches the code's implementation.

The configuration shows the model in US, AP, and EU regions (broader than Opus 4.1's US-only availability), but verify that the model ID format "anthropic.claude-opus-4-5-20251101-v1:0" (without global. prefix) is valid for your use case. AWS documentation examples show Opus 4.5 using "global.anthropic.claude-opus-4-5-20251101-v1:0" for cross-region inference. Ensure the code uses the correct model ID format for your implementation.

setting/ratio_setting/model_ratio.go (1)

146-146: ****

The pricing ratio of 2.5 for claude-opus-4-5-20251101 is accurate. Claude Opus 4.5 is priced at $5 per million input tokens and $25 per million output tokens — a dramatic reduction from the $15 and $75 rates for its predecessor, Claude Opus 4.1. This matches the code's ratio of 2.5 (which represents $5/1M input tokens when multiplied by the $0.002/1K base rate used in the codebase). Previous Claude 3 Opus pricing was $0.015 per 1,000 input tokens ($15/1M), which corresponds to the ratio of 7.5 used for earlier Opus models in the code. The price difference reflects an intentional strategy by Anthropic to make Opus-level capabilities more accessible.

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

@seefs001
seefs001 merged commit 31a652f into QuantumNous:main Nov 25, 2025
1 check passed
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 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