Skip to content

fix(relay): use mapped model for speech requests - #8527

Open
sanketpatel32 wants to merge 2 commits into
QuantumNous:mainfrom
sanketpatel32:devin/1796174263-minimax-audio-model-mapping
Open

sanketpatel32 wants to merge 2 commits into
QuantumNous:mainfrom
sanketpatel32:devin/1796174263-minimax-audio-model-mapping

Conversation

@sanketpatel32

@sanketpatel32 sanketpatel32 commented Dec 2, 2026 •

Copy link
Copy Markdown

Agent: Devin unknown · unknown · devin-box · 2026-12-02

Fixes #8500

Request summary

The user asked Devin to fix MiniMax /v1/audio/speech model mapping and scan other audio adaptors for the same mistake. The user asked for a focused regression test, Go validation, and a pull request only if the issue remained open and unclaimed. The user asked Devin to treat the missing audio parameter override as out of scope unless it had a one-line consistent fix. This code is AI-generated and AI-assisted.

Summary

MiniMax and Volcengine speech conversion now send the mapped upstream model name.

 relay.AudioHelper
   helper.ModelMappedHelper
     info.UpstreamModelName = mapped model
   adaptor.ConvertAudioRequest
-    TTSRequest.Model = info.OriginModelName
+    TTSRequest.Model = info.UpstreamModelName

OpenAI-compatible audio conversion already uses request.Model, which ModelMappedHelper updates. The scan of OriginModelName under relay/channel/ found no other implemented audio conversion path that sends the original name as the upstream model.

relay/audio_handler.go still does not call ApplyParamOverride. This pull request leaves that behavior unchanged because applying overrides after audio conversion requires generic io.Reader and payload handling rather than a one-line consistent fix.

Evidence

  • Before:

Issue #8500 reports new-api v1.0.0-rc.51 from the release or official image, self-deployed, with pass-through disabled. A MiniMax channel maps my-tts to speech-2.6-turbo. Every POST /v1/audio/speech request with model=my-tts sends the literal my-tts upstream and MiniMax returns 1008 insufficient balance. The same channel succeeds when speech-2.6-turbo reaches the upstream request body. The database engine is not involved in this request-serialization defect.

The new regression test failed before the fix:

$ go test ./relay/channel/minimax -run TestConvertAudioRequestUsesUpstreamModelName -count=1
--- FAIL: TestConvertAudioRequestUsesUpstreamModelName (0.00s)
    adaptor_test.go:50:
        Error:      Not equal:
                    expected: "speech-2.6-turbo"
                    actual  : "my-tts"
FAIL
FAIL    github.com/QuantumNous/new-api/relay/channel/minimax    0.015s
FAIL
  • After:
$ gofmt -d relay/channel/minimax/adaptor.go relay/channel/minimax/adaptor_test.go relay/channel/volcengine/adaptor.go && git diff --check && go vet ./... && go build ./... && go test ./relay/channel/minimax ./relay/channel/volcengine -count=1
ok      github.com/QuantumNous/new-api/relay/channel/minimax    0.018s
?       github.com/QuantumNous/new-api/relay/channel/volcengine [no test files]

The command exited with code 0. gofmt -d, git diff --check, go vet ./..., and go build ./... produced no output.

Merge Danger

Door: two-way

Blast Radius: relay

Summary by CodeRabbit

  • Bug Fixes
    • Text-to-speech requests for MiniMax and Volcengine now use the configured upstream model, improving consistency between the selected model and the request sent to the service.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

MiniMax and Volcengine TTS request builders now use the upstream model name. A MiniMax test verifies the model and text in the converted request body.

Changes

TTS model mapping

Layer / File(s) Summary
Use upstream model names in TTS requests
relay/channel/minimax/adaptor.go, relay/channel/volcengine/adaptor.go, relay/channel/minimax/adaptor_test.go
Both TTS request builders now set the request model from info.UpstreamModelName. The MiniMax test checks the model and text in the converted request body.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: feitianbubu, calcium-ion

Merge Risk: Minimal · up to da1dc

MiniMax and Volcengine speech requests now send the channel-mapped model name, so aliases like my-tts forward correctly. Requests without a mapping send the same model as before. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(relay): use mapped model for speech requests" matches the main change. The MiniMax and Volcengine speech adaptors now send info.UpstreamModelName instead of info.OriginModelName, so the…
Linked Issues check Passed [#8500] The issue requires the MiniMax audio/speech upstream request to use the channel-mapped model name instead of the original alias. At the reviewed head, relay/channel/minimax/adaptor.go `Conve…
Out of Scope Changes check Passed The PR changes three files: the MiniMax adaptor (one line), the MiniMax adaptor test (new test plus io, assert, and require imports), and the Volcengine adaptor (one line, Model from `info.Ups…
Full details: Title check

Explanation

The title "fix(relay): use mapped model for speech requests" matches the main change. The MiniMax and Volcengine speech adaptors now send info.UpstreamModelName instead of info.OriginModelName, so the mapped model is used. The title is specific and short, and it follows a conventional commit style. It does not cover the new test or the audio parameter override limitation, which is expected.

Full details: Linked Issues check

Explanation

[#8500] The issue requires the MiniMax audio/speech upstream request to use the channel-mapped model name instead of the original alias. At the reviewed head, relay/channel/minimax/adaptor.go ConvertAudioRequest sets MiniMaxTTSRequest.Model from info.UpstreamModelName (diff from merge base changes only this line). AudioHelper runs ModelMappedHelper before the adaptor, so UpstreamModelName holds the mapped name (speech-2.6-turbo for my-tts). The new test TestConvertAudioRequestUsesUpstreamModelName sets OriginModelName to my-tts and UpstreamModelName to speech-2.6-turbo, then asserts the converted body has model equal to speech-2.6-turbo and text equal to the input. The PR reports this test failed before the fix and passes after. The issue also mentions parameter overrides not applying; the PR explicitly leaves that unchanged. The issue treats it as a separate limitation, not a requirement of the mapping fix, so it is not a failing requirement here. Unverified: I did not run the tests myself; the result relies on the reported command output and the visible test code.

Full details: Out of Scope Changes check

Explanation

The PR changes three files: the MiniMax adaptor (one line), the MiniMax adaptor test (new test plus io, assert, and require imports), and the Volcengine adaptor (one line, Model from info.UpstreamModelName instead of info.OriginModelName). The MiniMax changes implement #8500 directly. The Volcengine change applies the same defect fix to another audio conversion path. The PR description states the request was to scan other audio adaptors for the same mistake, and the change is a one-line instance of that same pattern, so it connects to the linked work. No unrelated refactoring, formatting, or documentation changes appear in the reviewed diffs. The override behavior is explicitly not changed.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks the speech request,
The mapped model hops in place.
MiniMax sends the chosen name,
Volcengine follows suit.
The test reads the body,
And finds the model and text inside.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 53ff8060-27c5-48eb-b787-199918018d67
Commits

Reviewing files that changed from the base of the PR and between 04dfcbb and da1dc4c.

Files selected for processing: 3

  • relay/channel/minimax/adaptor.go
  • relay/channel/minimax/adaptor_test.go
  • relay/channel/volcengine/adaptor.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

This branch has not been deployed

No deployments
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.

minimax: audio/speech 请求忽略渠道「模型映射」,上游收到的是原始模型名

1 participant