Skip to content

ASR)-RESTful API

The parameters and API details of the Fun-ASR RESTful API for audio file recognition. User guide: For more information about models and selection suggestions, see Audio file recognition - Fun-ASR/Paraformer.

The service provides a task submission API and a task query API. Submit a task and then poll the query API until the task is complete.

Prerequisites

You have activated the Model Studio and created an API key. Export it as an environment variable (not hard-coded) to prevent security risks. Note

For temporary access or strict control over high-risk operations (accessing/deleting sensitive data), use a temporary authentication token instead.

Compared with long-term API keys, temporary tokens are more secure (60-second lifespan) and reduce API key leakage risk.

To use a temporary token, replace the API key used for authentication in your code with the temporary authentication token.

Model availability

See Supported models.

Limitations

The input must be a publicly accessible file URL (HTTP/HTTPS), for example, https://your-domain.com/file.mp3. Local files and Base64 audio are not supported. When using the SDK to access a file stored in OSS, you cannot use a temporary URL with the oss:// prefix.

When using the RESTful API to access a file stored in OSS, you can use a temporary URL with the oss:// prefix: Important

  • The temporary URL is valid for 48 hours and cannot be used after it expires. Do not use it in a production environment.

  • The API for obtaining an upload credential is limited to 100 QPS and does not support scaling out. Do not use it in production environments, high-concurrency scenarios, or stress testing scenarios.

  • For production environments, use a stable storage service such as OSS to ensure long-term file availability and avoid rate limiting issues.

Specify the URL using the file_urls parameter. A single request supports up to 100 URLs.

  • Audio formats

    aac, amr, avi, flac, flv, m4a, mkv, mov, mp3, mp4, mpeg, ogg, opus, wav, webm, wma, wmvImportant

    Because many audio and video formats and their variants exist, it is not technically feasible to test all of them. The API cannot guarantee that all formats can be correctly recognized. You should test your files to verify that you can obtain the expected speech recognition results.

  • Audio sample rate: Any

  • Audio file size and duration

    The maximum file size is 2 GB. The maximum duration is 12 hours. If speaker diarization is enabled, keep the audio duration under 2 hours. For files exceeding these limits, split or compress the file before uploading. For more information about best practices for file pre-processing, see Preprocess video files to improve file transcription efficiency (for audio file recognition scenarios).

  • Number of audio files for batch processing

    A single request supports up to 100 file URLs.

  • Recognizable languages: fun-asr supports Chinese and English. fun-asr-mtl-2025-08-25 supports Chinese, Cantonese, English, Japanese, Thai, Vietnamese, and Indonesian.

  • API call method limits

    You cannot call the API directly from the frontend. Use a backend proxy instead.

Task submission API

Basic information

**Description**   Submits a speech recognition task.         **URL**

The following is the URL for the Singapore region. If you use a model in the Beijing region, replace the URL with: https://dashscope.aliyuncs.com/api/v1/services/audio/asr/transcription.

http
https://dashscope-intl.aliyuncs.com/api/v1/services/audio/asr/transcription
 **Request method**   POST     **Request headers**
http
Authorization: Bearer {api-key} // Replace this with your API key
Content-Type: application/json
X-DashScope-Async: enable // Do not omit this header. Otherwise, the task cannot be submitted.
**Message body**   The following message body contains all request parameters. You can omit optional fields as needed:
json
{
 "model":"fun-asr", // The model name. Required.
 "input":{
 "file_urls":\[
 "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav",
 "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_male2.wav"
 \] // The files to be recognized. Required.
 },
 "parameters":{
 "channel_id":\[
 0
 \], // The audio track index. Optional.
 "special_word_filter": "xxx", // Sensitive words. Optional.
 "diarization_enabled":false, // Automatic speaker diarization. Optional.
 "speaker_count": 2 // The reference number of speakers. Optional.
 }
}

Request parameters

Click to view a request sample The following is a cURL sample for calling the task submission API:

HELPCODEESCAPE-curl

