Speech to Text
curl --request POST \
--url https://api.z.ai/api/paas/v4/audio/transcriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form model=glm-asr-2512 \
--form stream=false \
--form file=@example-fileimport requests
url = "https://api.z.ai/api/paas/v4/audio/transcriptions"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"model": "glm-asr-2512",
"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', 'glm-asr-2512');
form.append('stream', 'false');
form.append('file', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.z.ai/api/paas/v4/audio/transcriptions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.z.ai/api/paas/v4/audio/transcriptions")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nglm-asr-2512\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();{
"id": "<string>",
"created": 123,
"request_id": "<string>",
"model": "<string>",
"text": "<string>"
}{
"code": 123,
"message": "<string>"
}Audio API
Audio Transcriptions
Use the GLM-ASR-2512 model to transcribe audio files into text, supporting multiple languages and real-time streaming transcription.
POST
/
paas
/
v4
/
audio
/
transcriptions
Speech to Text
curl --request POST \
--url https://api.z.ai/api/paas/v4/audio/transcriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form model=glm-asr-2512 \
--form stream=false \
--form file=@example-fileimport requests
url = "https://api.z.ai/api/paas/v4/audio/transcriptions"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"model": "glm-asr-2512",
"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', 'glm-asr-2512');
form.append('stream', 'false');
form.append('file', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.z.ai/api/paas/v4/audio/transcriptions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.z.ai/api/paas/v4/audio/transcriptions")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\nglm-asr-2512\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"stream\"\r\n\r\nfalse\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();{
"id": "<string>",
"created": 123,
"request_id": "<string>",
"model": "<string>",
"text": "<string>"
}{
"code": 123,
"message": "<string>"
}Body
multipart/form-data
This parameter should be set to false or omitted when using synchronous calls. It indicates that the model returns all content at once after generating all content. Default is false. If set to true, the model will return generated content in chunks via standard Event Stream. When the Event Stream ends, a data: [DONE] message will be returned.
Response
Request processed successfully
Was this page helpful?