All Products
Search
Document Center

Alibaba Cloud Model Studio:Non-real-time speech recognition (Fun-ASR-Flash) API reference

Last Updated:Jul 21, 2026

Call the Fun-ASR-Flash non-real-time speech recognition HTTP API to transcribe audio files. This reference covers the endpoints, request headers, body parameters, and response fields.

User guide:Non-real-time speech recognition. For information about supported audio formats, file size limits, duration limits, and other input requirements, see audio input requirements.

Important

SDK calls are not supported for this feature.

Server endpoint

Singapore

POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation

Replace {WorkspaceId} with your actual Workspace ID.

China North 2 (Beijing)

POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation

Replace {WorkspaceId} with your actual Workspace ID.

Important

Alibaba Cloud Model Studio has released workspace-specific domains for the China (Beijing) and Singapore regions. The new dedicated domains deliver superior performance and higher stability for inference requests. We recommend migrating to the new domains:

  • China (Beijing): from dashscope.aliyuncs.com to {WorkspaceId}.cn-beijing.maas.aliyuncs.com

  • Singapore: from dashscope-intl.aliyuncs.com to {WorkspaceId}.ap-southeast-1.maas.aliyuncs.com

Replace {WorkspaceId} with your actual Workspace ID. The existing domains remain fully functional.

Request headers

Parameter

Type

Required

Description

Authorization

string

Yes

Authentication token in the format Bearer <your_api_key>. Replace <your_api_key> with your actual API key.

Content-Type

string

Yes

Media type of the request body. Always application/json.

X-DashScope-SSE

string

Yes

Specifies whether results are returned as Server-Sent Events (SSE). When set to enable, the server returns intermediate and final recognition results across multiple events. When set to disable or omitted, only the final result is returned.

Request body

The following examples use the Singapore region configuration. Replace {WorkspaceId} with your actual Workspace ID. Configurations vary by region. The API key for the Singapore region is different from the API key for the Beijing region.

Non-streaming

curl --location --request POST 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \
     --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
     --header "Content-Type: application/json" \
     --header "X-DashScope-SSE: disable" \
     --data '{
    "model": "fun-asr-flash-2026-06-15",
    "input": {
        "messages": [
            {
                "role": "user",
                "content": [
                    {
                        "type": "input_audio",
                        "input_audio": {
                            "data": "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav"
                        }
                    }
                ]
            }
        ]
    },
    "parameters": {
        "format": "wav",
        "sample_rate": "16000"
    }
}'

Streaming

curl --location --request POST 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \
     --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
     --header "Content-Type: application/json" \
     --header "X-DashScope-SSE: enable" \
     --data '{
    "model": "fun-asr-flash-2026-06-15",
    "input": {
        "messages": [
            {
                "role": "user",
                "content": [
                    {
                        "type": "input_audio",
                        "input_audio": {
                            "data": "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav"
                        }
                    }
                ]
            }
        ]
    },
    "parameters": {
        "format": "wav",
        "sample_rate": "16000"
    }
}'

With context - non-streaming

curl --location --request POST 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \
     --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
     --header "Content-Type: application/json" \
     --header "X-DashScope-SSE: disable" \
     --data '{
    "model": "fun-asr-flash-2026-06-15",
    "input": {
        "messages": [
            {
                "role": "user",
                "content": [
                    {
                        "type": "input_text",
                        "text": "Hello!"
                    }
                ]
            },
            {
                "role": "assistant",
                "content": [
                    {
                        "type": "text",
                        "text": "Hello! I am Tongyi Qianwen. How can I help you?"
                    }
                ]
            },
            {
                "role": "user",
                "content": [
                    {
                        "type": "input_audio",
                        "input_audio": {
                            "data": "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav"
                        }
                    }
                ]
            }
        ]
    },
    "parameters": {
        "format": "wav",
        "sample_rate": "16000"
    }
}'

With context - streaming

