API reference

更新时间:
复制 MD 格式

Speech File Transcriber Lite is an offline service that transcribes pre-recorded audio files. This is an asynchronous service. To transcribe a file, you must submit a URL that is accessible over HTTP. Local files are not supported. This service differs from the standard Speech File Recognition service in its response time. The Lite version returns transcription results within 24 hours.

Billing and concurrency limits

Limits

You must strictly follow these requirements when you write your code. Otherwise, your transcription request may fail and return an empty result.

  • The service supports the transcription of single-channel and dual-channel audio files in WAV, MP3, MP4, M4A, WMA, AAC, OGG, AMR, and FLAC formats.

  • The audio file size cannot exceed 512 MB. The video file size cannot exceed 2 GB. The total file duration cannot exceed 12 hours.

  • The audio file to be transcribed must be stored on a server and be accessible through a URL.

    • You can use Alibaba Cloud Object Storage Service (OSS). If the access permissions for the file in OSS are set to public-read, see Public-read Object to obtain the file access link. If the access permissions for the file in OSS are set to private, see Private Object to generate an access link with a validity period using the software development kit (SDK).

    • Alternatively, you can store the audio file on a self-built file server that allows file downloads. Ensure that the `Content-Length` value in the HTTP response header matches the actual length of the data in the body. Otherwise, the download will fail.

  • The access permissions for the uploaded audio file URL must be public. The URL must use a domain name, not an IP address. The URL cannot contain spaces or Chinese characters.

    Valid URL

    Invalid URL

    https://gw.alipayobjects.com/os/bmw-prod/0574ee2e-f494-45a5-820f-63aee583045a.wav

    • http://127.0.XX.XX/sample.wav

    • D:\files\sample.wav

  • Speech File Transcriber Lite is an asynchronous transcription service and has no concurrency limit for transcription tasks. However, the following Queries Per Second (QPS) limits apply to API calls:

    • The user-level QPS limit is 200 for POST requests to the Speech File Transcriber Lite API.

    • The user-level QPS limit is 500 for GET requests to the Speech File Transcriber Lite API.

    • The QPS limit is 1 for the same TaskId when you query the result of a Speech File Transcriber Lite task.

  • After you submit a Speech File Transcriber Lite request, the transcription task is completed and the result is returned within 24 hours. The transcription result is stored on the server for 72 hours.

    Important

    This does not apply to large-scale data uploads, such as uploading more than 500 hours of audio within 30 minutes. To transcribe large-scale data, contact pre-sales experts.

  • The intelligent speaker diarization feature supports only 8 kHz single-channel and 16 kHz single-channel audio.

  • Supported invocation methods: polling and callback.

  • The service supports language model customization. For more information, see Language model customization.

  • The service supports hotwords. For more information, see Hotwords.

  • The service supports transcription models for multiple languages and dialects, such as Mandarin Chinese, Chinese dialects, and English. The following language and dialect models are currently supported:

    You cannot specify the language and dialect models in the code. In the Intelligent Speech Interaction console, go to the All Projects page. For the relevant project, perform the Configure Project Features operation and select the corresponding model. For more information, see Manage projects.

    • Languages

      Language

      Model name

      Sample rate

      Punctuation

      ITN

      Disfluency detection

      Semantic sentence detection

      Audio and text alignment

      English

      General - English, Education Livestream - English, Education Content Analysis - English

      16k

      Supported

      Support

      Support

      Not supported

      Support

      Call Center (General)

      8k

      Support

      Support

      Supported

      Not supported

      Not supported

      Southeast Asian Multilingual

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Japanese

      General - Japanese

      16k

      Support

      Support

      Not supported

      Not supported

      Supported

      Spanish

      General - Spanish

      16k

      Support

      Supported

      Not supported

      Not supported

      Not supported

      General - Spanish Call Center General

      8k

      Support

      Support

      Not supported

      Not supported

      Not supported

      Arabic

      General - Arabic

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Kazakh

      General - Kazakh

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Korean

      General - Korean

      16k

      Support

      Support

      Not supported

      Not supported

      Not supported

      Thai

      General - Thai

      16k

      Not supported

      Not supported

      Not supported

      Not supported

      Not supported

      General - Thai Call Center General

      8k

      Not supported

      Not supported

      Not supported

      Not supported

      Not supported

      Southeast Asian Multilingual

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Indonesian

      General - Indonesian

      16k

      Supported

      Support

      Not supported

      Not supported

      Not supported

      Call Center (General)

      8k

      Support

      Support

      Not supported

      Not supported

      Not supported

      Southeast Asian Multilingual

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Russian

      General - Russian

      16k

      Support

      Support

      Not supported

      Not supported

      Not supported

      Vietnamese

      General - Vietnamese

      16k

      Support

      Support

      Not supported

      Not supported

      Not supported

      General - Vietnamese Call Center General

      8k

      Support

      Support

      Not supported

      Not supported

      Not supported

      Southeast Asian Multilingual

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      French

      General - French

      16k

      Support

      Support

      Not supported

      Not supported

      Not supported

      German

      General - German

      16k

      Supported

      Support

      Not supported

      Not supported

      Not supported

      Italian

      General - Italian

      16k

      Supported

      Not supported

      Not supported

      Not supported

      Not supported

      Hindi

      General - Hindi

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Malay

      General - Malay

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      General - Malay Call Center General

      8k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Southeast Asian Multilingual

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Filipino

      General - Filipino

      16k

      Support

      Support

      Not supported

      Not supported

      Not supported

      Call Center (General)

      8k

      Support

      Support

      Not supported

      Not supported

      Not supported

      Southeast Asian Multilingual

      16k

      Supported

      Not supported

      Not supported

      Not supported

      Not supported

      Tamil

      General - Tamil

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Portuguese

      General - Portuguese

      16k

      Support

      Supported

      Not supported

      Not supported

      Not supported

      Turkish

      General - Turkish

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Polish

      General - Polish

      16k

      Supported

      Not supported

      Not supported

      Not supported

      Not supported

      Ukrainian

      General - Ukrainian

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Romanian

      General - Romanian

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Dutch

      General - Dutch

      16k

      Supported

      Not supported

      Not supported

      Not supported

      Not supported

      Greek

      General - Greek

      16k

      Supported

      Not supported

      Not supported

      Not supported

      Not supported

      Hungarian

      General - Hungarian

      16k

      Supported

      Not supported

      Not supported

      Not supported

      Not supported

      Javanese

      General - Javanese

      16k

      Supported

      Not supported

      Not supported

      Not supported

      Not supported

      Bengali

      General - Bengali

      16k

      Supported

      Not supported

      Not supported

      Not supported

      Not supported

      Burmese

      General - Burmese

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Lao

      General - Lao

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Swahili

      General - Swahili

      16k

      Supported

      Not supported

      Not supported

      Not supported

      Not supported

      Azerbaijani

      General - Azerbaijani

      16k

      Supported

      Not supported

      Not supported

      Not supported

      Not supported

      Persian

      General - Persian

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Sinhala

      General - Sinhala

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Catalan

      General - Catalan

      16k

      Supported

      Not supported

      Not supported

      Not supported

      Not supported

      Khmer

      General - Khmer

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Hebrew

      General - Hebrew

      16k

      Supported

      Not supported

      Not supported

      Not supported

      Not supported

      Croatian

      General - Croatian

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Hausa

      General - Hausa

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Marathi

      General - Marathi

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Telugu

      General - Telugu

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Punjabi

      General - Punjabi

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Swedish

      General - Swedish

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Bulgarian

      General - Bulgarian

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Danish

      General - Danish

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Norwegian

      General - Norwegian

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Kannada

      General - Kannada

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Malayalam

      General - Malayalam

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Czech

      General - Czech

      16k

      Supported

      Not supported

      Not supported

      Not supported

      Not supported

      Urdu

      General - Urdu

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Nepali

      General - Nepali

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Mongolian (Outer Mongolia)

      General - Mongolian (Outer Mongolia)

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Uzbek

      General - Uzbek

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

    • Dialects

      Language

      Model name

      Sample rate

      Punctuation

      ITN

      Disfluency detection

      Semantic sentence detection

      Audio and text alignment

      Cantonese

      General - Cantonese

      16k

      Support

      Supported

      Supported

      Not supported

      Support

      Call Center (General)

      8k

      Support

      Support

      Supported

      Not supported

      Support

      Cantonese-Mandarin Code-switching

      8k

      Supported

      Supported

      Supported

      Not supported

      Not supported

      Southeast Asian Multilingual

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Cantonese (Traditional Chinese)

      General - Cantonese (Traditional Chinese)

      8k

      Supported

      Not supported

      Not supported

      Not supported

      Not supported

      General - Cantonese (Traditional Chinese)

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

      Sichuanese

      General - Sichuanese

      16k

      Support

      Supported

      Supported

      Supported

      Support

      Call Center (General)

      8k

      Support

      Supported

      Support

      Support

      Support

      Hubei dialect

      General - Hubei dialect

      16k

      Support

      Support

      Support

      Support

      Support

      General - Hubei dialect

      8k

      Support

      Support

      Supported

      Support

      Support

      Shanghainese

      General - Shanghainese

      16k

      Support

      Supported

      Supported

      Support

      Not supported

      Hunan dialect

      General - Hunan dialect

      16k

      Support

      Support

      Supported

      Support

      Supported

      Henan dialect

      General - Henan dialect

      16k

      Support

      Supported

      Support

      Support

      Support

      General - Henan dialect

      8k

      Support

      Support

      Support

      Support

      Support

      Zhejiang dialect

      General - Zhejiang dialect

      16k

      Support

      Support

      Support

      Supported

      Not supported

      Northeastern Mandarin

      General - Northeastern Mandarin

      16k

      Supported

      Support

      Support

      Supported

      Supported

      Shandong dialect

      General - Shandong dialect

      16k

      Support

      Supported

      Supported

      Support

      Support

      Tianjin dialect

      General - Tianjin dialect

      16k

      Supported

      Support

      Supported

      Support

      Supported

      Shaanxi dialect

      General - Shaanxi dialect

      16k

      Support

      Support

      Supported

      Support

      Supported

      Shanxi dialect

      General - Shanxi dialect

      16k

      Support

      Support

      Support

      Support

      Support

      Guizhou dialect

      General - Guizhou dialect

      16k

      Support

      Support

      Supported

      Support

      Supported

      Yunnan dialect

      General - Yunnan dialect

      16k

      Supported

      Support

      Supported

      Support

      Support

      Gansu dialect

      General - Gansu dialect

      16k

      Support

      Support

      Support

      Support

      Support

      Suzhou dialect

      General - Suzhou dialect

      16k

      Support

      Supported

      Supported

      Support

      Not supported

      Minnan

      General - Minnan

      16k

      Support

      Supported

      Support

      Supported

      Not supported

      Jiangxi dialect

      General - Jiangxi dialect

      16k

      Support

      Supported

      Support

      Supported

      Supported

      Ningxia dialect

      General - Ningxia dialect

      16k

      Supported

      Support

      Support

      Supported

      Supported

      Guangxi dialect

      General - Guangxi dialect

      16k

      Support

      Supported

      Supported

      Support

      Support

      General - Guangxi dialect

      8k

      Supported

      Support

      Supported

      Support

      Support

      Mandarin Chinese

      Shiyinshi V1 - End-to-end model, Education Content Analysis, Medical Content Analysis, News Media Content Analysis, Entertainment Video Content Analysis, Audio and Video Offline Transcription (Upgraded), New Retail Recognition Model, Travel Recognition Model, Automotive

      16k

      Support

      Supported

      Support

      Support

      Support

      Chinese-English Free Talk

      16k

      Supported

      Supported

      Support

      Support

      Not supported

      Shiyinshi V1 - End-to-end model

      8k

      Support

      Supported

      Support

      Support

      Support

      Southeast Asian Multilingual

      16k

      Support

      Not supported

      Not supported

      Not supported

      Not supported

