> ## Documentation Index
> Fetch the complete documentation index at: https://docs.modelstudio.console.alibabacloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Non-real-time speech recognition (Fun-ASR-Flash) HTTP API

> This topic describes the parameters and interface details of the Fun-ASR-Flash non-real-time speech recognition HTTP API.

For input requirements such as supported audio formats, file size limits, and duration limits, see [Audio specifications](/en/model-studio/asr-model#asr_audio_spec02).

## Service endpoints <span id="h-fl-url" />

<Tabs>
  <Tab title="Singapore">
    `POST https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation`

    Replace `{WorkspaceId}` with your actual [Workspace ID](/en/model-studio/regions#h2_migrate_domain).
  </Tab>

  <Tab title="China (Beijing)">
    `POST https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation`

    Replace `{WorkspaceId}` with your actual [Workspace ID](/en/model-studio/regions#h2_migrate_domain).
  </Tab>
</Tabs>

<Tip>
  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`
</Tip>

## Request headers <span id="h-fl-hd" />

<table style={{ display: "table", tableLayout: "fixed", width: "100%", overflowWrap: "anywhere" }}>
  <colgroup>
    <col style={{ width: "24.97%" }} />

    <col style={{ width: "8.55%" }} />

    <col style={{ width: "10.35%" }} />

    <col style={{ width: "56.13%" }} />
  </colgroup>

  <thead>
    <tr>
      <th style={{ verticalAlign: "top" }}>
        <strong>Parameter</strong>
      </th>

      <th style={{ verticalAlign: "top" }}>
        <strong>Type</strong>
      </th>

      <th style={{ verticalAlign: "top" }}>
        <strong>Required</strong>
      </th>

      <th style={{ verticalAlign: "top" }}>
        <strong>Description</strong>
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td style={{ verticalAlign: "top" }}>
        `Authorization`
      </td>

      <td style={{ verticalAlign: "top" }}>
        `string`
      </td>

      <td style={{ verticalAlign: "top" }}>
        Yes
      </td>

      <td style={{ verticalAlign: "top" }}>
        The authentication token, in the format <code>Bearer \<your\_api\_key></code>. Replace "<code>\<your\_api\_key></code>" with your actual API key.
      </td>
    </tr>

    <tr>
      <td style={{ verticalAlign: "top" }}>
        `Content-Type`
      </td>

      <td style={{ verticalAlign: "top" }}>
        `string`
      </td>

      <td style={{ verticalAlign: "top" }}>
        Yes
      </td>

      <td style={{ verticalAlign: "top" }}>
        The media type of the request body. Fixed to <code>application/json</code>.
      </td>
    </tr>

    <tr>
      <td style={{ verticalAlign: "top" }}>
        `X-DashScope-SSE`
      </td>

      <td style={{ verticalAlign: "top" }}>
        `string`
      </td>

      <td style={{ verticalAlign: "top" }}>
        No
      </td>

      <td style={{ verticalAlign: "top" }}>
        Controls whether results are returned as an SSE stream. Set to <code>enable</code> to turn on SSE streaming. The server returns intermediate and final recognition results in multiple messages only for audio that is at least 1 minute long. Set to <code>disable</code> or omit the parameter to return only the final result.
      </td>
    </tr>
  </tbody>
</table>

<table bordertype="no-border" style={{ display: "table", tableLayout: "fixed", width: "100%", overflowWrap: "anywhere" }}>
  <colgroup>
    <col style={{ width: "50%" }} />

    <col style={{ width: "50%" }} />
  </colgroup>

  <tbody>
    <tr>
      <td style={{ verticalAlign: "top" }}>
        ## Request body <span id="h-fl-rq" />

        <strong>model</strong>`string`<strong>(Required)</strong>

        The model name.

        <strong>input</strong>`object`<strong>(Required)</strong>

        The input information.

        <Accordion title="Properties" defaultOpen>
          <strong>messages</strong>`array(object)`<strong>(Required)</strong>

          The message list. It contains the audio to recognize and, optionally, conversation context that improves recognition accuracy.

          <Tip>
            The context feature improves the recognition accuracy of domain-specific terms. For usage, see [Context enhancement](/en/model-studio/improve-asr-accuracy#ctx_enhance_h2).

            A request can include at most 5 context messages of each type (`input_text` and `text`). If you exceed this limit, only the 5 most recent messages are kept. The total context text per turn (the combined length of the `text` fields in the `user` and `assistant` messages) cannot exceed 400 characters, where each character counts as 1. Any excess is truncated from the end.
          </Tip>

          <Tip>
            When you include context, the message order in `messages` matters: context messages must be arranged by conversation turn. Within each turn, the `user` message (of type `input_text`) must come before the corresponding `assistant` message (of type `text`). The `user` message that contains `input_audio` must be the last item in the `messages` array.
          </Tip>

          <Accordion title="Properties" defaultOpen>
            <strong>role</strong>`string`<strong>(Required)</strong>

            The message role. Valid values:

            - `user` (Required): A user message. When type is `input_audio`, it holds the audio to recognize. When type is `input_text`, it holds recognition results from previous turns or a domain-specific word list (optional, used as context).
            - `assistant` (Optional, context): Replies from the large language model in previous turns.

            <strong>content</strong>`array(object)`<strong>(Required)</strong>

            The message content list.

            <Accordion title="Properties" defaultOpen>
              <strong>type</strong>`string`<strong>(Required)</strong>

              The content type. Each request needs at least one message of type `input_audio`. Valid values:

              - `input_audio` (Required): The audio input to recognize (role is user). You must also pass the `input_audio` object.
              - `input_text` (Optional, context): Recognition results of the user's speech from previous turns, or a domain-specific word list (role is user). You must also pass the `text` field.
              - `text` (Optional, context): Replies from the large language model in previous turns (role is assistant). You must also pass the `text` field.

              <strong>input\_audio</strong>`object`<strong>(Conditionally required)</strong>

              Required when `type` is `input_audio`.

              <Accordion title="Properties" defaultOpen>
                <strong>data</strong>`string`<strong>(Required)</strong>

                The audio data to recognize. For input requirements such as supported audio formats, file size limits, and duration limits, see [Audio specifications](/en/model-studio/asr-model#asr_audio_spec02). Two methods are supported:

                - <strong>Audio file URL</strong>: Pass a publicly accessible URL to the audio file.
                - <strong>Base64 Data URI</strong>: Pass the Base64-encoded audio data as a Data URI. The value is the `data:{MIME_TYPE};base64,` prefix concatenated with the Base64-encoded audio data. Supported MIME types include `audio/wav` and `audio/mp3`.

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

                Example (Base64): `data:audio/wav;base64,{BASE64_ENCODED_DATA}`
              </Accordion>

              <strong>text</strong>`string`<strong>(Conditionally required)</strong>

              When `type` is `input_text`, enter the recognition results of the user's speech from previous turns or a domain-specific word list. When `type` is `text`, enter the large language model's replies from previous turns. Text length is measured in characters, where each character counts as 1. The combined length of the `text` fields across all messages in a single context turn cannot exceed 400 characters. Any excess is truncated from the end.
            </Accordion>
          </Accordion>
        </Accordion>

        <strong>parameters</strong>`object`<strong>(Required)</strong>

        The model parameters.

        <Note>
          Text polishing is disabled by default and is not yet available.

          Text polishing: While transcribing speech, the model removes meaningless filler words and stuttered repetitions, handles self-corrections, smooths out colloquial expressions, and standardizes punctuation and text formatting. The output is more concise, fluent, and readable while preserving the speaker’s final intent and key information as much as possible.
        </Note>

        <Accordion title="Properties" defaultOpen>
          <strong>format</strong>`string`<strong>(Required)</strong>

          The audio format. Set this to match your actual audio format. Supported values include `wav`, `mp3`, and `opus`. For details, see [Audio specifications](/en/model-studio/asr-model#asr_audio_spec02).

          <strong>sample\_rate</strong>`string`(Optional)

          The audio sample rate, in Hz. For example, `16000` means a 16 kHz sample rate. For details, see [Audio specifications](/en/model-studio/asr-model#asr_audio_spec02).

          <strong>vocabulary\_id</strong>`string`(Optional)

          The ID of a precompiled hot word list.

          Generate this ID in advance by calling the create hot word list API. Pass the ID during recognition to use the hot words in the list.

          Suitable for scenarios where the vocabulary is known and relatively stable, and where you need to reuse the same word list across requests.

          For usage details, see [Precompiled hotwords](/en/model-studio/improve-asr-accuracy#hw_precompiled_h3).

          <strong>language\_hints</strong> `array[string]`(Optional)

          The language codes to recognize. If the language is unknown in advance, omit this parameter to let the model detect it automatically. You can set up to 1 value. If you set more, only the first 1 take effect.

          <Accordion title="Supported language codes">
            - 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
          </Accordion>
        </Accordion>
      </td>

      <td style={{ verticalAlign: "top" }}>
        The following examples use the configuration for the Singapore region. Replace "\{WorkspaceId}" with your actual workspace ID. The configuration differs across regions, and the API key for the Singapore region differs from the one for the Beijing region.

        <Tabs>
          <Tab title="Non-streaming">
            ```bash expandable
            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": "{YOUR_AUDIO_URL}"
                                    }
                                }
                            ]
                        }
                    ]
                },
                "parameters": {
                    "format": "wav",
                    "sample_rate": "16000"
                }
            }'
            ```
          </Tab>

          <Tab title="Streaming">
            ```bash expandable
            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": "{YOUR_AUDIO_URL}"
                                    }
                                }
                            ]
                        }
                    ]
                },
                "parameters": {
                    "format": "wav",
                    "sample_rate": "16000"
                }
            }'
            ```
          </Tab>

          <Tab title="With context - non-streaming">
            ```bash expandable
            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 @- <<'JSON'
            {
                "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'm Qwen. How can I help you?"
                                }
                            ]
                        },
                        {
                            "role": "user",
                            "content": [
                                {
                                    "type": "input_audio",
                                    "input_audio": {
                                        "data": "{YOUR_AUDIO_URL}"
                                    }
                                }
                            ]
                        }
                    ]
                },
                "parameters": {
                    "format": "wav",
                    "sample_rate": "16000"
                }
            }
            JSON
            ```
          </Tab>

          <Tab title="With context - streaming">
            ```bash expandable
            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 @- <<'JSON'
            {
                "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'm Qwen. How can I help you?"
                                }
                            ]
                        },
                        {
                            "role": "user",
                            "content": [
                                {
                                    "type": "input_audio",
                                    "input_audio": {
                                        "data": "{YOUR_AUDIO_URL}"
                                    }
                                }
                            ]
                        }
                    ]
                },
                "parameters": {
                    "format": "wav",
                    "sample_rate": "16000"
                }
            }
            JSON
            ```
          </Tab>

          <Tab title="Base64">
            You can pass Base64-encoded data ([Data URL](https://www.rfc-editor.org/rfc/rfc2397)) in the format `data:<mediatype>;base64,<data>`.

            - `<mediatype>`: The MIME type.

              The value depends on the audio format. For example:

              - WAV: `audio/wav`
              - MP3: `audio/mpeg`
            - `<data>`: The Base64-encoded string of the audio.

              Base64 encoding increases the data size. For audio file size and duration limits, see [Audio specifications](/en/model-studio/asr-model#asr_audio_spec02).
            - Example: `data:audio/wav;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4LjI5LjEwMAAAAAAAAAAAAAAA//PAxABQ/BXRbMPe4IQAhl9`

              <CodeGroup dropdown>
                ```python
                import base64, pathlib

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

                ```java expandable
                import java.nio.file.*;
                      import java.util.Base64;

                      public class Main {
                          /**
                           * Replace with the path to your own audio file and make sure it meets the audio requirements
                           */
                          public static String toDataUrl(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(toDataUrl("{YOUR_AUDIO_FILE}"));
                          }
                      }
                ```
              </CodeGroup>

            ```python expandable
            import base64, pathlib
            import os
            import requests

            # Replace with the path to your own audio file and make sure it meets the audio requirements
            file_path = pathlib.Path("{YOUR_AUDIO_FILE}")
            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())
            ```
          </Tab>
        </Tabs>
      </td>
    </tr>
  </tbody>
</table>

<table bordertype="no-border" style={{ display: "table", tableLayout: "fixed", width: "100%", overflowWrap: "anywhere" }}>
  <colgroup>
    <col style={{ width: "50%" }} />

    <col style={{ width: "50%" }} />
  </colgroup>

  <tbody>
    <tr>
      <td style={{ verticalAlign: "top" }}>
        ## Response body <span id="h-fl-rs" />

        <strong>request\_id</strong>`string`

        The unique identifier of this request.

        <strong>output</strong>`object`

        The output result.

        <Accordion title="Properties" defaultOpen>
          <strong>text</strong>`string`

          The full recognized text accumulated so far.

          <strong>sentence</strong>`object`

          The details of the current sentence.

          <Accordion title="Properties" defaultOpen>
            <strong>sentence\_id</strong>`integer`

            The sentence number, starting from 1.

            <strong>sentence\_end</strong>`boolean`

            Whether this is the final result for the sentence. `true` indicates that recognition of the sentence is complete.

            <strong>begin\_time</strong>`integer`

            The start time of the sentence, in milliseconds.

            <strong>end\_time</strong>`integer`

            The end time of the sentence, in milliseconds. Returned only when `sentence_end` is `true`.

            <strong>text</strong>`string`

            The recognized text of the current sentence.

            <strong>channel\_id</strong>`integer`

            The channel number, starting from 0.

            <strong>words</strong>`array`

            The list of word-level timestamps.

            <Accordion title="Properties">
              <strong>text</strong>`string`

              The word text.

              <strong>begin\_time</strong>`integer`

              The start time of the word, in milliseconds.

              <strong>end\_time</strong>`integer`

              The end time of the word, in milliseconds.

              <strong>punctuation</strong>`string`

              The punctuation mark after the word. An empty string when there is no punctuation.

              <strong>fixed</strong>`boolean`

              Whether the word is stabilized. `false` indicates that the word's timestamp may be adjusted in subsequent events.
            </Accordion>
          </Accordion>
        </Accordion>

        <strong>usage</strong>`object`

        The usage information. Returned only when `sentence_end` is `true`.

        <Accordion title="Properties">
          <strong>duration</strong>`integer`

          The processed audio duration, in seconds.
        </Accordion>
      </td>

      <td style={{ verticalAlign: "top" }}>
        <Tabs>
          <Tab title="Non-streaming">
            ```json expandable
            {
                "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"
            }
            ```
          </Tab>

          <Tab title="Streaming">
            The SSE streaming response uses the following event format:

            ```plaintext
            id:{sequence_number}
                  event:result
                  :HTTP_STATUS/200
                  data:{JSON_data}
            ```

            Example response:

            ```plaintext
            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"}
            ```
          </Tab>
        </Tabs>
      </td>
    </tr>
  </tbody>
</table>

## SSE streaming result processing logic <span id="h-fl-stream-logic" />

In streaming mode, the client needs to handle the following:

1. For each SSE event received, parse the JSON in the `data` field.
2. Use `output.sentence.sentence_end` to determine whether the current sentence has ended. When it is `true`, recognition is complete, the word-level timestamps are stabilized, and the result can be used as final. When it is `false`, recognition is still in progress, and text and timestamps may be updated in subsequent events.
3. The `usage` information is returned only in sentence-end events and includes the processed audio duration.