curl --location --request POST 'https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation' \
     --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
     --header "Content-Type: application/json" \
     --header "X-DashScope-SSE: enable" \
     --data '{
    "model": "fun-asr-flash-2026-06-15",
    "input": {
        "messages": [
            {
                "role": "user",
                "content": [
                    {
                        "type": "input_text",
                        "text": "Hello!"
                    }
                ]
            },
            {
                "role": "assistant",
                "content": [
                    {
                        "type": "text",
                        "text": "Hello! I am Tongyi Qianwen. How can I help you?"
                    }
                ]
            },
            {
                "role": "user",
                "content": [
                    {
                        "type": "input_audio",
                        "input_audio": {
                            "data": "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav"
                        }
                    }
                ]
            }
        ]
    },
    "parameters": {
        "format": "wav",
        "sample_rate": "16000"
    }
}'

Base64

You can provide Base64-encoded data as a Data URI in the format: data:<mediatype>;base64,<data>.

  • <mediatype>: MIME type

    Varies by audio format. For example:

    • WAV: audio/wav

    • MP3: audio/mpeg

  • <data>: Base64-encoded string of the audio

    Base64 encoding increases the file size. Keep the original file small enough so that the encoded data still meets the audio input size limit (10 MB).

  • Example: data:audio/wav;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjI5LjEwMAAAAAAAAAAAAAAA//PAxABQ/BXRbMPe4IQAhl9

    Click to view sample code

    import base64, pathlib
    
    # input.mp3 is the local audio file to be recognized. Replace it with the path to your own audio file and make sure it meets the audio requirements.
    file_path = pathlib.Path("input.mp3")
    base64_str = base64.b64encode(file_path.read_bytes()).decode()
    data_uri = f"data:audio/mpeg;base64,{base64_str}"
    import java.nio.file.*;
          import java.util.Base64;
    
          public class Main {
              /**
               * filePath is the local audio file to be recognized. Replace it with the path to your own audio file and make sure it meets the audio requirements.
               */
              public static String toDataUri(String filePath) throws Exception {
                  byte[] bytes = Files.readAllBytes(Paths.get(filePath));
                  String encoded = Base64.getEncoder().encodeToString(bytes);
                  return "data:audio/mpeg;base64," + encoded;
              }
    
              public static void main(String[] args) throws Exception {
                  System.out.println(toDataUri("input.mp3"));
              }
          }
import base64, pathlib
import os
import requests

# input.wav is the local audio file to be recognized. Replace it with the path to your own audio file and make sure it meets the audio requirements.
file_path = pathlib.Path("input.wav")
base64_str = base64.b64encode(file_path.read_bytes()).decode()
data_uri = f"data:audio/wav;base64,{base64_str}"

# Replace "{WorkspaceId}" with your actual Workspace ID.
url = "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation"

headers = {
    "Authorization": f"Bearer {os.environ['DASHSCOPE_API_KEY']}",
    "Content-Type": "application/json",
    "X-DashScope-SSE": "disable",
}