Steps

  1. Determine the format and sample rate of your audio file. Then, select a suitable scenario model in the console based on your business scenario.

  2. Store the audio file in OSS.

    If the access permissions for the file in OSS are set to public-read, see Public-read Object to obtain the file access link. If the access permissions for the file in OSS are set to private, see Private Object to generate an access link with a validity period using the SDK.

    Note

    Alternatively, you can store the audio file on a self-built file server that allows file downloads. Ensure that the value of Content-Length in the HTTP response header matches the actual length of the data in the body. Otherwise, the download will fail.

  3. The client submits a Speech File Transcriber Lite request.

    The server returns a task ID for the request. You can use this ID to query the transcription result.

  4. The client sends a request to query the transcription result.

    Use the task ID that you obtained in step 3 to query the result of the Speech File Transcriber Lite task. After you submit the request, the transcription task is completed and the result is returned within 24 hours. The transcription result is stored on the server for 72 hours.

Interaction flow

The interaction flow between the client and the server is shown in the following figure.

image
Note

For all server responses except audio streams, the response header contains the TaskId parameter for the transcription task. This is the unique identifier for the request.

POP call parameters for each region

Region

Call parameters

China (Shanghai)

  • regionId="cn-shanghai"

  • endpointName="cn-shanghai"

  • domain="speechfiletranscriberlite.cn-shanghai.aliyuncs.com"