# The following is the URL for the Singapore region. If you use a model in the Beijing region, replace the URL with: https://dashscope.aliyuncs.com/api/v1/services/audio/asr/transcription
# The API keys for the Singapore and Beijing regions are different. To get an API key, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
# === Delete this comment before execution ===

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/services/audio/asr/transcription' \
     --header "Authorization: Bearer $DASHSCOPE_API_KEY" \
     --header "Content-Type: application/json" \
     --header "X-DashScope-Async: enable" \
     --data '{"model":"fun-asr","input":{"file_urls":["https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav",
              "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_male2.wav"]},"parameters":{"channel_id":[0]}​}'
**Parameter**   **Type**   **Default value**   **Required**   **Description**            model   string   -   Yes   The model name for audio and video file transcription. See Model availability.     file_urls   array\[string\]   -   Yes   Audio and video file URLs (HTTP/HTTPS). Up to 100 URLs per request.

If your audio files are stored in OSS, the RESTful API supports temporary URLs that start with the oss:// prefix.

**

**Important **

  • The temporary URL is valid for 48 hours and cannot be used after it expires. Do not use it in a production environment.

  • The API for obtaining an upload credential is limited to 100 QPS and does not support scaling out. Do not use it in production environments, high-concurrency scenarios, or stress testing scenarios.

  • For production environments, use a stable storage service such as OSS to ensure long-term file availability and avoid rate limiting issues.

    vocabulary_id string - No The hotword ID. Hotwords corresponding to this ID take effect in the recognition task. Disabled by default. See Custom hotwords. channel_id array[integer] [0] No Indexes of sound channels to recognize in a multi-channel audio file. The index starts from 0. For example, [0] recognizes the first channel, and [0, 1] recognizes the first and second channels. If omitted, the first channel is processed by default.

**

**Important ** Each specified sound channel is billed separately. For example, a request for [0, 1] for a single file incurs two separate charges.

 special_word_filter   string   -   No

Specifies the sensitive words to be processed during speech recognition and supports different processing methods for different sensitive words. If this parameter is not passed, the system's built-in sensitive word filtering logic is enabled. Words in the recognition result that match the Alibaba Cloud Model Studio sensitive word list are replaced with asterisks (*) of the same length. If this parameter is passed, the following sensitive word processing policies can be implemented:

  • Replace with *: Replaces the matched sensitive word with asterisks (*) of the same length.
  • Filter out: Completely removes the matched sensitive word from the recognition result. The value of this parameter must be a JSON string with the following structure:
json
{
 "filter_with_signed": {
 "word_list": \["test"\]
 },
 "filter_with_empty": {
 "word_list": \["start", "happen"\]
 },
 "system_reserved_filter": true
}

JSON field descriptions:

  • filter_with_signed <li> Type: object.

  • Required: No.

  • Description: Configures the list of sensitive words to be replaced with *. Matched words in the recognition result are replaced with asterisks (*) of the same length.

  • Example: Based on the JSON example, the speech recognition result for "Help me <u>test</u> this piece of code" will be "Help me <u>****</u> this piece of code".

  • Internal field: <li> word_list: A string array that lists the sensitive words to be replaced. </li> </li>

  • filter_with_empty <li> Type: object.

  • Required: No.

  • Description: Configures the list of sensitive words to be removed (filtered) from the recognition result. Matched words in the recognition result are completely deleted.

  • Example: Based on the JSON example, the speech recognition result for "Is the game about to <u>start</u>?" will be "Is the game about to?".

  • Internal field: <li> word_list: A string array that lists the sensitive words to be completely removed (filtered). </li> </li>

  • system_reserved_filter <li> Type: Boolean value.

  • Required: No.

  • Default value: true.

  • Description: Specifies whether to enable the system's preset sensitive word rules. If set to true, the system's built-in sensitive word filtering logic is also enabled. Words in the recognition result that match the Alibaba Cloud Model Studio sensitive word list are replaced with asterisks (*) of the same length. </li>

    diarization_enabled boolean false No Automatic speaker diarization is disabled by default. This feature applies to single-channel audio only (not supported for multi-channel audio). When enabled, recognition results include the speaker_id field to distinguish speakers.

**

**Note ** If speaker diarization is enabled, keep the audio duration under 2 hours. Audio exceeding 2 hours may cause recognition failures or timeouts.

