Qwen Speech Recognition
This API transcribes audio files into text. Audio can be provided as a public URL or a Base64 Data URI. The response supports sentence-level and word-level timestamps, context enhancement, hotwords, and speaker diarization.
Endpoint
POST /v1/audio/transcriptionsAuthentication
| Method | Description |
|---|---|
| Bearer Token | Pass Authorization: Bearer <API Key> in the request header to authenticate your account. |
Request Headers
| Parameter | Type | Required | Description |
|---|---|---|---|
Content-Type | string | Yes | Media type of the request body. Set to application/json. |
Authorization | string | Yes | Bearer API Key used to authenticate your account. |
X-DashScope-SSE | string | No | Whether to return results as an SSE stream: enable to enable, disable to disable (default). |
Note: This API accepts JSON request bodies only.
multipart/form-datafile uploads are not supported and return a 400 error. Provide the audio via an audio URL or a Base64 Data URI.
Request Body
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | - | Model ID. See the supported model list at the end of this page. |
input | object | Yes | - | Input information. See "input Parameters". |
parameters | object | Yes | - | Model parameters. See "parameters Parameters". |
input Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
input.messages | array<object> | Yes | - | Message list containing the audio to transcribe and optional conversation context. Must contain at least one message of type input_audio. |
messages Element
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
role | string | Yes | - | Message role: user or assistant. assistant is used only for context. |
content | array<object> | Yes | - | List of message content items. |
content Element
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
type | string | Yes | - | Content type: input_audio, input_text, or text. |
input_audio | object | No | - | Required when type is input_audio. |
text | string | No | - | Required when type is input_text or text. |
input_audio Object
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
input_audio.data | string | Yes | - | Audio file URL, or a Base64 Data URI in the format data:{MIME_TYPE};base64,{BASE64_DATA}. |
parameters Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
parameters.format | string | Yes | - | Audio format. Must match the actual audio format, such as wav, mp3, or opus. |
parameters.sample_rate | string | No | - | Audio sample rate in Hz. For example, 16000 means 16 kHz. |
parameters.vocabulary_id | string | No | - | ID of a precompiled hotword list. This feature is not currently supported on the platform. Use inline hotwords (vocabulary) instead. |
parameters.vocabulary | object | No | - | Inline hotwords. Keys are hotword text and values are weights. See "Hotwords". |
parameters.language_hints | array<string> | No | - | Language codes to recognize. Up to 4 values; if more are provided, only the first 4 take effect. If omitted, the model detects the language automatically. |
parameters.speaker_diarization_enabled | boolean | No | false | Whether to enable speaker diarization. Only supported by qwen-audio-3.1-asr-flash. When enabled, speakers are distinguished by speaker_id and output.sentences is returned; keep_dialect and language_hints do not take effect in this mode. |
parameters.keep_dialect | boolean | No | false | Whether to keep dialect expressions. Only supported by qwen-audio-3.1-asr-flash. When false, dialect is transcribed as Mandarin. |
Audio Input Requirements
- A single audio file must not exceed 10 MB or 5 minutes.
- Audio can be provided as a publicly accessible audio URL or a Base64 Data URI.
- The Base64 Data URI format is
data:{MIME_TYPE};base64,{BASE64_DATA}. The MIME type must match the audio format, for exampleaudio/wavfor WAV andaudio/mpegfor MP3. - Base64 encoding increases the payload size. Keep the original file small enough that the encoded data still meets the 10 MB input limit.
- Formats such as
wav,mp3, andopusare supported. The actual supported range is subject to the model audio specification.
Context Enhancement
Context fields improve recognition accuracy for domain-specific terms. You can pass previous conversation turns:
- At most 5 context messages of each type (
input_textandtext). If more are provided, only the most recent 5 are kept. - The total context text length per turn (the sum of the
textfields ofuserandassistant) must not exceed 400 characters. Excess content is truncated from the end. - Messages must be arranged in conversation turns: within each turn,
user(input_text) must precede the correspondingassistant(text). Theusermessage containinginput_audiomust be the last item in themessagesarray.
Hotwords
Note: The platform currently supports inline hotwords (
vocabulary) but does not support precompiled hotwords (vocabulary_id).
vocabulary_id: ID of a precompiled hotword list. This feature is not currently supported on the platform. Use inline hotwords (vocabulary) instead.vocabulary: Inline hotwords passed as key-value pairs. No precompiled list is required. Suitable for temporary, session-level optimization.- A weight in
[1, 5]means the model is more likely to output the term as the value increases. A weight of50marks a super hotword with significantly improved recall. At most 50 super hotwords are allowed. - When both hotword types are configured, they are merged. If the merged count exceeds 2000, 2000 are selected at random. Since the platform does not currently support precompiled hotwords, only inline hotwords take effect in practice.
- Inline hotwords are supported only by
qwen-audio-3.1-asr-flashandqwen-audio-3.0-asr-flash.
Supported Language Codes
| Code | Language | Code | Language | Code | Language |
|---|---|---|---|---|---|
zh | Chinese | en | English | ja | Japanese |
ko | Korean | vi | Vietnamese | th | Thai |
id | Indonesian | ms | Malay | tl | Filipino |
hi | Hindi | ar | Arabic | fr | French |
de | German | es | Spanish | pt | Portuguese |
ru | Russian | it | Italian | nl | Dutch |
sv | Swedish | da | Danish | fi | Finnish |
no | Norwegian | el | Greek | pl | Polish |
cs | Czech | hu | Hungarian | ro | Romanian |
bg | Bulgarian | hr | Croatian | sk | Slovak |
Model Differences
| Model | Speaker Diarization | Keep Dialect | Inline Hotwords | Usage Fields |
|---|---|---|---|---|
qwen-audio-3.1-asr-flash | Supported | Supported | Supported | usage.duration, usage.input_tokens, usage.output_tokens, usage.total_tokens |
qwen-audio-3.0-asr-flash | Not supported | Not supported | Supported | usage.duration |
Request Example
curl --location --request POST 'https://neolink.com/api/v1/audio/transcriptions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API Key>' \
--data-raw '{
"model": "qwen-audio-3.0-asr-flash",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"type": "input_audio",
"input_audio": {
"data": "https://example.com/audio/sample.wav"
}
}
]
}
]
},
"parameters": {
"format": "wav",
"sample_rate": "16000"
}
}'import requests
url = "https://neolink.com/api/v1/audio/transcriptions"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <API Key>",
}
payload = {
"model": "qwen-audio-3.0-asr-flash",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"type": "input_audio",
"input_audio": {
"data": "https://example.com/audio/sample.wav"
}
}
]
}
]
},
"parameters": {
"format": "wav",
"sample_rate": "16000"
}
}
response = requests.post(url, headers=headers, json=payload, timeout=60)
print(response.json())import https from 'https'
const data = JSON.stringify({
model: 'qwen-audio-3.0-asr-flash',
input: {
messages: [
{
role: 'user',
content: [
{
type: 'input_audio',
input_audio: {
data: 'https://example.com/audio/sample.wav'
}
}
]
}
]
},
parameters: {
format: 'wav',
sample_rate: '16000'
}
})
const req = https.request('https://neolink.com/api/v1/audio/transcriptions', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer <API Key>',
'Content-Length': Buffer.byteLength(data)
}
}, res => {
let body = ''
res.on('data', chunk => body += chunk)
res.on('end', () => console.log(JSON.parse(body)))
})
req.write(data)
req.end()Streaming
Set X-DashScope-SSE: enable in the request header to enable streaming.
curl --location --request POST 'https://neolink.com/api/v1/audio/transcriptions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API Key>' \
--header 'X-DashScope-SSE: enable' \
--data-raw '{
"model": "qwen-audio-3.0-asr-flash",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"type": "input_audio",
"input_audio": {
"data": "https://example.com/audio/sample.wav"
}
}
]
}
]
},
"parameters": {
"format": "wav",
"sample_rate": "16000"
}
}'import requests
url = "https://neolink.com/api/v1/audio/transcriptions"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <API Key>",
"X-DashScope-SSE": "enable",
}
payload = {
"model": "qwen-audio-3.0-asr-flash",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"type": "input_audio",
"input_audio": {
"data": "https://example.com/audio/sample.wav"
}
}
]
}
]
},
"parameters": {
"format": "wav",
"sample_rate": "16000"
}
}
with requests.post(url, headers=headers, json=payload, stream=True, timeout=300) as response:
for raw_line in response.iter_lines():
if not raw_line:
continue
line = raw_line.decode("utf-8")
if not line.startswith("data:"):
continue
print(line[len("data:"):].strip())Using Base64 Audio
import base64
import pathlib
import requests
audio_path = pathlib.Path("sample.wav")
data_uri = "data:audio/wav;base64," + base64.b64encode(audio_path.read_bytes()).decode()
url = "https://neolink.com/api/v1/audio/transcriptions"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <API Key>",
}
payload = {
"model": "qwen-audio-3.0-asr-flash",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"type": "input_audio",
"input_audio": {"data": data_uri}
}
]
}
]
},
"parameters": {
"format": "wav",
"sample_rate": "16000"
}
}
response = requests.post(url, headers=headers, json=payload, timeout=60)
print(response.json())Context Enhancement Example
curl --location --request POST 'https://neolink.com/api/v1/audio/transcriptions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API Key>' \
--data-raw '{
"model": "qwen-audio-3.0-asr-flash",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"type": "input_text",
"text": "Hello"
}
]
},
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello, I am Qwen. How can I help you?"
}
]
},
{
"role": "user",
"content": [
{
"type": "input_audio",
"input_audio": {
"data": "https://example.com/audio/sample.wav"
}
}
]
}
]
},
"parameters": {
"format": "wav",
"sample_rate": "16000"
}
}'Inline Hotwords Example
curl --location --request POST 'https://neolink.com/api/v1/audio/transcriptions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <API Key>' \
--data-raw '{
"model": "qwen-audio-3.0-asr-flash",
"input": {
"messages": [
{
"role": "user",
"content": [
{
"type": "input_audio",
"input_audio": {
"data": "https://example.com/audio/sample.wav"
}
}
]
}
]
},
"parameters": {
"format": "wav",
"sample_rate": "16000",
"vocabulary": {
"Alice": 5,
"Bob": 5
}
}
}'Response Body
| Parameter | Type | Description |
|---|---|---|
request_id | string | Unique identifier of the request |
output.text | string | Complete transcription text accumulated so far |
output.sentence | object | Details of the current sentence |
output.sentence.speaker_id | integer / null | Speaker ID. Returned only when qwen-audio-3.1-asr-flash has speaker diarization enabled; otherwise null. |
output.sentence.sentence_id | integer | Sentence ID, starting from 1 |
output.sentence.sentence_end | boolean | Whether this is the final result for the sentence. true means the sentence is complete. |
output.sentence.begin_time | integer | Sentence start time in milliseconds |
output.sentence.end_time | integer | Sentence end time in milliseconds. Returned only when sentence_end is true. |
output.sentence.text | string | Transcription text of the current sentence |
output.sentence.channel_id | integer | Channel ID, starting from 0 |
output.sentence.words | array<object> | Word-level timestamp list |
output.sentence.words[].speaker_id | integer / null | Speaker ID of the word. Returned only when qwen-audio-3.1-asr-flash has speaker diarization enabled; otherwise null. |
output.sentence.words[].text | string | Word text |
output.sentence.words[].begin_time | integer | Word start time in milliseconds |
output.sentence.words[].end_time | integer | Word end time in milliseconds |
output.sentence.words[].punctuation | string | Punctuation following the word. Empty string if there is none. |
output.sentence.words[].fixed | boolean | Whether the word is stable. false means the timestamp may change in subsequent events. |
output.sentences | array<object> | Current and historical sentence results. Each element has the same structure as output.sentence. Returned only when qwen-audio-3.1-asr-flash has speaker diarization enabled. |
usage.duration | integer | Processed audio duration in seconds. Returned only when sentence_end is true. |
usage.input_tokens | integer | Input tokens consumed by this request. Returned only by qwen-audio-3.1-asr-flash. |
usage.output_tokens | integer | Output tokens consumed by this request. Returned only by qwen-audio-3.1-asr-flash. |
usage.total_tokens | integer | Total tokens consumed, equal to input_tokens plus output_tokens. Returned only by qwen-audio-3.1-asr-flash. |
Response Example
{
"output": {
"sentence": {
"begin_time": 760,
"channel_id": 0,
"end_time": 3800,
"sentence_end": true,
"sentence_id": 1,
"text": "Hello World,这里是阿里巴巴语音实验室。",
"words": [
{
"begin_time": 760,
"end_time": 1040,
"fixed": true,
"punctuation": "",
"text": "Hello"
},
{
"begin_time": 1040,
"end_time": 1240,
"fixed": true,
"punctuation": ",",
"text": " World"
},
{
"begin_time": 1360,
"end_time": 1880,
"fixed": true,
"punctuation": "",
"text": "这里是"
},
{
"begin_time": 1880,
"end_time": 2520,
"fixed": true,
"punctuation": "",
"text": "阿里巴巴"
},
{
"begin_time": 2520,
"end_time": 2840,
"fixed": true,
"punctuation": "",
"text": "语音"
},
{
"begin_time": 2840,
"end_time": 3800,
"fixed": true,
"punctuation": "。",
"text": "实验室"
}
]
},
"text": "Hello World,这里是阿里巴巴语音实验室。"
},
"usage": {
"duration": 4
},
"request_id": "40e0734d-096f-9ae3-86c1-a8c013287561"
}Note: Some upstream versions may nest sentence information under
output.output.sentence. Regardless of the structure, the complete transcription text is always available inoutput.text.
Streaming Response
When X-DashScope-SSE: enable is set in the request header, the server returns recognition results over Server-Sent Events (SSE). Intermediate and final results are returned in multiple events only when the audio is at least 1 minute long.
Upstream SSE event format:
id:{sequence number}
event:result
:HTTP_STATUS/200
data:{JSON data}Upstream example:
id:1
event:result
:HTTP_STATUS/200
data:{"output":{"sentence":{"sentence_id":1,"sentence_end":true,"end_time":3800,"words":[{"end_time":1040,"punctuation":"","begin_time":760,"fixed":true,"text":"Hello"},{"end_time":1240,"punctuation":",","begin_time":1040,"fixed":true,"text":" World"},{"end_time":1880,"punctuation":"","begin_time":1360,"fixed":true,"text":"这里是"},{"end_time":2520,"punctuation":"","begin_time":1880,"fixed":true,"text":"阿里巴巴"},{"end_time":2840,"punctuation":"","begin_time":2520,"fixed":true,"text":"语音"},{"end_time":3800,"punctuation":"。","begin_time":2840,"fixed":true,"text":"实验室"}],"begin_time":760,"text":"Hello World,这里是阿里巴巴语音实验室。","channel_id":0},"text":"Hello World,这里是阿里巴巴语音实验室。"},"usage":{"duration":4},"request_id":"fc1582e4-935c-9fc2-a482-a98bf43daa69"}When forwarded through the gateway, control lines such as
idandeventare filtered out. Clients only need to parse the JSON in eachdata:line.
Processing notes:
- For each SSE event, parse the JSON in the
datafield. - Use
output.sentence.sentence_endto determine whether the current sentence is complete:truemeans the sentence is finished and word-level timestamps are stable, so it can be used as the final result;falsemeans recognition is still in progress and the text and timestamps may be updated in subsequent events. usageis returned only in sentence-end events and can be used to measure the processed audio duration.- When
qwen-audio-3.1-asr-flashhas speaker diarization enabled, readoutput.sentencesfor current and historical sentence results.
Supported Models
Supported Models:
- qwen-audio-3.1-asr-flash
- qwen-audio-3.0-asr-flash
