Skip to content

Comments

feat: minimax native /v1/messages#2960

Open
seefs001 wants to merge 1 commit intoQuantumNous:mainfrom
seefs001:feature/minimax-native-claude
Open

feat: minimax native /v1/messages#2960
seefs001 wants to merge 1 commit intoQuantumNous:mainfrom
seefs001:feature/minimax-native-claude

Conversation

@seefs001
Copy link
Collaborator

@seefs001 seefs001 commented Feb 17, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for Claude as a relay format option with proper routing to Anthropic's endpoints.
  • Chores

    • Refactored request handling logic for improved format-based dispatch and maintainability.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2026

Walkthrough

The pull request adds Claude format support to the Minimax channel adaptor by introducing format-based dispatch logic. It delegates Claude-specific request and response handling to the claude adaptor while routing other formats to the openai adaptor, and adds a corresponding endpoint switch that directs Claude requests to the Anthropic messages endpoint.

Changes

Cohort / File(s) Summary
Claude Format Routing
relay/channel/minimax/adaptor.go
Adds claude adaptor import and implements format-based dispatch in DoResponse: Claude format routes to claude.Adaptor.DoResponse, non-Claude formats route to openai.Adaptor.DoResponse. Delegates ConvertClaudeRequest to claude.Adaptor.
Endpoint Selection
relay/channel/minimax/relay-minimax.go
Introduces outer switch on RelayFormat; Claude format returns Anthropic messages endpoint using ChannelBaseUrl, while other formats use nested switch on RelayMode for existing endpoints (ChatCompletions, AudioSpeech).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • QuantumNous/new-api#1832: Implements identical Claude support pattern—delegating ConvertClaudeRequest to claude.Adaptor and routing via RelayFormat.
  • QuantumNous/new-api#1833: Adds RelayFormat==Claude dispatch in DoResponse to route Claude requests to claude-specific handlers.
  • QuantumNous/new-api#2883: Modifies relay routing to treat RelayFormatClaude specially with format-based dispatch and endpoint selection.

Suggested reviewers

  • Calcium-Ion

Poem

🐰 A Minimax channel learns a new trick today,
Routing Claude requests the proper way,
Format-based dispatch, elegant and clean,
The finest Claude support you've ever seen! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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: minimax native /v1/messages' accurately reflects the main change: adding native Claude /v1/messages endpoint support to the minimax channel with format-based routing.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@relay/channel/minimax/relay-minimax.go`:
- Around line 17-19: The Claude-case return mistakenly uses info.ChannelBaseUrl
(bypassing the empty-string fallback) instead of the computed baseUrl; update
the switch branch in relay-minimax.go (the case for types.RelayFormatClaude) to
use the local variable baseUrl when formatting the URL so the default MiniMax
base URL is used when info.ChannelBaseUrl is empty.

Comment on lines +17 to +19
switch info.RelayFormat {
case types.RelayFormatClaude:
return fmt.Sprintf("%s/anthropic/v1/messages", info.ChannelBaseUrl), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Bug: Uses info.ChannelBaseUrl instead of baseUrl, bypassing the empty-string fallback.

Lines 13–16 compute baseUrl with a fallback to the default MiniMax base URL when info.ChannelBaseUrl is empty. However, line 19 uses info.ChannelBaseUrl directly, so when the channel has no custom base URL configured, this will produce a URL like /anthropic/v1/messages (empty host), causing the request to fail.

🐛 Proposed fix
 	switch info.RelayFormat {
 	case types.RelayFormatClaude:
-		return fmt.Sprintf("%s/anthropic/v1/messages", info.ChannelBaseUrl), nil
+		return fmt.Sprintf("%s/anthropic/v1/messages", baseUrl), nil
 	default:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
switch info.RelayFormat {
case types.RelayFormatClaude:
return fmt.Sprintf("%s/anthropic/v1/messages", info.ChannelBaseUrl), nil
switch info.RelayFormat {
case types.RelayFormatClaude:
return fmt.Sprintf("%s/anthropic/v1/messages", baseUrl), nil
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@relay/channel/minimax/relay-minimax.go` around lines 17 - 19, The Claude-case
return mistakenly uses info.ChannelBaseUrl (bypassing the empty-string fallback)
instead of the computed baseUrl; update the switch branch in relay-minimax.go
(the case for types.RelayFormatClaude) to use the local variable baseUrl when
formatting the URL so the default MiniMax base URL is used when
info.ChannelBaseUrl is empty.

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.

1 participant