For an example of speaker_id, see Description of recognition results. speaker_count integer - No A reference speaker count (integer from 2 to 100). This parameter only takes effect when diarization_enabled is true. By default, speaker count is auto-detected. This parameter helps the algorithm but doesn't guarantee the exact count. language_hints array[string] - No Language codes for recognition. If unknown, leave this parameter unset and the model automatically identifies the language. Only the first value in the array is used. Extra values are ignored. Supported language codes by model:

  • fun-asr, fun-asr-2025-11-07, fun-asr-mtl, fun-asr-mtl-2025-08-25: <li> 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 </li>
  • fun-asr-2025-08-25: <li> zh: Chinese
  • en: English </li>

Response parameters

Click to view a response sample

HELPCODEESCAPE-json
{
  "output": {
    "task_status": "PENDING",
    "task_id": "c2e5d63b-96e1-4607-bb91-************"
  },
  "request_id": "77ae55ae-be17-97b8-9942--************"
}
ParameterTypeDescription
audio_formatstringThe audio format of the source file.
channelsarray[integer]The indexes of the audio tracks in the source file. Single-track audio returns [0], dual-track audio returns [0, 1].
original_sampling_rateintegerAudio sample rate in the source file (Hz).
original_duration_in_millisecondsintegerOriginal audio duration in the source file (ms).
channel_idintegerAudio track index for the transcription result (starts from 0).
content_durationintegerDuration of speech content identified in the audio track (ms). ** **Important ** The speech recognition service transcribes only segments identified as speech. Billing is based on these segment durations. Non-speech segments are not transcribed or billed. Speech duration is usually shorter than total audio duration. AI-based identification may not be completely accurate.
transcriptstringThe paragraph-level speech transcription result.
sentencesarrayThe sentence-level speech transcription results.
wordsarrayThe word-level speech transcription results.
begin_timeintegerThe start timestamp, in ms.
end_timeintegerThe end timestamp, in ms.
textstringThe speech transcription result.
speaker_idintegerThe index of the speaker. The index starts from 0 and distinguishes different speakers. This field appears in the recognition result only when the speaker diarization feature is enabled.
punctuationstringThe predicted punctuation mark that follows the word, if any.

Task query API

Basic information

**Description**   Queries the speech recognition task status and results.         **URL**

The following is the URL for the Singapore region. If you use a model in the Beijing region, replace the URL with: https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}.

http
https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id}
 **Request method**   POST     **Request headers**
http
Authorization: Bearer {api-key} // Replace this with your API key
**Message body**   None.

Request parameters

Click to view a request sample The following is a cURL sample for calling the task query API:

HELPCODEESCAPE-curl
# ======= Important =======
# The following is the URL for the Singapore region. If you use a model in the Beijing region, replace the URL with: https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}
# The API keys for the Singapore and Beijing regions are different. To get an API key, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
# === Delete this comment before execution ===

curl --location 'https://dashscope-intl.aliyuncs.com/api/v1/tasks/{task_id}' --header "Authorization: Bearer $DASHSCOPE_API_KEY"
ParameterTypeDefault valueRequiredDescription
task_idstring-YesTask ID to query. This is the task_id returned from the task submission API .

Response parameters

Click to view a response sample If a task has multiple subtasks, the overall status shows SUCCEEDED when any subtask succeeds. Check subtask_status for individual subtask results.

Normal sample

HELPCODEESCAPE-json
{
  "request_id": "f9e1afad-94d3-997e-a83b-************",
  "output": {
    "task_id": "f86ec806-4d73-485f-a24f-************",
    "task_status": "SUCCEEDED",
    "submit_time": "2024-09-12 15:11:40.041",
    "scheduled_time": "2024-09-12 15:11:40.071",
    "end_time": "2024-09-12 15:11:40.903",
    "results": [
      {
        "file_url": "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_male2.wav",
        "transcription_url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/pre/filetrans-16k/20240912/15%3A11/3bdf7689-b598-409d-806a-121cff5e4a31-1.json?Expires=1726211500&OSSAccessKeyId=yourOSSAccessKeyId&Signature=Fj%2BaF%2FH0Kayj3w3My2ECBeP****%3D",
        "subtask_status": "SUCCEEDED"
      },
      {
        "file_url": "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav",
        "transcription_url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/pre/filetrans-16k/20240912/15%3A11/409a4b92-445b-4dd8-8c1d-f110954d82d8-1.json?Expires=1726211500&OSSAccessKeyId=yourOSSAccessKeyId&Signature=v5Owy5qoAfT7mzGmQgH0g8C****%3D",
        "subtask_status": "SUCCEEDED"
      }
    ],
    "task_metrics": {
      "TOTAL": 2,
      "SUCCEEDED": 2,
      "FAILED": 0
    }
  },
  "usage": {
    "duration": 9
  }
}