China (Beijing)

  • regionId="cn-beijing"

  • endpointName="cn-beijing"

  • domain="speechfiletranscriberlite.cn-beijing.aliyuncs.com"

China (Shenzhen)

  • regionId="cn-shenzhen"

  • endpointName="cn-shenzhen"

  • domain="speechfiletranscriberlite.cn-shenzhen.aliyuncs.com"

API call method

The Speech File Transcriber Lite service provides Remote Procedure Call (RPC) style APIs that follow the POP API specification. Parameters are encapsulated in each request, and each request corresponds to a specific method. The result of the operation is included in the response. The audio file to be transcribed must be stored on a server (Alibaba Cloud OSS is recommended) and be accessible through a URL. If you use Alibaba Cloud OSS, you can access it over the internal network within the same region to avoid outbound traffic fees. For more information, see How do I set the OSS internal network address for speech transcription?.

The Speech File Transcriber Lite POP API consists of two parts: a POST API for submitting transcription requests (user-level QPS limit of 200) and a GET API for querying transcription results (user-level QPS limit of 500).

  • Invoke the detection API:

    • When you use the polling method, you can submit a Speech File Transcriber Lite task to obtain a task ID for subsequent polling.

    • When you use the callback method, you can submit a Speech File Transcriber Lite task and a callback URL. After the task is completed, the transcription result is sent to the webhook address in a POST request. The webhook address must be able to accept POST requests.

      Input parameters and descriptions:

      When you submit a Speech File Transcriber Lite request, you must set the input parameters. You must pass the parameters as a JSON string in the body of the request object. The JSON format is as follows:

      {
          "appkey": "your-appkey",      // To get an Appkey, go to the console: https://nls-portal.console.aliyun.com/applist
          "file_link": "https://gw.alipayobjects.com/os/bmw-prod/0574ee2e-f494-45a5-820f-63aee583045a.wav",
          "auto_split":false,
          "enable_words": false,
          "enable_sample_rate_adaptive": true,
          // valid_times: Retrieves the recognition content for a specified time period of the audio. If not needed, you do not need to fill in this field.
          "valid_times": [
              {
                  "begin_time": 200,
                  "end_time":2000,
                  "channel_id": 0
              }
          ]
      }

      Parameter

      Value type

      Required

      Description

      appkey

      String

      Yes

      The Appkey of the project in the console.

      file_link

      String

      Yes

      The address where the audio file is stored. In the console, you must set the model of the corresponding project to a model that supports the audio scenario.

      enable_words

      Boolean

      No

      Specifies whether to return word information. The default is false.

      enable_sample_rate_adaptive

      Boolean

      No

      Specifies whether to automatically downsample audio with a sample rate greater than 16 kHz to 16 kHz. The default value is false.

      enable_callback

      Boolean

      No

      Specifies whether to enable the callback feature. The default value is false.

      callback_url

      String

      No

      The address of the callback service. This parameter is required if `enable_callback` is set to true. The URL supports HTTP and HTTPS. The host cannot be an IP address.

      speaker_num

      Integer

      No

      Used to help specify the number of speakers for voiceprint recognition. The value must be an integer from 2 to 100. The default value is 2 for 8k audio and 100 for 16k audio.

      This parameter only helps the algorithm try to output the specified number of speakers. It does not guarantee that this number of speakers will be output. This parameter must be used with the auto_split and supervise_type parameters.

      auto_split

      Boolean

      No

      Specifies whether to enable intelligent speaker diarization. If enabled, you can determine the speaker of each sentence based on the ChannelId in the recognition result for a two-party conversation. Typically, the ChannelId of the first speaker is 0. For 8k dual-channel audio, if speaker diarization is enabled, the default number of speakers is 2, and sound channels 0 and 1 are the track numbers.

      supervise_type

      Integer

      No

      The method for determining the number of speakers for speaker separation. This parameter must be used with the auto_split and speaker_num parameters.

      • Default (empty): The number of speakers is specified by the user for 8k audio and determined by the algorithm for 16k audio.

      • 1: The number of speakers is specified by the user. The specific number is confirmed by the speaker_num parameter.

      • 2: The algorithm counts the number of people.

      enable_inverse_text_normalization

      Boolean

      No

      Inverse text normalization (ITN) converts Chinese numerals to Arabic numerals. If set to True, Chinese numerals are converted to Arabic numerals in the output. The default value is False.

      enable_disfluency

      Boolean

      No

      Filters filler words, also known as disfluency detection. The default value is false (disabled). To enable this feature, set version to 4.0.

      enable_punctuation_prediction

      Boolean

      No

      Specifies whether to add punctuation to sentences. The default value is true (add punctuation).

      valid_times

      List< ValidTime >

      No

      Information about valid time periods, used to exclude unwanted time periods.

      max_end_silence

      Integer

      No

      The maximum allowed ending silence. The value must be in the range of 200 to 6000. The default value is 800. Unit: milliseconds.

      This parameter is invalid if semantic sentence detection (enable_semantic_sentence_detection) is enabled.

      max_single_segment_time

      Integer

      No

      The maximum allowed end time for a single sentence. The minimum value is 5000. The default value is 60000. Unit: milliseconds.

      This parameter is invalid if semantic sentence detection (enable_semantic_sentence_detection) is enabled.

      customization_id

      String

      No

      The ID of the custom model created through the POP API. By default, no custom model is added.

      class_vocabulary_id

      String

      No

      The ID of the created class-based hotword vocabulary. By default, no vocabulary is added.

      vocabulary_id

      String

      No

      The ID of the created general hotword vocabulary. By default, no vocabulary is added.

      enable_semantic_sentence_detection

      Boolean

      No

      Specifies whether to enable semantic sentence detection. Valid values: true/false. The default value is false.

      enable_timestamp_alignment

      Boolean

      No

      Specifies whether to enable the timestamp calibration feature. Valid values: true/false. The default value is false.

      first_channel_only

      Boolean

      No

      Specifies whether to recognize only the first sound channel. Valid values: true/false. (If the speech recognition result is duplicated, you can enable this parameter.)

      • Default (empty): Processes dual-channel for 8k audio and single-channel for 16k audio.

      • false: Processes dual-channel for 8k audio and dual-channel for 16k audio.

      • true: Processes single-channel for 8k audio and single-channel for 16k audio.

      Important

      Billing model:

      • For 8k dual-channel processing, billing is based on a single channel, which is the audio duration.

      • For 16k dual-channel processing, billing is based on dual channels, which is the number of sound channels × audio duration.

      special_word_filter

      String (in JSON format)

      No

      The sensitive word filtering feature. You can enable or disable it and customize sensitive words. This parameter lets you:

      Do not process (default, displays the original text), Filter, or Replace with *.

      For a specific call example, see the custom word filtering example below.

      Note

      If this feature is enabled but no sensitive words are configured, the default word list is filtered: Sensitive word list.

      punctuation_mark

      String

      No

      Custom punctuation for sentence segmentation.

      If not specified, periods, question marks, and exclamation marks are used for sentence segmentation by default. If you specify a value for this parameter, the specified punctuation marks will also be used for sentence segmentation.

      Example:

      To segment by English commas, enter ","

      To segment by Chinese and English commas, enter ",,"

      Note
      • If you enter non-punctuation characters, they will not take effect.

      • This field can contain multiple punctuation marks, and it distinguishes between Chinese and English punctuation. There are no spaces between the punctuation marks.

      sentence_max_length

      Integer

      No

      The maximum number of characters to display per sentence. The value must be in the range of [4, 50]. By default, this feature is disabled. If enabled without specifying the number of characters, long sentences will be segmented. This parameter can be used in caption generation scenarios to control the maximum number of characters per line of captions.

      The following is an example of a custom word filtering call:

                  // Take real-time transcription as an example,
                  JSONObject root = new JSONObject();
                  root.put("system_reserved_filter", true);
      
                  // Replace the following words with an empty string
                  JSONObject root1 = new JSONObject();
                  JSONArray array1 = new JSONArray();
                  array1.add("start");
                  array1.add("happen");
                  root1.put("word_list", array1);
      
                  // Replace the following words with *
                  JSONObject root2 = new JSONObject();
                  JSONArray array2 = new JSONArray();
                  array2.add("test");
                  root2.put("word_list", array2);
      
      						// You can set all or some of them
                  root.put("filter_with_empty", root1);
                  root.put("filter_with_signed", root2);
      
                  transcriber.addCustomedParam("special_word_filter", root);

      The parameters of the ValidTime object are described in the following table.

      Parameter

      Value type

      Required

      Description

      begin_time

      Int

      Yes

      The start time offset of the valid time period. Unit: milliseconds.

      end_time

      Int

      Yes

      The end time offset of the valid time period. Unit: milliseconds.

      channel_id

      Int

      Yes

      The sound channel number (starting from 0) to which the valid time period applies.

      Output parameters and descriptions:

      The server returns a response to the Speech File Transcriber Lite request. The output parameters of the response are in a JSON string:

      {
              "TaskId": "4b56f0c4b7e611e88f34c33c2a60****",
              "RequestId": "E4B183CC-6CFE-411E-A547-D877F7BD****",
              "StatusText": "SUCCESS",
              "StatusCode": 21050000
      }

      An HTTP status code of 200 indicates a successful operation. For more information about status codes, see HTTP status codes.

      Property

      Value type

      Required

      Description

      TaskId

      String

      Yes

      The recognition task ID.

      RequestId

      String

      Yes

      The request ID, used only for joint debugging.

      StatusCode

      Int

      Yes

      The status code.

      StatusText

      String

      Yes

      The status description.

  • Transcription result query API:

    After you submit a Speech File Transcriber Lite request, you can poll for the transcription result by setting the following parameters.

    Input parameters:

    Use the task ID that you obtained from the Speech File Transcriber Lite request as a parameter for the transcription result query API to retrieve the transcription result. You must set an appropriate polling interval when you call the API.

    Important

    The query API has a QPS limit of 100. If you exceed this limit, the error Throttling.User : Request was denied due to user flow control. may be returned. To avoid this error, set a longer polling interval for the query API.

    Property

    Value type

    Required

    Description

    TaskId

    String

    Yes

    The recognition task ID.

    Output parameters and descriptions:

    The server returns a response to the transcription result query request. The output parameters of the response are in a JSON string.

    • Normal response: The following example shows the transcription result for the audio file nls-sample-16k.wav (a single-channel file).

      {
              "TaskId": "d429dd7dd75711e89305ab6170fe****",
              "RequestId": "9240D669-6485-4DCC-896A-F8B31F94****",
              "StatusText": "SUCCESS",
              "BizDuration": 2956,
              "SolveTime": 1540363288472,
              "StatusCode": 21050000,
              "Result": {
                      "Sentences": [{
                              "EndTime": 2365,
                              "SilenceDuration": 0,
                              "BeginTime": 340,
                              "Text": "The weather in Beijing.",
                              "ChannelId": 0,
                              "SpeechRate": 177,
                              "EmotionValue": 5.0
                      }]
              }
      }

      If `enable_callback` and `callback_url` are enabled, the callback transcription result is as follows:

      {
              "Result": {
                      "Sentences": [{
                              "EndTime": 2365,
                              "SilenceDuration": 0,
                              "BeginTime": 340,
                              "Text": "The weather in Beijing.",
                              "ChannelId": 0,
                              "SpeechRate": 177,
                              "EmotionValue": 5.0
                      }]
              },
              "TaskId": "36d01b244ad811e9952db7bb7ed2****",
              "StatusCode": 21050000,
              "StatusText": "SUCCESS",
              "RequestTime": 1553062810452,
              "SolveTime": 1553062810831,
              "BizDuration": 2956
      }
      Note

      • RequestTime is a timestamp in milliseconds (for example, 1553062810452 corresponds to 2019/3/20 14:20:10 UTC+8). It indicates the time when the Speech File Transcriber Lite request was submitted.

      • SolveTime is a timestamp in milliseconds. It indicates the time when the Speech File Transcriber Lite task was completed.

    • Queuing:

      {
              "TaskId": "c7274235b7e611e88f34c33c2a60****",
              "RequestId": "981AD922-0655-46B0-8C6A-5C836822****",
              "StatusText": "QUEUEING",
              "StatusCode": 21050002
      }
    • Recognizing:

      {
              "TaskId": "c7274235b7e611e88f34c33c2a60****",
              "RequestId": "8E908ED2-867F-457E-82BF-4756194A****",
              "StatusText": "RUNNING",
              "BizDuration": 0,
              "StatusCode": 21050001
      }
    • Abnormal response: The following example shows a file download failure.

      {
              "TaskId": "4cf25b7eb7e711e88f34c33c2a60****",
              "RequestId": "098BF27C-4CBA-45FF-BD11-3F532F26****",
              "StatusText": "FILE_DOWNLOAD_FAILED",
              "BizDuration": 0,
              "SolveTime": 1536906469146,
              "StatusCode": 41050002
      }
      Note

      For more information about exceptions, see the error codes and solutions in the Service status codes section below.

      An HTTP status code of 200 indicates a successful operation. For more information about status codes, see HTTP status codes.

      Property

      Value type

      Required

      Description

      TaskId

      String

      Yes

      The recognition task ID.

      StatusCode

      Int

      Yes

      The status code.

      StatusText

      String

      Yes

      The status description.

      RequestId

      String

      Yes

      The request ID, used for debugging.

      Result

      Object

      Yes

      The recognition result object.

      Sentences

      List< SentenceResult >

      Yes

      The recognition result data. This exists when StatusText is SUCCEED.

      Words

      List< WordResult >

      No

      Word-level timestamps. To get this information, set enable_words to true.

      BizDuration

      Long

      Yes

      The total duration of the recognized audio file. Unit: milliseconds.

      SolveTime

      Long

      Yes

      A timestamp that indicates when the Speech File Transcriber Lite task was completed. Unit: milliseconds.

      The parameters of the single-sentence result SentenceResult are as follows.

      Property

      Value type

      Required

      Description

      ChannelId

      Int

      Yes

      The sound channel ID to which the sentence belongs.

      BeginTime

      Int

      Yes

      The start time offset of the sentence. Unit: milliseconds.

      EndTime

      Int

      Yes

      The end time offset of the sentence. Unit: milliseconds.

      Text

      String

      Yes

      The recognized text of the sentence.

      EmotionValue

      Float

      Yes

      The emotional energy value, which is the volume in decibels divided by 10. The value is in the range of [1, 10]. A higher value indicates a stronger emotion.

      SilenceDuration

      Int

      Yes

      The duration of silence between this sentence and the previous one. Unit: seconds.

      SpeechRate

      Int

      Yes

      The average speech rate of this sentence.

      • If the recognized language is Chinese, the unit is characters per minute.

      • If the recognized language is English, the unit is words per minute.

    • Enabling word-level information:

      If `enable_words` is set to true, the transcription result from the server includes word-level timestamps. The word information that is retrieved through polling and callback methods is the same. The following example shows a transcription result from the polling method:

      {
              "StatusCode": 21050000,
              "Result": {
                      "Sentences": [{
                              "SilenceDuration": 0,
                              "EmotionValue": 5.0,
                              "ChannelId": 0,
                              "Text": "The weather in Beijing.",
                              "BeginTime": 340,
                              "EndTime": 2365,
                              "SpeechRate": 177
                      }],
                      "Words": [{
                              "ChannelId": 0,
                              "Word": "Beijing",
                              "BeginTime": 640,
                              "EndTime": 940
                      }, {
                              "ChannelId": 0,
                              "Word": "'s",
                              "BeginTime": 940,
                              "EndTime": 1120
                      }, {
                              "ChannelId": 0,
                              "Word": "weather",
                              "BeginTime": 1120,
                              "EndTime": 2020
                      }]
              },
              "SolveTime": 1553236968873,
              "StatusText": "SUCCESS",
              "RequestId": "027B126B-4AC8-4C98-9FEC-A031158F****",
              "TaskId": "b505e78c4c6d11e9a213e11db149****",
              "BizDuration": 2956
      }

      Words object description:

      Property

      Value type

      Required

      Description

      BeginTime

      Int

      Yes

      The start time of the word. Unit: milliseconds.

      EndTime

      Int

      Yes

      The end time of the word. Unit: milliseconds.

      ChannelId

      Int

      Yes

      The sound channel ID to which the word belongs.

      Word

      String

      Yes

      The word information.

