Speech to Text
curl --request POST \
--url https://api.fish.audio/v1/asr \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form audio=@example-file \
--form 'language=<string>' \
--form ignore_timestamps=trueimport requests
url = "https://api.fish.audio/v1/asr"
files = { "audio": ("example-file", open("example-file", "rb")) }
payload = {
"language": "<string>",
"ignore_timestamps": "true"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('audio', '<string>');
form.append('language', '<string>');
form.append('ignore_timestamps', 'true');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.fish.audio/v1/asr', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fish.audio/v1/asr",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"ignore_timestamps\"\r\n\r\ntrue\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fish.audio/v1/asr"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"ignore_timestamps\"\r\n\r\ntrue\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.fish.audio/v1/asr")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"ignore_timestamps\"\r\n\r\ntrue\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fish.audio/v1/asr")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"ignore_timestamps\"\r\n\r\ntrue\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"text": "<string>",
"duration": 123,
"segments": [
{
"text": "<string>",
"start": 123,
"end": 123
}
],
"language_code": "<string>",
"language": "<string>"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}ASR (v1)
Speech to Text
Transcribe audio with transcribe-2-pro, the recommended speech-to-text model, or transcribe-1-pro: request and response fields, speaker turns, text format, verbatim, key terms, limits, formats, and errors
POST
/
v1
/
asr
Speech to Text
curl --request POST \
--url https://api.fish.audio/v1/asr \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form audio=@example-file \
--form 'language=<string>' \
--form ignore_timestamps=trueimport requests
url = "https://api.fish.audio/v1/asr"
files = { "audio": ("example-file", open("example-file", "rb")) }
payload = {
"language": "<string>",
"ignore_timestamps": "true"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('audio', '<string>');
form.append('language', '<string>');
form.append('ignore_timestamps', 'true');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.fish.audio/v1/asr', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fish.audio/v1/asr",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"ignore_timestamps\"\r\n\r\ntrue\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fish.audio/v1/asr"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"ignore_timestamps\"\r\n\r\ntrue\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.fish.audio/v1/asr")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"ignore_timestamps\"\r\n\r\ntrue\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fish.audio/v1/asr")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"language\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"ignore_timestamps\"\r\n\r\ntrue\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"text": "<string>",
"duration": 123,
"segments": [
{
"text": "<string>",
"start": 123,
"end": 123
}
],
"language_code": "<string>",
"language": "<string>"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}{
"status": 123,
"message": "<string>",
"reason": "<string>"
}This BETA endpoint transcribes one audio file per request. Send the audio as
multipart/form-data (a file upload) or application/msgpack. Base64-encoded
audio in a JSON body is not supported.Select a model
SendPOST https://api.fish.audio/v1/asr with Authorization: Bearer <API_KEY> and a model HTTP header that selects the model. The request is synchronous: the response arrives when the whole file has been transcribed.
| Header value | Use it for |
|---|---|
transcribe-2-pro | Recommended. Recordings up to 60 minutes, with the same speaker markers, speaker turns, and cues as transcribe-1-pro. Adds text_format, verbatim, and keyterms, and uses your language hint. |
transcribe-1-pro | The previous Pro model. Recordings up to 60 minutes, including multi-speaker conversations: speaker markers and speaker turns, with emotion and vocal-event cues preserved. |
transcribe-1 | Deprecated, retiring on December 31, 2026. General transcription of short recordings. Used when the model header is missing or not an exact match. |
transcribe-1-pro and transcribe-2-pro are the Pro models. Send model: transcribe-2-pro (or model: transcribe-1-pro) with every request, written exactly, in lowercase. If the header is missing, or its value is not an exact match (for example Transcribe-1-Pro, transcribe-2pro, or transcribe-2), the request is served and billed as transcribe-1, and no error is returned; text_format, verbatim, and keyterms are then ignored. If you expected a Pro model but the transcript has no speaker markers and you did not send diarize=false, check the header. This applies to the API playground on this page too: set its model header to the model you want.
The model belongs in the header for both multipart and MessagePack requests; a model field in the request body is ignored. See Limits for recording length and request size.
To link the request to your own distributed trace, also send a W3C traceparent header. See Tracing & Performance Analysis.
Request fields
Multipart and MessagePack bodies use the same field names. Multipart values are text; MessagePack values are typed.| Field | Required | Default | Description |
|---|---|---|---|
audio | Yes | — | Exactly one audio file per request: a file upload for multipart, or binary bytes for MessagePack. The format is detected from the file contents, not the file name. See Supported audio formats. |
language | No | Unset | Optional language hint, as a lowercase ISO 639-1 code such as en, zh, or ja. With transcribe-1-pro, the language is detected automatically either way; transcribe-2-pro also passes the hint to the model. An empty multipart value counts as unset. See Language. |
ignore_timestamps | No | true | Default true (no timestamps). Set to false to get word-level segments and speaker_turns. Timestamps add processing time. |
tag_audio_events | No | true | true: bracketed emotion and vocal-event cues such as [laughter] or [高兴] stay in text and in speaker_turns. false: the cues are removed. Timestamps, duration, and billing do not change. |
diarize | No | auto | auto or true: return speaker_turns when timestamps are requested. false: omit speaker_turns and the speaker markers in text; the rest of the transcript does not change. |
num_speakers | No | Unset | The expected number of speakers, an integer of 1 or more. Cannot be combined with min_speakers or max_speakers. |
min_speakers, max_speakers | No | Unset | Lower and upper bounds on the number of speakers, integers of 1 or more. min_speakers must not exceed max_speakers. |
text_format | No | written | transcribe-2-pro only. written: numbers, dates, times, and amounts in digits and symbols, such as 3:30 or 20%. spoken: in words, as they were said, such as twenty-five dollars. See Text format. |
verbatim | No | true | transcribe-2-pro only. true: filler words, stutters, repetitions, and false starts stay in the transcript. false: filler sounds, stutters, accidental repetitions, and short false starts are left out; nothing is reworded. See Verbatim. |
keyterms | No | Unset | transcribe-2-pro only. Up to 128 words or short phrases, such as names and product terms, for the transcript to spell as you list them. In multipart forms, repeat the field once per term. See Key terms. |
true or false for ignore_timestamps. Any value other than true (case-insensitive), including 1 or an empty value, is read as false and turns timestamps on. In MessagePack, send a boolean; a string or nil returns 400.
Speaker-count hints are applied on a best-effort basis: they guide speaker identification on longer recordings and may have no effect on short ones. They cannot be sent with diarize=false.
tag_audio_events, diarize, the speaker-count hints, text_format, verbatim, and keyterms are validated strictly:
- In multipart forms,
tag_audio_eventsandverbatimtaketrueorfalse,diarizetakesauto,true, orfalse, andtext_formattakeswrittenorspoken, in any letter case. Speaker counts take digits only. Send each of these fields at most once.keytermsis the exception: send it once per term. - In MessagePack, send
tag_audio_eventsandverbatimas booleans,diarizeas a boolean or one of the lowercase stringsauto,true, orfalse,text_formatas the stringwrittenorspoken, speaker counts as integers, not floats or strings, andkeytermsas an array of strings.nilmeans the default; forkeyterms,niland an empty array mean no key terms. - Any other value, a repeated multipart field, or a conflicting combination returns 400 with code
invalid_parameter. So does a key term that breaks the key term rules.
text_format, verbatim, and keyterms apply to transcribe-2-pro only. transcribe-1-pro ignores them.
If you use transcribe-1: send audio, language, and ignore_timestamps. The other fields apply to the Pro models; send them only with model: transcribe-1-pro or model: transcribe-2-pro.
Examples
curl --request POST https://api.fish.audio/v1/asr \
--header "Authorization: Bearer $FISH_API_KEY" \
--header "model: transcribe-2-pro" \
--form audio=@conversation.wav \
--form ignore_timestamps=false
segments and speaker_turns. For a two-person interview, you can add a speaker-count hint, and remove emotion and vocal-event cues from the transcript:
curl --request POST https://api.fish.audio/v1/asr \
--header "Authorization: Bearer $FISH_API_KEY" \
--header "model: transcribe-2-pro" \
--form audio=@interview.mp3 \
--form ignore_timestamps=false \
--form num_speakers=2 \
--form tag_audio_events=false
transcribe-2-pro, you can also send a language hint and list key terms, one keyterms field per term:
curl --request POST https://api.fish.audio/v1/asr \
--header "Authorization: Bearer $FISH_API_KEY" \
--header "model: transcribe-2-pro" \
--form audio=@earnings-call.mp3 \
--form language=en \
--form-string keyterms=Kubernetes \
--form-string "keyterms=Fish Audio"
--form-string sends each term as plain text, even one that starts with @, which --form would read as a file to upload.
Let your HTTP client set the multipart Content-Type and boundary. For MessagePack, set Content-Type: application/msgpack and encode audio as binary bytes. See the Speech to Text guide for an example.
Text format
Withtranscribe-2-pro, text_format changes how the model writes numbers, dates, times, and amounts, for the whole recording. written (the default) writes them in digits and symbols, such as 3:30 or 20%; in Chinese transcripts, numbers are usually Arabic digits. spoken writes them in words, as they were said, such as twenty-five dollars. spoken is not always followed when the request also has keyterms: numbers, dates, and amounts can then come back in digits and symbols, as with written. If you need spoken numbers, send the request without key terms.
Verbatim
Withtranscribe-2-pro, verbatim controls filler words and disfluencies, for the whole recording. true (the default) keeps filler words, stutters, repetitions, and false starts. false leaves out filler sounds, stutters, accidental repetitions, and short false starts. It only removes words, and never rewords or replaces them: meaningful words stay, and so does a short reply such as Mm-hmm. The model decides what counts as a filler or a false start, so it can occasionally leave one in or remove a short word that was meant.
Key terms
Withtranscribe-2-pro, send keyterms to list words or short phrases that may be spoken in the recording, such as names, products, and technical terms, so the transcript spells them as you list them. List only terms that are likely to occur: a listed term that is never said can occasionally appear in the transcript. Key terms have been tested on short Chinese, Japanese, and English clips.
- Encoding: in multipart forms, repeat the
keytermsfield once per term. In MessagePack, send an array of strings. - Count: at most 128 terms per request, repeated terms included.
- Length: each term at most 50 characters and 8 words, counted after leading and trailing whitespace is removed and each run of whitespace inside it is read as one space. Words are separated by spaces, so a Chinese or Japanese term without spaces is one word. An empty term is refused.
- Characters: a term cannot contain an ASCII comma (
,), any of\ < > [ ] { }, or control and invisible formatting characters, such as tabs, line breaks, or zero-width spaces. The zero-width non-joiner and joiner (U+200C, U+200D) and full-width punctuation such as,and、are accepted. - Reserved starts: a term cannot start with
style:,format:,verbatim:,tags:,language hint:, orglossary:, in any letter case. - Duplicates: a term listed twice is used once. Two terms that differ only in letter case or character width, such as
ABCandABC, are refused. - Total size: all the terms together must fit in the model’s limit of 1024 tokens. Long Chinese or Japanese terms reach it well before 128 terms, at about 32 to 37 terms of 32 characters each, and so can a few long terms in rare scripts. The error message then says the terms are too long in total for the 1024-token limit and gives the list’s token count; send fewer or shorter terms.
invalid_parameter. The message names the rule and the term’s position in the request, such as keyterms[3], counted from 0, but never the term itself. Key terms do not change the price. With key terms, text_format=spoken is not always followed; see Text format.
Read the response
A successful response (HTTP 200) is a JSON object:| Field | Description |
|---|---|
text | The full transcript, with inline speaker markers such as <|speaker:0|> (none with diarize=false) and, unless tag_audio_events=false, bracketed emotion and vocal-event cues such as [高兴] (happy) or [laughter]. See Multi-speaker response format. |
duration | Length of the audio in seconds, including silence. |
segments | Word-level timestamps: an array of { "text", "start", "end" }, with times in seconds. Empty ([]) when ignore_timestamps=true (the default), when no speech was found, or when timing is temporarily unavailable. See Segments. |
speaker_turns | The transcript as timed speaker turns. Returned when ignore_timestamps=false and diarize is not false; otherwise absent. See Speaker turns. |
language | The detected language’s English name, such as English or Chinese. With transcribe-2-pro, the language of your language hint when the model recognizes it and the transcript agrees with it. Omitted when it cannot be determined. Intended for display. |
language_code | Two-letter ISO 639-1 code for the language, such as en. Omitted when unknown. If the language cannot be determined and you sent a language hint, this reports your hint. With transcribe-2-pro, it reports the language of a hint the model recognizes, such as pt for pt-BR, when the transcript agrees with it. See Language. |
request_id | A unique ID for this request, also present in Pro model error bodies and in the x-request-id response header. Platform and network-edge errors do not carry it. Include it when you contact support. |
null. Do not depend on the order of keys in the JSON.
If you use transcribe-1: rely on text, duration, segments, language, and language_code. Speaker markers, speaker_turns, and request_id are features of the Pro models.
Both SDKs select the model through the
model header. In Python, pass
model="transcribe-2-pro" to asr.transcribe() (fish-audio-sdk 1.5.0
or later; on earlier versions, pass
request_options=RequestOptions(additional_headers={"model": "transcribe-2-pro"})).
In JavaScript, pass model: "transcribe-2-pro" in the request to
speechToText.convert() (fish-audio 0.2.0 or later; on 0.1.0, pass
{ headers: { model: "transcribe-2-pro" } } as the second argument). Select
transcribe-1-pro the same way. fish-audio-sdk 1.9.0 or later and
fish-audio 0.6.0 or later also send tag_audio_events, diarize, the
speaker-count hints, text_format, verbatim, and keyterms, under the
same names; with earlier versions, call the API directly, as in the examples
above. The Python SDK returns the fields listed above (fish-audio-sdk 1.4.0
or later; earlier versions keep only text, duration, and segments). The
JavaScript SDK returns the whole response body; its STTResponse type
declares text, duration, segments, request_id (0.4.0 or later), and
speaker_turns (0.6.0 or later).Multi-speaker response format
The Pro models mark speaker changes inside thetext string with <|speaker:N|> markers. The label N identifies the speaker for the text that follows, up to the next marker. A repeated label means that speaker is speaking again.
- Markers usually have a space on each side (
<|speaker:0|> 你好。 <|speaker:1|> ...). Do not depend on exact spacing. - Any text before the first marker belongs to the first turn.
- Unless you send
diarize=false, which removes the markers, a transcript with no marker comes from a single speaker; treat it as speaker 0. - Labels identify speakers within one response only. They are not names, and the same label in two requests is not the same person. Send a whole conversation as one file.
ignore_timestamps=true (the default), timestamps are skipped and speaker_turns is absent:
{
"text": "<|speaker:0|> 你好。 <|speaker:1|> [高兴]很开心认识你。 <|speaker:0|> 我也是。",
"duration": 6.4,
"segments": [],
"language_code": "zh",
"language": "Chinese",
"request_id": "5f0c7e2a-9b1d-4c3e-8f6a-2d4b7c9e1a03"
}
你好。, speaker 1 saying [高兴]很开心认识你。, and speaker 0 saying 我也是。. The [高兴] cue describes the delivery of speaker 1’s speech. There is no separate emotion field; the cues are part of the text.
Speaker turns
Withignore_timestamps=false, the Pro models also return the turns as a structured speaker_turns array, unless you send diarize=false. When you request timestamps, prefer speaker_turns over parsing text.
speaker_turnslists the turns in the order they occur, and is[]when no speech was found. Each turn is{ "speaker": "speaker:N", "text": "...", "start": <seconds>, "end": <seconds> }.speakeris the stringspeaker:N, whereNmatches the<|speaker:N|>marker intext. Like the markers, labels identify speakers within one response only.textis that turn’s speech without speaker markers. It keeps emotion and vocal-event cues unlesstag_audio_events=false.startandendcome from the word timestamps. If word timing is unavailable (segmentsis empty), turn times are approximate and can cover the whole recording.- Consecutive turns can have the same speaker. Do not assume turns are contiguous or non-overlapping.
ignore_timestamps=false:
{
"text": "<|speaker:0|> 你好。 <|speaker:1|> [高兴]很开心认识你。 <|speaker:0|> 我也是。",
"duration": 6.4,
"segments": [
{ "text": "你", "start": 0.24, "end": 0.52 },
{ "text": "好", "start": 0.52, "end": 0.8 },
{ "text": "很", "start": 1.6, "end": 1.84 },
{ "text": "开", "start": 1.84, "end": 2.1 },
{ "text": "心", "start": 2.1, "end": 2.36 },
{ "text": "认", "start": 2.36, "end": 2.7 },
{ "text": "识", "start": 2.7, "end": 2.98 },
{ "text": "你", "start": 2.98, "end": 3.3 },
{ "text": "我", "start": 4.5, "end": 4.78 },
{ "text": "也", "start": 4.78, "end": 5.02 },
{ "text": "是", "start": 5.02, "end": 5.4 }
],
"speaker_turns": [
{ "speaker": "speaker:0", "text": "你好。", "start": 0.24, "end": 0.8 },
{
"speaker": "speaker:1",
"text": "[高兴]很开心认识你。",
"start": 1.6,
"end": 3.3
},
{ "speaker": "speaker:0", "text": "我也是。", "start": 4.5, "end": 5.4 }
],
"language_code": "zh",
"language": "Chinese",
"request_id": "5f0c7e2a-9b1d-4c3e-8f6a-2d4b7c9e1a03"
}
Segments
A segment is usually one word; in Chinese and Japanese it is usually one character, or a few. Segment text has no punctuation and no speaker markers or cues, and can be normalized (for example35 for 3.5), so it does not always match text character for character. A segment can have start equal to end. Segments are not speaker turns and carry no speaker ID.
Language
language is optional. Responses report one language: for recordings that switch languages, language and language_code do not list every language spoken.
With transcribe-1-pro:
- The language is detected automatically whether or not you send a hint, and a hint does not force the transcript into that language.
- Use a lowercase ISO 639-1 code such as
en,zh, orja. - If the language cannot be determined (for example, very short audio),
language_codereports your hint, which is not checked against the audio, andlanguagemay be absent.
transcribe-2-pro:
- The hint is passed to the model and guides the transcription. Send it when you know the language of the recording. Without a hint, the response language is detected from the transcript, and for some languages it can be missing or name a related language, such as Hindi for Marathi.
- The hint can be an ISO 639-1 or ISO 639-3 code, an English language name, or a locale such as
pt-BR, in any letter case. A hint the model does not recognize, such asauto, is ignored: the model transcribes without a hint, the response language is detected as withtranscribe-1-pro, and no error is returned. - When the model recognizes the hint,
languageandlanguage_codereport the hint’s language, for examplePortugueseandptforpt-BR, if the transcript agrees with it: no language is detected in the transcript, the language detected is the hint’s, or, for a language that detection cannot identify, the transcript is mostly in a script that language is written in. Otherwise they report the detected language: Chinese speech sent withlanguage=jareturnsChineseandzh. - For
bs,hr, andsr,languageisBosnian/Croatian/Serbianandlanguage_codeis the code you sent. - Send the language that is actually spoken. A wrong hint can change the transcript, for example the script it is written in, and a wrong hint in the same script as the speech is not always caught: English speech sent with
language=azcan returnAzerbaijani.
Limits
- Audio length: up to 60 minutes per request with either Pro model. Longer audio returns 400 with code
audio_too_long. - Request size: for long recordings, send compressed audio such as MP3, Opus, or AAC. An hour of 128 kbps MP3 is about 55 MiB. A request that is too large returns 413.
- One conversation per request: send the whole recording in one request. Timestamps and speaker labels then cover the whole recording. Do not split a conversation, because labels are consistent only within one response.
transcribe-1: it is designed for short recordings; for recordings longer than a few minutes, use transcribe-2-pro. It accepts up to 50 MiB per request; keep MP3 and Opus files under 25 MiB. A request that exceeds the size limit returns 413 or 400. A long request can fail with 503 if it exceeds the processing-time limit. Retry, and if it keeps failing, use transcribe-1-pro or split the audio.
Processing time and timeouts
- Processing time grows with the length of the recording. Long recordings can take several minutes on either Pro model.
- Set your HTTP client’s timeout accordingly. The official SDKs’ default timeout can be too short for long recordings, and many HTTP libraries default to even less (httpx defaults to 5 seconds). For long recordings, use a generous timeout, for example 15 minutes:
httpx.Timeout(900.0, connect=10.0)with httpx,RequestOptions(timeout=900)with the Python SDK, or{ timeoutInSeconds: 900 }with the JavaScript SDK. - In Node.js, the built-in
fetch, which the JavaScript SDK uses, also stops waiting for a response after 5 minutes, even if you set a longer timeout. To wait longer, callsetGlobalDispatcher(new Agent({ headersTimeout: 900_000, bodyTimeout: 900_000 }))from theundicipackage once at startup. See Processing time and timeouts. - If a long request fails with a 5xx error or the connection drops, retry it.
- Each request holds one of your account’s concurrent request slots until its response is returned.
Supported audio formats
- The Pro models accept WAV, MP3, AAC (including M4A/MP4), FLAC, Ogg (Opus or Vorbis), WebM/Matroska, and MOV, including browser recordings. For a video file, they use the first audio track. Send the original file bytes; no conversion is needed.
- Not supported: AIFF, CAF, WMA, AMR, AC-3, and raw (headerless) PCM. These return 400.
transcribe-1: it accepts WAV, MP3, AAC (including M4A/MP4), FLAC, and Ogg (Opus or Vorbis). Browser WebM recordings (for example, from MediaRecorder) may not be accepted; convert them to Ogg/Opus, MP3, or WAV first.
Errors
Error responses have one of these shapes:- Pro model errors, from
transcribe-1-proandtranscribe-2-pro, are JSON withstatus,message,code, andrequest_id. Branch oncode, not onmessage. - Platform errors, such as authentication, credit, and concurrency errors, are returned before the request reaches a model. They are JSON with exactly
statusandmessage. - Errors from the network edge in front of the API, such as some 413 and 5xx responses, may not have a JSON body. Handle them by HTTP status.
{
"status": 400,
"message": "A human-readable description of the problem.",
"code": "invalid_parameter",
"request_id": "5f0c7e2a-9b1d-4c3e-8f6a-2d4b7c9e1a03"
}
| Status | code | Meaning | Retry? |
|---|---|---|---|
| 400 | invalid_request | Malformed request: the body could not be parsed, audio is missing, or more than one audio was sent. | No |
| 400 | invalid_parameter | A parameter has a value it does not accept, or parameters conflict. | No |
| 400 | invalid_audio | The audio could not be decoded, or the format is not supported. | No |
| 400 | audio_too_long | The audio is longer than 60 minutes. | No |
| 400 | audio_too_short | The audio is too short to transcribe (under about 0.08 seconds). | No |
| 400 | — | The request body could not be read. | No |
| 401 | — | Missing or invalid API key. | No |
| 402 | — | Insufficient API credit. | No |
| 413 | request_too_large | The request is too large. It may come from the network edge without a JSON body. | No |
| 415 | unsupported_media_type | Unsupported Content-Type. | No |
| 429 | — (rarely upstream_rejected) | Usually your account is at its concurrency limit. No Retry-After header is sent. | Yes, with backoff |
| Other 4xx (not 429) | upstream_rejected | Rare: the request was rejected during transcription. | No |
| 500 | internal_error | Internal error. | Yes, with backoff |
| 502 | — | The service could not be reached. | Yes, with backoff |
| 503 | upstream_unavailable | The transcription service is temporarily unavailable. | Yes, with backoff |
| 503 | upstream_timeout | Processing took too long. | Yes, with backoff |
| 503 | excessive_repetition | The transcription produced unusable repeated output. | Yes, with backoff |
| 503 | diarization_failed | Speaker identification failed for this recording. | Yes, with backoff |
| 504 | — | Timed out connecting to the service. | Yes, with backoff |
- A dash means the error has no
code; a 503 without acodealso means the service is temporarily unavailable. - New
codevalues may be added; handle unknown codes by HTTP status. - Retry 429 and 5xx responses with exponential backoff. Do not retry other 4xx responses; change the request first.
- Requests that return an error response are not billed.
- With the Python SDK, the raw error body is in the exception’s
bodyattribute; parse it withjson.loadsto readcodeandrequest_id.
transcribe-1: its errors are JSON with status and message. Rely only on these two fields and on the HTTP status.
See Errors for retry and SDK exception examples.Authorizations
Headers
Body
multipart/form-dataapplication/msgpack
Response
Request fulfilled, document follows
Was this page helpful?