Abnormal sample

The code field contains the error code, and the message field contains the error message. These two fields appear only when an error occurs. You can use them to troubleshoot issues by referring to Error codes.

HELPCODEESCAPE-json
{
    "task_id": "7bac899c-06ec-4a79-8875-xxxxxxxxxxxx",
    "task_status": "SUCCEEDED",
    "submit_time": "2024-12-16 16:30:59.170",
    "scheduled_time": "2024-12-16 16:30:59.204",
    "end_time": "2024-12-16 16:31:02.375",
    "results": [
        {
            "file_url": "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/sensevoice/long_audio_demo_cn.mp3",
            "transcription_url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/prod/paraformer-v2/20241216/xxxx",
            "subtask_status": "SUCCEEDED"
        },
        {
            "file_url": "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/sensevoice/rich_text_exaple_1.wav",
            "code": "InvalidFile.DownloadFailed",
            "message": "The audio file cannot be downloaded.",
            "subtask_status": "FAILED"
        }
    ],
    "task_metrics": {
        "TOTAL": 2,
        "SUCCEEDED": 1,
        "FAILED": 1
    }
}
ParameterTypeDescription
task_idstringThe ID of the queried task.
task_statusstringThe status of the queried task. ** **Note ** If a task has multiple subtasks, the overall status shows SUCCEEDED when any subtask succeeds. Check subtask_status for individual subtask results.
subtask_statusstringThe subtask status.
file_urlstringThe URL of the file processed in the transcription task.
transcription_urlstringLink to the recognition result (valid for 24 hours). After expiration, task queries and result downloads from previous URLs will fail. Results are saved as JSON. Download the file or read it directly via HTTP request. For JSON field descriptions, see Description of recognition results .

Description of recognition results

The recognition result is saved as a JSON file. Click to view a recognition result example

HELPCODEESCAPE-json
{
    "file_url":"https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav",
    "properties":{
        "audio_format":"pcm_s16le",
        "channels":[
            0
        ],
        "original_sampling_rate":16000,
        "original_duration_in_milliseconds":3834
    },
    "transcripts":[
        {
            "channel_id":0,
            "content_duration_in_milliseconds":3720,
            "text":"Hello world, this is Alibaba Speech Lab.",
            "sentences":[
                {
                    "begin_time":100,
                    "end_time":3820,
                    "text":"Hello world, this is Alibaba Speech Lab.",
                    "sentence_id":1,
                    "speaker_id":0, // This field is displayed only when automatic speaker diarization is enabled.
                    "words":[
                        {
                            "begin_time":100,
                            "end_time":596,
                            "text":"Hello ",
                            "punctuation":""
                        },
                        {
                            "begin_time":596,
                            "end_time":844,
                            "text":"world",
                            "punctuation":", "
                        }
                        // Other content is omitted here.
                    ]
                }
            ]
        }
    ]
}

The key parameters are as follows:

ParameterTypeDescription
audio_formatstringThe format of the audio in the source file.
channelsarray[integer]The audio track index information in the source file. Returns [0] for single-track audio, [0, 1] for dual-track audio, and so on.
original_sampling_rateintegerThe sample rate of the audio in the source file (Hz).
original_duration_in_millisecondsintegerThe original duration of the audio in the source file (ms).
channel_idintegerThe index of the transcribed audio track, starting from 0.
content_durationintegerThe duration of the content in the audio track that is identified as speech (ms). ** **Important ** Billing is based on speech content duration only (non-speech parts are not metered). Speech duration is typically shorter than total audio duration. The AI-based speech detection may have minor discrepancies.
transcriptstringThe paragraph-level speech transcription result.
sentencesarrayThe sentence-level speech transcription result.
wordsarrayThe word-level speech transcription result.
begin_timeintegerStart timestamp (ms).
end_timeintegerEnd timestamp (ms).
textstringThe speech transcription result.
speaker_idintegerThe index of the current speaker, starting from 0. This is used to distinguish different speakers. This field is displayed in the recognition result only when speaker diarization is enabled.
punctuationstringThe predicted punctuation mark after the word, if any.