Service status codes

General-purpose error codes

Status code

Status message

Cause

Solution

40000000

The default client error code. This code corresponds to multiple error messages.

Invalid parameters or call logic was used.

Compare your code with the sample code in the official documentation to test and verify it.

40000001

The token 'xxx' has expired.

The token 'xxx' is invalid

Invalid parameters or call logic was used. This is a general-purpose client error code that usually indicates an incorrect token, such as an expired or invalid token.

Compare your code with the sample code in the official documentation to test and verify it.

40000002

Gateway:MESSAGE_INVALID:Can't process message in state'FAILED'!

The message is invalid or incorrect.

Compare your code with the sample code in the official documentation to test and verify it.

40000003

PARAMETER_INVALID

Failed to decode url params

The parameters passed by the user are incorrect. This error is common for RESTful API calls.

Compare your code with the sample code in the official documentation to test and verify it.

40000005

Gateway:TOO_MANY_REQUESTS:Too many requests!

Too many concurrent requests.

If you are using the Free Edition, you can upgrade to a commercial version to increase the concurrency.

If you are already using a commercial version, you can purchase a concurrency resource plan to increase your concurrency quota.

40000009

Invalid wav header!

The message header is invalid.

If you send a WAV audio file and set the format parameter to wav, check whether the WAV header of the audio file is correct. If the header is incorrect, the server may reject the request.