payload = {
    "model": "fun-asr-flash-2026-06-15",
    "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)
print(response.status_code)
print(response.json())

model string (required)

Model name. Always fun-asr-flash-2026-06-15.

input object (required)

Contains the messages to recognize, including the audio and optional conversation context.

Properties

messages array(object) (required)

Message list. Contains the audio to be recognized and optional conversation context (used to improve recognition accuracy).

Important

Context improves recognition accuracy for domain-specific vocabulary. For usage details, see Quick start. You can include up to 5 input_text context messages and up to 5 text context messages. If you provide more, only the most recent 5 of each type are kept. In each round of context, the combined length of all text fields cannot exceed 400 characters. Excess characters are truncated from the end.

Important

When you include context, order messages by conversation round. In each round, place the user message of type input_text before the corresponding assistant message of type text. The user message that contains input_audio must be the last element in the array.

Properties

role string (required)

Message role. Valid values:

  • user (required): User message. If type is input_audio, it contains the audio to recognize. If type is input_text, it contains a previous recognition result or domain vocabulary for context.

  • assistant (optional, context): Response content from the large language model in previous rounds.

content array(object) (required)

List of message content.

Properties

type string (required)

Content type. Each request must contain at least one message of type input_audio. Valid values:

  • input_audio (required): The audio to recognize (role is user). You must also pass the input_audio object.

  • input_text (optional, context): Previous recognition result or domain vocabulary for context (role is user). You must also pass the text field.

  • text (optional, context): Response content from the large language model in previous rounds (role is assistant). You must also pass the text field.

input_audio object (conditional)

Required when type is input_audio.

Properties

data string (required)

Audio data to be recognized. For supported audio formats, file size limits, duration limits, and other input requirements, see Audio specifications. Use one of the following methods:

  • Audio file URL: Pass the URL of a publicly accessible audio file.

  • Base64 Data URI: Pass Base64-encoded audio data as a Data URI. Prefix the Base64-encoded audio data with data:{MIME_TYPE};base64,. Supported MIME types include audio/wav, audio/mpeg, and others.

Example (URL method): https://example.com/audio/sample.wav

Example (Base64 method): data:audio/wav;base64,{BASE64_ENCODED_DATA}

text string (conditional)

If type is input_text, provide the previous recognition result or domain vocabulary for context. If type is text, provide the response content from previous rounds. Text length is measured in characters. In each round of context, the combined length of all text fields cannot exceed 400 characters. Excess characters are truncated from the end.

parameters object (required)

Recognition parameters.

Properties

format string (required)

Audio format. Specify the format of the audio file. Supported formats include wav, mp3, opus, and others. For details, see Audio specifications.

sample_rate string (optional)

Audio sample rate, in Hz. For example, 16000 corresponds to a 16 kHz sample rate. For details, see Audio specifications.

Response body

Non-streaming

{
    "output": {
        "sentence": {
            "begin_time": 760,
            "channel_id": 0,
            "end_time": 3800,
            "sentence_end": true,
            "sentence_id": 1,
            "text": "Hello world, this is Alibaba Speech Lab.",
            "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": "this is"},
                {"begin_time": 1880, "end_time": 2520, "fixed": true, "punctuation": "", "text": "Alibaba"},
                {"begin_time": 2520, "end_time": 2840, "fixed": true, "punctuation": "", "text": "Speech"},
                {"begin_time": 2840, "end_time": 3800, "fixed": true, "punctuation": "。", "text": "Lab"}
            ]
        },
        "text": "Hello world, this is Alibaba Speech Lab."
    },
    "usage": {
        "duration": 4
    },
    "request_id": "40e0734d-096f-9ae3-86c1-a8c013287561"
}

Streaming

When X-DashScope-SSE: enable is set, the server returns recognition results by using the Server-Sent Events (SSE) protocol. The SSE event format is as follows:

id:{sequence_number}
      event:result
      :HTTP_STATUS/200
      data:{JSON data}

Response 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":"this is"},{"end_time":2520,"punctuation":"","begin_time":1880,"fixed":true,"text":"Alibaba"},{"end_time":2840,"punctuation":"","begin_time":2520,"fixed":true,"text":"Speech"},{"end_time":3800,"punctuation":"。","begin_time":2840,"fixed":true,"text":"Lab"}],"begin_time":760,"text":"Hello world, this is Alibaba Speech Lab","channel_id":0},"text":"Hello World, this is Alibaba Speech Lab."},"usage":{"duration":4},"request_id":"fc1582e4-935c-9fc2-a482-a98bf43daa69"}

request_id string

Unique identifier for this request.

output object

Recognition result.

Properties

text string

Cumulative recognized text.

sentence object

Detailed information about the current sentence.

Properties

sentence_id integer

Sentence ID, starting from 1.

sentence_end boolean

Indicates whether this is the final result for the sentence. When true, the sentence recognition is complete.

begin_time integer

Start time of the sentence, in milliseconds.

end_time integer

End time of the sentence, in milliseconds. Returned only when sentence_end is true.

text string

Recognized text of the current sentence.

channel_id integer

Channel ID, starting from 0.

words array

Word-level timestamps.

Properties

text string

Word text.

begin_time integer

Start time of the word, in milliseconds.

end_time integer

End time of the word, in milliseconds.

punctuation string

Punctuation after the word. Empty string if there is no punctuation.

fixed boolean

Indicates whether the word is stable. false means the timestamp of this word may be adjusted in subsequent events.

usage object

Usage information. Returned only when sentence_end is true.

Properties

duration integer

Duration of processed audio, in seconds.

SSE streaming result processing

In streaming mode, the client must do the following:

  1. For each SSE event, parse the JSON in the data field.

  2. Use output.sentence.sentence_end to determine whether the current sentence is complete. If true, sentence recognition is complete and the word-level timestamps are stable. If false, recognition is still in progress and the text and timestamps may be updated in subsequent events.

  3. usage information is returned only in sentence-end events and indicates the audio processing duration.