模型 API / 语音
语音
更新时间:2026-05-11
接口说明
提供文本转语音(TTS)与语音转文本(STT/转写)两类能力,兼容 OpenAI Audio API。
文本转语音
POST
/audio/speech| 参数 | 类型 | 必需 | 说明 |
|---|---|---|---|
| model | string | 必需 | TTS 模型 ID,如 tts-1、tts-1-hd、cosyvoice-v2 |
| input | string | 必需 | 待合成的文本,长度 ≤ 4096 字符 |
| voice | string | 必需 | 音色 ID,如 alloy、nova、onyx,详见控制台音色列表 |
| response_format | string | 可选 | 音频格式,可选 mp3、wav、opus、flac,默认 mp3 |
| speed | number | 可选 | 语速,取值 [0.25, 4.0],默认 1.0 |
cURL
curl -X POST "https://www.tokenwell.com.cn/v1/audio/speech" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-1",
"input": "你好,欢迎使用词元井平台。",
"voice": "alloy"
}' \
--output speech.mp3语音转文本
POST
/audio/transcriptions| 参数 | 类型 | 必需 | 说明 |
|---|---|---|---|
| model | string | 必需 | 转写模型 ID,如 whisper-1、paraformer-v2 |
| file | file | 必需 | 音频文件,支持 mp3、wav、m4a、flac,单文件 ≤ 25MB |
| language | string | 可选 | 音频语言(ISO-639-1,如 zh、en),不传则自动识别 |
| response_format | string | 可选 | 返回格式,可选 json、text、srt、vtt,默认 json |
cURL
curl -X POST "https://www.tokenwell.com.cn/v1/audio/transcriptions" \ -H "Authorization: Bearer YOUR_API_KEY" \ -F file=@audio.mp3 \ -F model=whisper-1 \ -F language=zh
JSON
{"text": "你好,欢迎使用词元井平台。"}
没有找到想看的内容?联系我们 →