curl --request POST \
--url https://api.minimax.io/v1/speech_to_text \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form model=asr-1.0 \
--form file=@example-file \
--form response_format=json \
--form timestamp_level=word \
--form stream=falseimport requests
url = "https://api.minimax.io/v1/speech_to_text"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"model": "asr-1.0",
"response_format": "json",
"timestamp_level": "word",
"stream": "false"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('model', 'asr-1.0');
form.append('file', '<string>');
form.append('response_format', 'json');
form.append('timestamp_level', 'word');
form.append('stream', 'false');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.minimax.io/v1/speech_to_text', 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.minimax.io/v1/speech_to_text",
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=\"model\"\r\n\r\nasr-1.0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\njson\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"timestamp_level\"\r\n\r\nword\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\nfalse\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.minimax.io/v1/speech_to_text"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nasr-1.0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\njson\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"timestamp_level\"\r\n\r\nword\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\nfalse\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.minimax.io/v1/speech_to_text")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nasr-1.0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\njson\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"timestamp_level\"\r\n\r\nword\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\nfalse\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.minimax.io/v1/speech_to_text")
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=\"model\"\r\n\r\nasr-1.0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\njson\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"timestamp_level\"\r\n\r\nword\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\nfalse\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"text": "The merchant actually made money, because their cold chain shipping is expensive.",
"duration": 26.325,
"trace_id": "021785229015510a2c883cf675b9804d"
}Speech to Text
Use this API to transcribe an audio file into text, with support for streaming output, speaker diarization and subtitle export.
curl --request POST \
--url https://api.minimax.io/v1/speech_to_text \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form model=asr-1.0 \
--form file=@example-file \
--form response_format=json \
--form timestamp_level=word \
--form stream=falseimport requests
url = "https://api.minimax.io/v1/speech_to_text"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"model": "asr-1.0",
"response_format": "json",
"timestamp_level": "word",
"stream": "false"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('model', 'asr-1.0');
form.append('file', '<string>');
form.append('response_format', 'json');
form.append('timestamp_level', 'word');
form.append('stream', 'false');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.minimax.io/v1/speech_to_text', 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.minimax.io/v1/speech_to_text",
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=\"model\"\r\n\r\nasr-1.0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\njson\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"timestamp_level\"\r\n\r\nword\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\nfalse\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.minimax.io/v1/speech_to_text"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nasr-1.0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\njson\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"timestamp_level\"\r\n\r\nword\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\nfalse\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.minimax.io/v1/speech_to_text")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nasr-1.0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\njson\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"timestamp_level\"\r\n\r\nword\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\nfalse\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.minimax.io/v1/speech_to_text")
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=\"model\"\r\n\r\nasr-1.0\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"response_format\"\r\n\r\njson\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"timestamp_level\"\r\n\r\nword\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\nfalse\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"text": "The merchant actually made money, because their cold chain shipping is expensive.",
"duration": 26.325,
"trace_id": "021785229015510a2c883cf675b9804d"
}Authorizations
HTTP: Bearer Auth
- Security Scheme Type: http
- HTTP Authorization Scheme: Bearer API_key, used to verify account information. You can view it in Account Management > API Key.
Headers
The media type of the request body. Must be multipart/form-data.
multipart/form-data An optional BCP-47 language tag that hints at the primary spoken language. Omit this header or pass an empty value to enable mixed-language recognition.
Currently supported values: zh (Chinese), yue (Cantonese), en (English), ja (Japanese), ko (Korean), th (Thai), vi (Vietnamese), id (Indonesian), ms (Malay), fil (Filipino), ar (Arabic), tr (Turkish), fr (French), de (German), es (Spanish), it (Italian), pt (Portuguese), pl (Polish), ru (Russian), and uk (Ukrainian).
"en"
Body
The model version used for this request.
asr-1.0 "asr-1.0"
The audio file to transcribe. Provide the path to the file.
The uploaded audio file must meet the following requirements:
| Item | Constraint |
|---|---|
| Format | wav / aiff / flac / alac(m4a) / mp3 / aac / opus / ogg |
| Duration | No longer than 500 seconds. Exceeding this returns 400; the audio is never silently truncated |
| Size | No larger than 50 MB. Exceeding this returns 413 |
Raw PCM without a container is not supported.
Speech recognition does not benefit from high sample rates or stereo. Uncompressed high-specification audio easily exceeds the size limit (for example, 500 seconds of 48 kHz stereo WAV is about 92 MB). Convert to mono 16 kHz, or use a compressed format such as mp3 / aac / opus; the transcription result is unaffected.
The format of the transcription result.
| Value | Returns | Response type |
|---|---|---|
json | text + duration | application/json |
verbose_json | text + duration + segments + n_speakers (includes speaker diarization and timestamps) | application/json |
srt | SRT subtitles | text/plain |
vtt | WebVTT subtitles | text/vtt |
verbose_json / srt / vtt enable speaker diarization and forced alignment, and therefore cannot be combined with stream=true.
Response body for srt:
1
00:00:00,100 --> 00:00:01,660
Hello everyone.
2
00:00:02,000 --> 00:00:06,100
Let me check the question.
Response body for vtt:
WEBVTT
00:00:00.100 --> 00:00:01.660
Hello everyone.
00:00:02.000 --> 00:00:06.100
Let me check the question.
json, verbose_json, srt, vtt "json"
The timestamp granularity. This parameter only takes effect when response_format is verbose_json, srt, or vtt, because these formats enable speaker diarization and forced alignment.
- Empty or
sentence(default): preserves the original sentence/segment timestamps and merges adjacent text from the same speaker within the same segment. word: returns character-level timestamps for Chinese and word-level timestamps for English. Each unit still includesspeaker.
When response_format=json, including when stream=true, this parameter is accepted but ignored.
, sentence, word "word"
Whether to stream the transcription result.
false(default): the full result is returned once transcription completes.true: incremental text is pushed over SSE and the response type istext/event-stream. In this caseresponse_formatonly supportsjson.
A streaming response is pushed line by line as data: <json>, with events separated by blank lines:
data: {"index":0,"delta":"Hello","finish":false}
data: {"index":1,"delta":" everyone","finish":false}
data: {"index":2,"delta":"","finish":true,"duration":26.325}
The data field of each event is a JSON object: index is the event sequence number starting from 0, delta is the newly transcribed text for this event, finish indicates whether this is the terminating event, and duration is the audio duration in seconds (returned only in the terminating event). Clients should concatenate all delta values in index order and stop reading after receiving finish=true.
false
Response
Transcription succeeded. The fields below apply when response_format is json or verbose_json. For the response body of srt / vtt or stream=true, see the description of the corresponding request parameter.
The full transcribed text. Under verbose_json this equals the concatenation of all segments[].text in time order.
The duration of the input audio, in seconds. Billing is based on this duration.
The number of detected speakers. Returned only when response_format=verbose_json.
Timestamped transcription units, each carrying start/end times and a speaker identifier. Their granularity is controlled by timestamp_level: sentence/segment level by default, or character/word level when set to word. Returned only when response_format=verbose_json.
Show child attributes
Show child attributes
The trace ID of this request, useful for troubleshooting.