QuantumNous / QuantumNous/new-api

[Feature Request] 渠道测试支持 Audio Transcription 端点类型(gpt-4o-transcribe 等模型)

Open
#5,705 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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)

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.gobuildTestRequest)不支持 Audio Transcription 类模型(如 gpt-4o-transcribegpt-4o-transcribe-diarizegpt-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 发送音频文件可以正常返回结果。

根因分析
  1. constant/endpoint_type.go 中没有定义 Audio Transcription 端点类型
  2. normalizeChannelTestEndpoint() 无法自动识别 transcribe 模型名
  3. 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.