Complete sample

Use your language's HTTP library to submit and query tasks. Submit a task via the submission API and then poll the query API until the task is complete.

The following is a sample in Python:

HELPCODEESCAPE-python
import requests
import json
import os
import time

# The API keys for the Singapore and Beijing regions are different. To get an API key, see https://www.alibabacloud.com/help/en/model-studio/get-api-key
# If you have not configured environment variables, replace the following line with your Model Studio API key: api_key = "sk-xxx"
api_key = os.getenv("DASHSCOPE_API_KEY")
file_urls = [
    "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav",
    "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_male2.wav",
]

# The regions for Singapore and Beijing are different. If you use the Beijing region, replace the following line with: region = "dashscope.aliyuncs.com"
region = "dashscope-intl.aliyuncs.com"

# Submit a file transcription task, including a list of file URLs to be transcribed
def submit_task(apikey, file_urls) -> str:

    headers = {
        "Authorization": f"Bearer {apikey}",
        "Content-Type": "application/json",
        "X-DashScope-Async": "enable",
    }
    data = {
        "model": "fun-asr",
        "input": {"file_urls": file_urls},
        "parameters": {
            "channel_id": [0],
        },
    }
    # URL of the audio file transcription service
    service_url = (
        f"https://{region}/api/v1/services/audio/asr/transcription"
    )
    response = requests.post(
        service_url, headers=headers, data=json.dumps(data)
    )

    # Print the response content
    if response.status_code == 200:
        return response.json()["output"]["task_id"]
    else:
        print("task failed!")
        print(response.json())
        return None


# Recursively query the task status until it is successful
def wait_for_complete(task_id):
    headers = {
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
        "X-DashScope-Async": "enable",
    }

    pending = True
    while pending:
        # URL of the task status query service
        service_url = f"https://{region}/api/v1/tasks/{task_id}"
        response = requests.post(
            service_url, headers=headers
        )
        if response.status_code == 200:
            status = response.json()['output']['task_status']
            if status == 'SUCCEEDED':
                print("task succeeded!")
                pending = False
                return response.json()['output']['results']
            elif status == 'RUNNING' or status == 'PENDING':
                pass
            else:
                print("task failed!")
                pending = False
        else:
            print("query failed!")
            pending = False
        print(response.json())
        time.sleep(0.1)


task_id = submit_task(apikey=api_key, file_urls=file_urls)
print("task_id: ", task_id)
result = wait_for_complete(task_id)
print("transcription result: ", result)

Error codes

If an error occurs, see Error messages to troubleshoot the issue.

If a task contains multiple subtasks, the overall task status is marked as SUCCEEDED if at least one subtask succeeds. You must check the subtask_status field to determine the result of each subtask.

Example of an error response:

HELPCODEESCAPE-json
{
    "task_id": "7bac899c-06ec-4a79-8875-xxxxxxxxxxxx",
    "task_status": "SUCCEEDED",
    "submit_time": "2024-12-16 16:30:59.170",
    "scheduled_time": "2024-12-16 16:30:59.204",
    "end_time": "2024-12-16 16:31:02.375",
    "results": [
        {
            "file_url": "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/sensevoice/long_audio_demo_cn.mp3",
            "transcription_url": "https://dashscope-result-bj.oss-cn-beijing.aliyuncs.com/prod/paraformer-v2/20241216/xxxx",
            "subtask_status": "SUCCEEDED"
        },
        {
            "file_url": "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/sensevoice/rich_text_exaple_1.wav",
            "code": "InvalidFile.DownloadFailed",
            "message": "The audio file cannot be downloaded.",
            "subtask_status": "FAILED"
        }
    ],
    "task_metrics": {
        "TOTAL": 2,
        "SUCCEEDED": 1,
        "FAILED": 1
    }
}

