QuantumNous / QuantumNous/new-api
[Feature Request] 渠道测试支持 Audio Transcription 端点类型(gpt-4o-transcribe 等模型)
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 48.5k
- Forks
- 11.6k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 58
Description
Read This First (Do Not Remove This Section)
- Docs: https://docs.newapi.ai/
- Usage questions first: https://deepwiki.com/QuantumNous/new-api
- Warning: issues with this template removed, section headings deleted, or content cleared may be closed directly. Repeated abusive submissions may result in a block.
Your current newapi version
v1.0.0-rc.10-101aix.5 (also tested on latest upstream)
Submission Checks
- No duplicate issue: I have searched existing Issues and confirmed there are no duplicates.
- Pre-submission reading: I have read the docs at https://docs.newapi.ai/ and the project README.
- Template intact: I have not removed any guidance or section headings from this template.
- Maintainer cost: I understand maintainers have limited time and issues not following the template may be ignored or closed directly.
Feature Description
问题
当前渠道测试(controller/channel-test.go → buildTestRequest)不支持 Audio Transcription 类模型(如 gpt-4o-transcribe、gpt-4o-transcribe-diarize、gpt-4o-mini-transcribe)。
测试这些模型时,会默认构建一个 Chat Completion 请求发送到 /v1/chat/completions,导致上游返回 500 server_error:
bad response status code 500, message: The server had an error while processing your request.
Sorry about that!, body: { "error": { "message": "The server had an error while processing
your request. Sorry about that!", "type": "server_error", "param": null, "code": null } }
实际上模型和渠道配置都没问题——用 /v1/audio/transcriptions 发送音频文件可以正常返回结果。
根因分析
constant/endpoint_type.go中没有定义 Audio Transcription 端点类型normalizeChannelTestEndpoint()无法自动识别 transcribe 模型名buildTestRequest()的switch没有 audio transcription 分支,无法构建 multipart/form-data 音频请求
建议方案
方案 A(推荐):新增 EndpointTypeAudioTranscription 端点类型
// constant/endpoint_type.go
EndpointTypeAudioTranscription EndpointType = "audio-transcription"
// controller/channel-test.go — normalizeChannelTestEndpoint()
// 自动检测 transcribe 模型名
if strings.Contains(modelName, "transcribe") || strings.Contains(modelName, "whisper") {
return string(constant.EndpointTypeAudioTranscription)
}
// controller/channel-test.go — buildTestRequest()
case constant.EndpointTypeAudioTranscription:
// 生成最小 WAV(16kHz mono, ~0.5s 静音)
// 构建 multipart/form-data 请求体
return &AudioTranscriptionTestRequest{Model: model, File: minimalWAV}
- 前端测试弹窗的「端点类型」下拉菜单中增加
audio-transcription选项 - 在
normalizeChannelTestEndpoint中对 transcribe/whisper 等模型名自动推断
方案 B(最小改动):仅自动检测 + 跳过
在 normalizeChannelTestEndpoint 中识别 transcribe 模型,直接返回提示"该模型类型不支持渠道测试",避免误报 500。
影响的模型
| Model | Endpoint |
|---|---|
gpt-4o-transcribe |
/v1/audio/transcriptions |
gpt-4o-transcribe-diarize |
/v1/audio/transcriptions |
gpt-4o-mini-transcribe |
/v1/audio/transcriptions |
whisper-1 |
/v1/audio/transcriptions |
Use Case
运营人员在渠道管理界面点击「测试」按钮时,期望能验证 transcribe 模型的可用性,目前只能通过手动 curl 发送音频文件来测试,无法在 UI 中操作。这与 #4281 (Anthropic 端点检测) 和 #3298 (流式测试硬编码) 属于同一类问题——渠道测试未覆盖所有端点类型。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read constant/endpoint_type.go and controller/channel-test.go, starting at normalizeChannelTestEndpoint and buildTestRequest. Compare the existing channel-test request paths, then implement the chosen approach so transcribe and whisper models are recognized and either tested through /v1/audio/transcriptions or reported as unsupported. Confirm the endpoint-type option matches if the UI change is included.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100