Whisper-1 音频转录
- 支持 99 种语言的语音识别
- 多种输出格式:json / text / srt / verbose_json / vtt
- 最大文件 25MB
认证
本接口需要上传文件,不支持在浏览器里直接「试一试」。请用 cURL、Postman 或 SDK 测试。
All endpoints authenticate with a Bearer token.
Get an API key: open the console and create one.
Add it to the request header:
Authorization: Bearer YOUR_OAIRoute_KEYThis endpoint requires a file upload and can't be tried directly in the browser's "Try it" panel. Use cURL, Postman, or an SDK.
请求参数
请求体为 multipart/form-data。
待转录的音频文件。
支持的格式:mp3、mp4、mpeg、mpga、m4a、wav、webm。单文件最大 25MB。
语音识别模型名称。当前取值 whisper-1。
音频语言代码,ISO-639-1 格式。明确指定可提升准确率与速度,共支持 99 种语言。
常用值:zh 中文、en 英文、ja 日文、ko 韩文。
可选文本提示,用于引导转录风格或承接上一段音频内容。上限 224 token。
输出格式,默认 json。
jsonJSON,仅含文本text纯文本srtSRT 字幕verbose_json详细 JSON,含时间戳及其他元数据vttWebVTT 字幕
采样温度,取值 0 到 1,默认 0。数值越高结果越随机,越低越确定。
The body is multipart/form-data.
The audio file to transcribe.
Supported formats: mp3, mp4, mpeg, mpga, m4a, wav, webm. Maximum 25MB per file.
The speech recognition model name. Currently whisper-1.
The audio's language code, in ISO-639-1 format. Specifying it improves accuracy and speed; 99 languages are supported.
Common values: zh Chinese, en English, ja Japanese, ko Korean.
An optional text hint used to steer transcription style or carry over from a previous audio segment. Up to 224 tokens.
Output format; defaults to json.
jsonJSON containing only the texttextplain textsrtSRT subtitlesverbose_jsondetailed JSON with timestamps and other metadatavttWebVTT subtitles
Sampling temperature, 0 to 1, default 0. Higher is more random, lower is more deterministic.
响应
转录后的文本。所有格式下都返回该字段。
任务类型,固定值 transcribe。仅 verbose_json 返回。
检测到或指定的语言代码。仅 verbose_json 返回。
音频时长,单位秒。仅 verbose_json 返回。
文本片段数组。仅 verbose_json 返回。
segments 元素字段
片段 ID。
片段起始时间,单位秒。
片段结束时间,单位秒。
片段文本。
该片段使用的采样温度。
平均对数概率。数值越接近 0 表示置信度越高。
压缩比。异常高的值通常提示识别出现了循环重复。
无语音概率。接近 1 时说明这段大概率是静音或噪音。
The transcribed text. Returned in every format.
The task type, fixed at transcribe. Returned only with verbose_json.
The detected or specified language code. Returned only with verbose_json.
Audio duration in seconds. Returned only with verbose_json.
The array of text segments. Returned only with verbose_json.
Segment fields
The segment ID.
Segment start time in seconds.
Segment end time in seconds.
The segment text.
The sampling temperature used for this segment.
Average log probability. Closer to 0 means higher confidence.
Compression ratio. Abnormally high values usually indicate looping repetition in the transcription.
No-speech probability. Near 1 this segment is most likely silence or noise.
响应示例
json 格式:
{
"text": "这是一段测试音频的转录文本内容。"
}verbose_json 格式:
{
"task": "transcribe",
"language": "zh",
"duration": 8.5,
"text": "这是一段测试音频的转录文本内容。",
"segments": [
{
"id": 0,
"seek": 0,
"start": 0.0,
"end": 3.5,
"text": "这是一段测试音频",
"tokens": [50364, 1234, 5678],
"temperature": 0.0,
"avg_logprob": -0.3,
"compression_ratio": 1.2,
"no_speech_prob": 0.01
}
]
}srt 格式:
1
00:00:00,000 --> 00:00:03,500
这是一段测试音频
2
00:00:03,500 --> 00:00:08,500
的转录文本内容。json format:
{
"text": "This is the transcribed text of a test audio clip."
}verbose_json format:
{
"task": "transcribe",
"language": "en",
"duration": 8.5,
"text": "This is the transcribed text of a test audio clip.",
"segments": [
{
"id": 0,
"seek": 0,
"start": 0.0,
"end": 3.5,
"text": "This is a test audio clip",
"tokens": [50364, 1234, 5678],
"temperature": 0.0,
"avg_logprob": -0.3,
"compression_ratio": 1.2,
"no_speech_prob": 0.01
}
]
}srt format:
1
00:00:00,000 --> 00:00:03,500
This is a test audio clip
2
00:00:03,500 --> 00:00:08,500
transcribed into text.提升准确率的做法
指定语种。 短音频自动识别容易判错,明确 language 能显著改善。
用 prompt 喂专有名词。 把可能出现的行业词汇、人名、缩写写进去,能减少同音错字。注意上限 224 token。
长音频先切分。 按静音点切成 5 到 10 分钟一段,既避开 25MB 限制,也降低单次失败的重试成本。
用 no_speech_prob 过滤静音段。 批量处理录音时,这个字段能帮你跳过无内容的部分。
Specify the language. Auto-detection on short audio goes wrong easily; setting language explicitly improves results noticeably.
Feed proper nouns through prompt. Put likely industry terms, names, and abbreviations in, which cuts homophone errors. Watch the 224-token limit.
Split long audio first. Cut on silence into 5 to 10 minute pieces, which both avoids the 25MB limit and lowers the cost of retrying a failure.
Filter silence with no_speech_prob. When batch-processing recordings, this field lets you skip parts with no content.
错误
| HTTP | type | 说明 |
|---|---|---|
| 400 | invalid_request_error | 请求参数无效 |
| 401 | authentication_error | 身份验证失败,请检查您的API密钥 |
| 402 | payment_required | 账户余额不足,请充值后再试 |
| 429 | rate_limit_error | 请求过于频繁,请稍后再试 |
| HTTP | type | Notes |
|---|---|---|
| 400 | invalid_request_error | Invalid request parameters |
| 401 | authentication_error | Authentication failed; check your API key |
| 402 | payment_required | Insufficient account balance; top up and retry |
| 429 | rate_limit_error | Too many requests; try again later |
For more status codes and retry guidance see Error codes and rate limits; for troubleshooting steps on common errors see the FAQ.
支持的模型列表
以下语音识别模型均可通过本接口调用,实际可用范围以你的账号分组为准:
OpenAI 语音 系列
tts-1-hd语音合成,音质优先tts-1语音合成,延迟优先gpt-4o-mini-tts新一代,支持风格指令whisper-1语音转文字 等
Google 语音 系列
gemini-3.1-flash-tts-preview轻量语音合成,多语言 等
更多模型持续更新中…
Every speech recognition model below can be called through this endpoint; what your account group actually allows takes precedence:
OpenAI 语音 系列
tts-1-hd语音合成,音质优先tts-1语音合成,延迟优先gpt-4o-mini-tts新一代,支持风格指令whisper-1语音转文字 等
Google 语音 系列
gemini-3.1-flash-tts-preview轻量语音合成,多语言 等
更多模型持续更新中…
使用示例
转写为纯文本
最简形式:上传音频文件,拿回整段文字。response_format 不传时默认 json。
curl --request POST https://api.oairoute.com/v1/audio/transcriptions \
-H "Authorization: Bearer YOUR_OAIRoute_KEY" \
-F "[email protected]" \
-F "model=whisper-1"指定语言
明确告诉模型音频的语言,能减少识别偏差、加快处理。不传时自动检测。
curl --request POST https://api.oairoute.com/v1/audio/transcriptions \
-H "Authorization: Bearer YOUR_OAIRoute_KEY" \
-F "[email protected]" \
-F "model=whisper-1" \
-F "language=zh"带时间戳的转写
response_format 设为 verbose_json 会返回分段信息,每段带起止时间,适合做字幕。
curl --request POST https://api.oairoute.com/v1/audio/transcriptions \
-H "Authorization: Bearer YOUR_OAIRoute_KEY" \
-F "[email protected]" \
-F "model=whisper-1" \
-F "response_format=verbose_json" \
-F "timestamp_granularities[]=segment"用提示词纠正专有名词
prompt 可以喂一段术语表或上文,模型会倾向于用这些写法。人名、产品名、缩写多时很有用。
curl --request POST https://api.oairoute.com/v1/audio/transcriptions \
-H "Authorization: Bearer YOUR_OAIRoute_KEY" \
-F "[email protected]" \
-F "model=whisper-1" \
-F "prompt=本次会议涉及 OAIRoute、Seedance、Claude Sonnet 等术语。"Transcribe to plain text
The simplest form: upload an audio file, get the full text back. response_format defaults to json when omitted.
curl --request POST https://api.oairoute.com/v1/audio/transcriptions \
-H "Authorization: Bearer YOUR_OAIRoute_KEY" \
-F "[email protected]" \
-F "model=whisper-1"Specify the language
Telling the model the audio's language reduces errors and speeds up processing. When omitted, it auto-detects.
curl --request POST https://api.oairoute.com/v1/audio/transcriptions \
-H "Authorization: Bearer YOUR_OAIRoute_KEY" \
-F "[email protected]" \
-F "model=whisper-1" \
-F "language=zh"Transcription with timestamps
Setting response_format to verbose_json returns segment information with start and end times for each, suited to subtitles.
curl --request POST https://api.oairoute.com/v1/audio/transcriptions \
-H "Authorization: Bearer YOUR_OAIRoute_KEY" \
-F "[email protected]" \
-F "model=whisper-1" \
-F "response_format=verbose_json" \
-F "timestamp_granularities[]=segment"Correcting proper nouns with a prompt
prompt can carry a glossary or prior context, and the model tends to use those spellings. Very useful when names, product names, and abbreviations are frequent.
curl --request POST https://api.oairoute.com/v1/audio/transcriptions \
-H "Authorization: Bearer YOUR_OAIRoute_KEY" \
-F "[email protected]" \
-F "model=whisper-1" \
-F "prompt=This meeting covers terms such as OAIRoute, Seedance, and Claude Sonnet."