FAQ

Features

Q: Is audio in Base64 encoding supported?

This service recognizes audio from publicly accessible URLs only. It does not support audio in Base64 encoding, binary streams, or local files.

Q: How do I provide an audio file as a publicly accessible URL?

You can typically follow these steps. This is a general guide, and the specific steps may vary for different storage products. We recommend that you upload the audio to Object Storage Service (OSS). 1. Choose a storage and hosting method Examples include the following:

  • Object Storage Service (Recommended):

    • Use a cloud provider's object storage service, such as OSS. Upload the audio file to a bucket and set its access permissions to public.

    • Advantages: High availability, CDN acceleration support, and easy management.

  • Web server:

    • Place the audio file on a web server that supports HTTP/HTTPS access, such as Nginx or Apache.

    • Advantages: Suitable for small projects or local testing.

  • Content Delivery Network (CDN):

    • Host the audio file on a CDN and access it through the URL provided by the CDN.

    • Advantages: Accelerates file transfer, suitable for high-concurrency scenarios.

2. Upload the audio file Upload the audio file based on your chosen storage/hosting method. For example:

  • Object Storage Service:

    • Log on to the cloud provider's console and create a bucket.

    • Upload the audio file and set its permissions to "public-read" or generate a temporary access link.

  • Web server:

    • Place the audio file in a specified directory on the server, such as /var/www/html/audio/.

    • Ensure the file is accessible via HTTP/HTTPS.

3. Generate a publicly accessible URL For example:

  • Object Storage Service:

    • After uploading the file, the system automatically generates a public access URL, typically in the format https://&lt;bucket-name&gt;.&lt;region&gt;.aliyuncs.com/&lt;file-name&gt;.

    • For a more user-friendly domain name, you can attach a custom domain name and enable HTTPS.

  • Web server:

    • The access URL for the file is usually the server address plus the file path, such as https://your-domain.com/audio/file.mp3.
  • CDN:

    • After configuring CDN acceleration, use the URL provided by the CDN, such as https://cdn.your-domain.com/audio/file.mp3.

4. Verify the URL's availability In a public network environment, ensure that the generated URL is accessible. For example:

  • Open the URL in a browser to check if the audio file can be played.

  • Use a tool, such as curl or Postman, to verify that the URL returns a correct HTTP response (status code 200).

When using the SDK to access a file stored in OSS, you cannot use a temporary URL with the oss:// prefix.

When using the RESTful API to access a file stored in OSS, you can use a temporary URL with the oss:// prefix: Important

  • The temporary URL is valid for 48 hours and cannot be used after it expires. Do not use it in a production environment.

  • The API for obtaining an upload credential is limited to 100 QPS and does not support scaling out. Do not use it in production environments, high-concurrency scenarios, or stress testing scenarios.

  • For production environments, use a stable storage service such as OSS to ensure long-term file availability and avoid rate limiting issues.

Q: How long does it take to get the recognition result?

Tasks enter the PENDING state after submission. Queuing time (typically a few minutes) varies with the queue length and file duration. The longer the audio file, the longer the processing time.

Troubleshooting

For code errors, see Error codes for troubleshooting.

Q: What should I do if the temporary public URL for an OSS audio file is inaccessible?

A: In the headers, set X-DashScope-OssResourceResolve to enable.

This method is not recommended.

The Java and Python SDKs do not support configuring headers.

Q: Why can't I get a result after continuous polling?

This may be because of rate limiting.

Q: Why is the audio not recognized (no recognition result)?

Check whether the audio format and sample rate are correct and meet the parameter constraints.

You can use the ffprobe tool to retrieve information about the audio container, codec, sample rate, and channels:

HELPCODEESCAPE-sh
ffprobe -v error -show_entries format=format_name -show_entries stream=codec_name,sample_rate,channels -of default=noprint_wrappers=1 input.xxx

Mirror of Alibaba Cloud Model Studio docs for reference and RAG. Not affiliated with Alibaba Cloud.