40000009

Too large wav header!

The WAV header of the transmitted audio is invalid.

You can send the audio stream in a format such as PCM or OPUS. If you use the WAV format, make sure that the WAV header of the audio file contains the correct data length.

40000010

Gateway:FREE_TRIAL_EXPIRED:The free trial has expired!

The trial period has ended, and the commercial version is not activated or your account has an overdue payment.

You can log on to the console to check the service activation status and your account balance.

40010001

Gateway:NAMESPACE_NOT_FOUND:RESTful url path illegal

The operation or parameter is not supported.

Check whether the parameters passed in the call are consistent with the requirements in the official documentation. You can compare them with the error message to identify and set the correct parameters.

For example, if you are using a curl command to make a RESTful API request, check whether the URL you constructed is valid.

40010003

Gateway:DIRECTIVE_INVALID:[xxx]

A general-purpose client-side error code.

This error indicates that the client passed an incorrect parameter or instruction. Detailed error messages are available for different operations. You can refer to the corresponding documentation to set the parameters correctly.

40010004

Gateway:CLIENT_DISCONNECT:Client disconnected before task finished!

The client actively terminated the connection before the request was processed.

None. Alternatively, you can close the connection after the server responds.

40010005

Gateway:TASK_STATE_ERROR:Got stop directive while task is stopping!

