语音能力(百炼批次二)

已上线(2026-10-02)。Base https://api.a7w.cn,鉴权 Authorization: Bearer <API_KEY>。

一、OpenAI 兼容协议(推荐,SDK 零改动)

能力方法与路径模型计费
语音合成 TTSPOST /v1/audio/speech(input / voice / response_format;X-DashScope-SSE: enable + Accept: text/event-stream = 流式)qwen3-tts-flash40 点/千字(0.4 元/千字),单笔保底 1 点
语音识别 ASRPOST /v1/audio/transcriptions(file 或 {"url":"https://..."};response_format = json/text/srt/vtt/verbose_json)qwen3-asr-flash(json/text)/ paraformer-v2(srt/vtt/带字级时间戳)6.6 点/分钟(离线 2.4 点/分钟),单笔保底 20 点

二、百炼原生通道(需要字符数/时间戳等原始字段时用)

1) 语音合成(同步)

POST /api/v1/services/aigc/multimodal-generation/generation
Content-Type: application/json

{"model":"qwen3-tts-flash","input":{"text":"要合成的文本","voice":"Cherry"},"parameters":{"format":"mp3"}}

返回 output.audio.url(WAV/MP3 直链)与 usage.characters(按字符计费)。

2) 语音合成(SSE 流式,边合边播)

同一个端点,额外加两个请求头(两个都要):

X-DashScope-SSE: enable
Accept: text/event-stream

响应为 text/event-stream,每个 data: 分片形如 {"output":{"audio":{"data":"<base64 音频分片>"}}}。
不需要 WebSocket —— 纯 HTTP SSE,可直接在浏览器/Node 里消费。

3) 语音识别(同步,最快)

POST /api/v1/services/audio/asr/transcription

{"input":{"audio_url":"https://.../a.wav"},"parameters":{"response_format":"text"}}

4) 语音识别(离线异步,带字级时间戳 → SRT/VTT)

parameters.response_format 传 srt / vtt / verbose_json 时,平台自动改走离线通道并返回字幕:

  • srt → application/x-subrip,可直接被 VLC / ffmpeg / 剪辑软件识别
  • vtt → text/vtt
  • verbose_json → {task,language,duration,text,segments[]}(含 words[] 字级时间戳)

实测样例(17.6 秒英文音频):

1
00:00:00,000 --> 00:00:07,500
Senior staff principal Doris Jackson, wake food faculty and of course, my fellow classmates.

2
00:00:11,760 --> 00:00:17,640
I am honored to have been chosen to speak before my classmates as well as the students across America today.

三、频控说明(重要)

  • 通用线 / 视频线:不限频(每个 API Key 可连续提交,无隔秒 / 隔分钟间隔限制)。
  • 语音线(白名单):/v1/audio/*、/api/v1/tts/*、/api/v1/services/audio/*、/api/v1/apps/voice_tts/*、/api/v1/apps/asr/*、/api/v1/apps/indextts/* 同样 不限频(配音 / 逐句翻译 / 批量转写需要高频调用,不再有隔秒间隔限制)。
  • 并发上限 100 笔;余额必须 > 0。

四、本期未接(仅支持 WebSocket,开发中)

qwen-tts-realtime / 实时 ASR(qwen-audio-3.1-asr-flash-streaming、paraformer-realtime-v2)/ 实时语音翻译 / cosyvoice-clone-v1 —— 这些只能走 WS 长连接,站内暂不上架。

五、OpenAI 兼容端点支持状态(/v1/*,实测 2026-10-02)

用同一个 API Key 调用,Base 为 https://api.a7w.cn:

端点状态说明
GET /v1/models✅ 已上线返回全量模型清单({object:"list",data:[…]})
POST /v1/chat/completions✅ 已上线全量文本/多模态模型,支持 stream:true(SSE 原样透传)
POST /v1/audio/speech✅ 已上线默认 qwen3-tts-flash;stream:true 或 X-DashScope-SSE: enable + Accept: text/event-stream 走 SSE;否则直接返回音频字节
POST /v1/audio/transcriptions✅ 已上线json/text/srt/vtt/verbose_json;srt/vtt 走离线字级时间戳
POST /v1/images/generations⚠️ 需开通路由与计费已就绪,但上游对当前账号返回 403 Account is not active. → 需在算力集市后台/上游侧开通出图应用权限后即可用
POST /v1/videos✅ 已上线按 model 路由到超分 / VIAPI tool / 上游应用;GET /v1/videos/{id} 查状态
POST /v1/embeddings❌ 不提供平台当前无 embedding 模型(501 not_implemented)。请改用外部 bge-m3(SiliconFlow / 本地部署),或用 /v1/chat/completions 做语义近似

鉴权失败(无 Key / Key 无效)统一返回 401 {"code":"invalid_api_key"};未注册的 /v1/* 路径统一返回 404 {"code":"unknown_endpoint"}(不会返回前端 HTML)。

六、已下线的坏模型(不要再调用)

  • qwen-audio-3.0-tts-plus:HTTP 直调必然 400 [cosyvoice:]Engine error [411](Realtime/WS 系),已从前台摘除,请改用 qwen3-tts-flash。
  • qwen-audio-asr:百炼目录里不存在(404),请改用 qwen3-asr-flash。

<!-- auto-generated:docs -->