The client sent a message instruction that is not currently supported.

Compare your code with the sample code in the official documentation to test and verify it.

40020105

Meta:APPKEY_NOT_EXIST:Appkey not exist!

A non-existent Appkey was used.

Confirm whether a non-existent Appkey was used. You can log on to the console and view the project configuration to find the Appkey.

40020106

Meta:APPKEY_UID_MISMATCH:Appkey and user mismatch!

The Appkey and token passed in the call were not created by the same Alibaba Cloud account UID. This causes a mismatch.

Check whether you are using resources from two different accounts. Do not use an Appkey from Account A with a token generated from Account B.

403

Forbidden

The token is invalid. For example, the token does not exist or has expired.

Set a valid token. Tokens have an expiration period. You must obtain a new token before the current one expires.

41000003

MetaInfo doesn't have end point info

Failed to retrieve the routing information for this Appkey.

Check whether you are using resources from two different accounts. Do not use an Appkey from Account A with a token generated from Account B.

41010101

UNSUPPORTED_SAMPLE_RATE

The sample rate is not supported.

Real-time speech recognition currently supports only audio with a sample rate of 8000 Hz or 16000 Hz.

41040201

Realtime:GET_CLIENT_DATA_TIMEOUT:Client data does not send continuously!

Failed to retrieve data from the client due to a timeout.

When you call real-time speech recognition, the client must send data at a real-time rate and close the connection promptly after the data is sent.

50000000

GRPC_ERROR:Grpc error!

An exception caused by factors such as machine load or network issues. This error usually occurs randomly.

You can retry the call to resolve the issue.

50000001

GRPC_ERROR:Grpc error!

An exception caused by factors such as machine load or network issues. This error usually occurs randomly.

You can retry the call to resolve the issue.

52010001

GRPC_ERROR:Grpc error!

An exception caused by factors such as machine load or network issues. This error usually occurs randomly.

You can retry the call to resolve the issue.

Audio file recognition/Audio file recognition (off-peak) error codes

Status code

Status message

Cause

Solution

21050000

SUCCESS

Success.

None.

21050001

RUNNING

The audio file recognition task is running.

Send a GET request to query the recognition result later.

21050002

QUEUEING

The audio file recognition task is in the queue.

Send a GET request to query the recognition result later.

21050003

SUCCESS_WITH_NO_VALID_FRAGMENT

The operation to query the recognition result was successful, but the voice activity detection (VAD) module did not detect any valid speech.

In this case, check the following:

Check whether the audio file contains valid speech. If it contains only invalid speech, such as pure silence, it is normal for no recognition result to be returned.

ASR_RESPONSE_HAVE_NO_WORDS

The operation to query the recognition result was successful, but the final recognition result is empty.

In this case, check the following:

Check whether the audio file contains valid speech, or whether the valid speech consists only of filler words and the enable_disfluency parameter is enabled, causing the filler words to be filtered out.

In these cases, it is normal for no recognition result to be returned.

41050001

USER_BIZDURATION_QUOTA_EXCEED

The daily duration limit is exceeded. Free Edition users can recognize audio files with a total duration of no more than 2 hours per day.

Upgrade from the Free Edition to the commercial version. If you have a high volume of business, contact our business team by email at nls_support@service.aliyun.com.

41050002

FILE_DOWNLOAD_FAILED

File download failed.

Check whether the audio file path is correct and whether the file can be accessed and downloaded from the internet.

41050003

FILE_CHECK_FAILED

The file format is incorrect.

Check whether the audio file is in single-channel or dual-channel WAV or MP3 format.

41050004

FILE_TOO_LARGE

The file is too large.

Check if the audio file size exceeds 512 MB. If it does, segment the audio file.

41050005

FILE_NORMALIZE_FAILED

File normalization failed.

Check whether the audio file is damaged and whether it can be played normally.

41050006

FILE_PARSE_FAILED

File parsing failed.

Check whether the audio file is damaged and whether it can be played normally.

41050007

MKV_PARSE_FAILED

MKV parsing failed.

Check whether the audio file is damaged and whether it can be played normally.

41050008

UNSUPPORTED_SAMPLE_RATE

The sample rate does not match.

Check whether the actual audio sample rate is consistent with the sample rate of the ASR model bound to the Appkey in the console, or set the automatic downsampling parameter enable_sample_rate_adaptive in this document to true.

41050010

FILE_TRANS_TASK_EXPIRED

The audio file recognition task has expired.

The TaskId does not exist or has expired.

41050011

REQUEST_INVALID_FILE_URL_VALUE

The file_link parameter in the request is invalid.

Confirm whether the format of the file_link parameter is correct.

41050012

REQUEST_INVALID_CALLBACK_VALUE

The callback_url parameter in the request is invalid.

Confirm whether the format of the callback_url parameter is correct and whether it is empty.

41050013

REQUEST_PARAMETER_INVALID

The request parameter is invalid.

Confirm that the task value in the request is a valid JSON format string.

41050014

REQUEST_EMPTY_APPKEY_VALUE

The appkey parameter value in the request is empty.

Confirm whether the appkey parameter value is set.

41050015

REQUEST_APPKEY_UNREGISTERED

The appkey in the request parameter is not registered.

Confirm whether the appkey parameter value in the request is set correctly, or whether it belongs to the same account as the AccessKey ID of the Alibaba Cloud account.

41050021

RAM_CHECK_FAILED

RAM check failed.

Check whether your RAM user is authorized to call the API operations of Voice Service. For more information, see Configure RAM user permissions.

41050023

CONTENT_LENGTH_CHECK_FAILED

content-length check failed.

When downloading a file, check whether the content-length in the HTTP response is consistent with the actual file size.

41050024

FILE_404_NOT_FOUND

The file to be downloaded does not exist.

Check whether the file to be downloaded exists.

41050025

FILE_403_FORBIDDEN

You do not have permission to download the required file.

Check whether you have permission to download the audio file.

41050026

FILE_SERVER_ERROR

The service where the requested file is located is unavailable.

Check whether the service where the requested file is located is available.

41050103

AUDIO_DURATION_TOO_LONG

The duration of the requested file exceeds 12 hours.

Segment the audio and submit multiple recognition tasks. For more information, see Segmentation command reference.

40270003

DECODER_ERROR

Failed to detect audio file information.

Confirm that the file at the download link is in a supported audio format.

51050000

INTERNAL_ERROR

An exception caused by factors such as machine load or network issues. This error usually occurs randomly.

Retry the call to resolve the issue. If the issue persists, contact technical support.