Asynchronous speech recognition API

Updated at:

Service endpoint

Environment

Address

Production

https://convai-platform.aliyuncs.com

1. Workflow

Offline recognition is an asynchronous task:

  1. Submit task: Provide the model and audio URL. If the submission is successful, the platform returns a task_id. If the submission fails, the platform returns an error directly without asynchronous processing or a callback.

  2. Check task status: Use the task_id to check the task status. When the task completes successfully, the query returns a transcription_url.

  3. Download result: Download the transcription result in JSON format from the transcription_url.

2. Endpoints and request headers

BASE_URL is the service address provided upon platform activation.

Actions

Method and endpoint

Submit task

POST {BASE_URL}/api/v1/services/audio/asr/transcription

Query task

GET {BASE_URL}/api/v1/tasks/{task_id}

Download result

GET {transcription_url}, returned by the query task operation.

Request header

Submit

Query

Description

Authorization

Required

Required

Bearer <platform API key>

Content-Type

Required

—

application/json

Submit task API

Request parameters

POST /api/v1/services/audio/asr/transcription

{
  "model": "Qwen-Audio-ASR-VoicePica-Async",
  "input": {
    "file_urls": ["https://audio.example.com/meeting.wav"]
  },
  "parameters": {}
}

Parameter

Type

Required

Description

model

string

Yes

Specifies the customized model to use. Must be Qwen-Audio-ASR-VoicePica-Async.

input

object

Yes

The audio input.

input.file_urls

array[string]

Yes

An array containing a single audio URL. The URL must be absolute and use the http or https protocol. We recommend using https.

parameters

object

Model-dependent

Required for Qwen-Audio-3.0 and Qwen-Audio-3.1 models; pass an empty object {} if no parameters are needed. For other models, this parameter's requirement varies by model. We recommend explicitly passing {} if unused.

callback_url

string

No

A valid HTTP or HTTPS callback URL.

3.1.1 parameters

3.1.1.1 Common parameters

Parameter

Type

Description

hotwords

object

Specifies hotwords and their weights.

Weights must be integers from 1 to 5.

Requires a non-empty object mapping a hotword (key) to its integer weight (value), such as {"Model Studio": 4, "Tongyi Qianwen": 5, "ConvAI": 3}. Omitting this parameter disables the hotword feature.

language_hints

array[string]

Currently, only zh and en are supported.

The language code of the audio to transcribe, such as ["zh"]. A maximum of one element is allowed, which must be a non-empty string. Providing more than one element or a non-array value (such as a string) returns a 400 error. If you omit this parameter or pass an empty array [], the ASR engine automatically detects the language. The ASR engine determines whether a language code is supported.

3.1.1.2 Customized model (Qwen-Audio-ASR-VoicePica-Async)

Category

Parameter

Type

Description

Reference context

context

String

Default: ""

A reference context string with a maximum length of 4,096 characters.

Must be a string. Dialogue message arrays and null values are not supported.

RAG

hotword_rag

boolean

Default: true

Specifies whether to use the RAG path for hotwords. This parameter can only be passed together with hotwords.

VAD and segmentation

vad

boolean

Default: null

null: Automatically segments audio that exceeds the model window.

true: Enforces VAD.

false: Disables segmentation. The service rejects the request if the audio exceeds the model window.

The model window is 5 minutes.

vad_min_silence_ms

Integer

Default: 600

The minimum duration of silence (in ms) required to mark the end of a speech segment. Must be greater than or equal to 0.

vad_threshold

Number

Default: 0.5

The Silero speech probability threshold. Valid range: (0, 1). This parameter is effective only when VAD is enabled.

vad_min_speech_ms

Integer

Default: 250

The minimum duration of a speech segment in milliseconds (ms). The value must be 80 or greater.

vad_pad_ms

Integer

Default: 200

The padding, in milliseconds (ms), to add to the beginning and end of a speech segment. This value must be 0 or greater and cannot be null.

Audio format, sample rate, and channel processing

audio_format

String

Default: auto

auto is recommended for container audio. For raw PCM, you must explicitly specify the corresponding PCM format.

Mono 16-bit little-endian PCM: pcm, pcm_s16le, pcm16, s16le

Mono 32-bit float little-endian PCM: pcm_f32le, f32le, float32

sample_rate

Integer

Default: 16000

Unit: Hz. Range: [1, 384000]. The service uses this parameter to interpret raw PCM data and does not override the sample rate specified in a container audio header.

channel_separation

boolean

Default: false

If true, the service transcribes each source channel independently in channel order and returns a transcript for each channel. This is only supported for container formats with channel metadata. If you enable this parameter for raw PCM, the service returns a 400 error. null is not allowed.

channel_mode

String

Default: channel0

"channel0" (source channel 0)

"mix" (Mixes all source channels with equal weight). This value takes effect only when channel_separation=false. Null values are not accepted.

Input requirements

Item

Limit

Number of files

1 per request

Audio size

≤2 GB

Audio duration

≤12 hours

Request body size (JSON)

≤65,536 bytes

Format

Supported formats: WAV, MP3, and PCM.

3.2 Request example

Replace BASE_URL, CONVAI_API_KEY, and the example audio URL with your actual values:

curl --silent --show-error "$BASE_URL/api/v1/services/audio/asr/transcription" \
  -H "Authorization: Bearer $CONVAI_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{
    "model": "Qwen-Audio-ASR-VoicePica-Async",
    "input": {"file_urls": ["https://audio.example.com/meeting.wav"]},
    "parameters": {}
  }'

Response parameters

A successful submission returns an HTTP 202 status code to indicate the task has been queued for processing:

{
  "output": {
    "task_status": "PENDING",
    "task_id": "20261026-550e8400-e29b-41d4-a716-446655440000"
  },
  "request_id": "req-submit-example"
}

Parameter

Type

Description

output.task_id

string

The platform task ID. Use this ID to query the task status. This is not the Model Studio task ID.

output.task_status

string

The task status. PENDING indicates the task is queued, and RUNNING indicates it is in progress.

request_id

string

The unique ID for the API request. Use this ID for tracking and troubleshooting. This is not the Model Studio request ID.

Submission failures and duplicate submissions

  • If a platform submission fails, times out, or encounters any other exception, the task is set to FAILED. The platform returns an error synchronously. The task will not be processed in the background, trigger a callback, or be billed.

  • Each POST request that passes validation creates an independent task. The platform does not reuse existing tasks, even for submissions with identical content. Do not automatically resubmit requests to avoid duplicate processing and charges, as each successful task is billed individually.

  • Even if the client does not receive a response, the task may still have been accepted. If you have an output.task_id, use it to query the task status. If not, contact support with the request_id and the time of the request to confirm the status. Do not resubmit a POST request to check the task's status.

  • If a submission error response contains an output.task_id, you can query the task to find the reason for the failure without waiting for a callback. The platform does not return a task ID if validation fails before task creation. The platform may return a 503 error if it does not receive a write confirmation, but you should not use this response to determine the task status.

  • Querying a failed task with a GET request does not re-run it. A timeout failure does not mean the upstream task has been canceled. If a re-transcription is necessary, you must explicitly submit a new task to avoid creating infinite loops.

  • An accepted task is not canceled if the response is lost or the client disconnects. The API currently does not support canceling, batch querying, or modifying accepted tasks.

4. Query task API

4.1 Request parameters

GET /api/v1/tasks/{task_id}. No request body.

Parameter

Location

Type

Required

Description

task_id

URL path

string

Yes

The platform output.task_id returned in the submission response.

curl --silent --show-error "$BASE_URL/api/v1/tasks/$TASK_ID" \
  -H "Authorization: Bearer $CONVAI_API_KEY"

Poll for the task status every 60 seconds with random jitter. If you receive a 429 response, respect the Retry-After header. If your client has a configured callback, query after you receive a notification for the task's final status. If you do not receive a notification, poll at the recommended frequency. This query returns only the status saved on the platform and does not trigger an upstream query or re-transcription. The status remains in a processing state until the platform receives the completion notification from the upstream service.

4.2 Successful response

A successful query returns an HTTP 200 status code. To determine if the task is complete, check the output.task_status field. The following example shows a successful response for a Qwen-Audio-ASR-VoicePica-Async task:

{
  "request_id": "req-query-example",
  "output": {
    "task_id": "20261026-550e8400-e29b-41d4-a716-446655440000",
    "task_status": "SUCCEEDED",
    "submit_time": "2026-10-26 12:00:00.000",
    "scheduled_time": "2026-10-26 12:00:01.000",
    "end_time": "2026-10-26 12:00:02.000",
    "results": [
      {
        "file_url": "https://audio.example.com/meeting.wav",
        "transcription_url": "https://results.example.com/signed-fun-result.json",
        "subtask_status": "SUCCEEDED"
      }
    ]
  },
  "usage": {"duration": 9}
}

Parameter

Type

Description

request_id

string

The request ID for this query. This ID is different from the one in the submission request, and the Model Studio request ID is not returned.

output.task_id

string

The task ID, which matches the ID from the submission response.

output.task_status

string

The task status. See section 4.3 for details.

output.submit_time

string

The actual submission time of the upstream task. Omitted if not provided by the upstream service.

output.scheduled_time

string

The actual scheduled time of the upstream task. Omitted if not provided by the upstream service.

output.end_time

string

The actual end time of the upstream task. This does not indicate when the platform finished saving the result. Omitted if not provided.

output.results

array[object]

The results of the file subtasks.

output.results[].file_url

string / null

The original URL submitted by the client. This value becomes null after the request data is cleared. The platform's internal input URL is not returned.

output.results[].transcription_url

string

A temporary signed URL to download the result. This URL is provided only for successful, unexpired tasks.

Validity period: 24 hours.

To get a new signed URL, query the task again within the 1-month retention period.

output.results[].subtask_status

string

The status of the file subtask. The value is SUCCEEDED on success.

usage.duration

integer / null

The total usage in seconds, calculated by rounding up the audio's original duration in milliseconds (using the HALF_UP method). The duration includes silence and is not aggregated across channels.

4.3 Task statuses and failure responses

Status

Meaning

Client Action

PENDING

The task is in the upstream service's queue.

Query again later.

RUNNING

The submission is being processed, transcription is in progress, or the platform is saving the result.

Query again later. If the task does not complete after a long time, contact support.

SUCCEEDED

The platform has reliably saved the result.

Download the result within the retention period. This status does not indicate that charges have been settled.

FAILED

The task has failed.

Check the output.code and output.message fields. The task will not be automatically retried.

If a task fails, a download URL is not provided and the usage field is null. The task status remains RUNNING even if the upstream transcription is complete, while the platform is still saving the result.

A query for a failed task still returns an HTTP 200 status code:

{
  "request_id": "req-query-example",
  "output": {
    "task_id": "20261026-550e8400-e29b-41d4-a716-446655440000",
    "task_status": "FAILED",
    "code": "UpstreamError",
    "message": "The Model Studio transcription task failed."
  },
  "usage": {"duration": null}
}

Recognition results

Result file

Use the transcription_url from the task query to download the standalone recognition result JSON. This file is distinct from the task query response and does not include the platform task envelope.

Example (some optional fields omitted):

{
  "file_url": null,
  "properties": {
    "audio_format": "pcm_s16le",
    "channels": [0],
    "original_sampling_rate": 16000,
    "original_duration_in_milliseconds": 8600
  },
  "transcripts": [{
    "channel_id": 0,
    "content_duration_in_milliseconds": 3100,
    "text": "Hello, welcome to speech recognition.",
    "sentences": [{
      "sentence_id": 1,
      "begin_time": 100,
      "end_time": 3200,
      "text": "Hello, welcome to speech recognition.",

      "words": [ ]

    }]
  }]
}

Parameter

Description

file_url

This field is set to null to prevent the long-term storage of the signed input URL. This does not affect the transcribed text.

properties

Properties of the original audio file, including the audio format, processed channels, sampling rate, and original duration.

transcripts[].channel_id

The channel index, starting from 0.

transcripts[].content_duration_in_milliseconds

The content duration in milliseconds, as returned by the model. This value does not replace the billable usage found in the task query response.

transcripts[].text

The full text of the transcription. This can be an empty string for valid periods of silence.

transcripts[].sentences[]

An array of sentence-level result objects.

transcripts[].sentences[].sentence_id

The sentence ID.

transcripts[].sentences[].begin_time

begin_time The millisecond offset in the audio.

transcripts[].sentences[].end_time

end_time is the millisecond offset in the audio.

transcripts[].sentences[].text

The transcribed text of the sentence.

transcripts[].sentences[].words

Word-level details, such as timestamps and speaker information, as provided by the model. This field appears only if the model returns this information.

transcripts[].sentences[].emotion_value

A relative audio amplitude metric on a scale of 1.0 to 10.0, with one decimal place.

A value of 1.0 represents digital silence. Despite the field name, this value is an amplitude metric, not an emotion category or a confidence score.

6. Final state callback (optional)

6.1 Configure a callback

To receive notifications, add a callback_url to the top level of the request body. If you omit this field, or if its value is null or an empty string, no callback will be sent. In that case, you must use active polling to check the task status.

{
  "model": "Qwen-Audio-ASR-VoicePica-Async",
  "input": {"file_urls": ["https://audio.example.com/meeting.wav"]},
  "parameters": {},
  "callback_url": "https://customer.example.com/hooks/asr"
}
  • The field name must be exactly callback_url. Using other top-level field names, such as callbackUrl, will result in a 400 InvalidParameter error.

  • The URL must be an absolute http or https address with a hostname, up to 2,048 characters long. It cannot include user information (e.g., user:pass@) or a URL fragment (e.g., #...).

  • The hostname must be resolvable, and all resolved addresses must be public IP addresses. URLs pointing to a private network, loopback address, or any other non-public address will result in a 400 error, as will DNS resolution failures. The platform re-validates the address before each notification attempt.

  • You can include your own query parameters, but you cannot use the following reserved names: taskId, status, timestamp, taskType, success, or signature. Using any of these will result in a 400 error.

  • Custom request headers and authentication methods are not supported. If you need to distinguish the source of the notification, include your own identifiers in the URL's path or query parameters.

6.2 Notification request

When a task reaches a final asynchronous state of SUCCEEDED or FAILED, the platform sends an HTTP GET request to your callback_url. The following query parameters are appended to the URL. The request has no request body.

GET {callback_url}?taskId=20261026-550e8400-e29b-41d4-a716-446655440000&status=SUCCEEDED&timestamp=1792987202000&taskType=ASR_ASYNC_TASK&success=true&signature=xxx

Parameter

Type

Description

taskId

string

The platform task ID, which is the same as the output.task_id from the submission response.

status

string

The final state of the task: SUCCEEDED or FAILED.

timestamp

integer

The time of this notification attempt in Unix milliseconds. A new timestamp is generated for each retry.

taskType

string

Fixed value: ASR_ASYNC_TASK.

success

boolean

true if the status is SUCCEEDED; otherwise, false.

signature

string

The signature. See section 6.3 for details.

After receiving a notification, call the query API with the taskId to retrieve the transcription_url and usage details on success, or the output.code and output.message on failure.

The callback only notifies you of the final asynchronous state of successfully submitted tasks. Rejections, timeouts, or other exceptions during the submission phase, which return a synchronous error, do not trigger a callback. Notifications for PENDING or RUNNING states are also not sent. A notification might arrive before the 202 response from the submission request or even if the 202 response is lost. Cache and associate notifications by their taskId.

Verify the final state by calling the authenticated query API.

6.3 Signature verification

signature = Base64(MD5(UTF8("taskId={taskId}&timestamp={timestamp}&userId={userId}")))
  • Use the decoded values of taskId and timestamp from the notification request's query parameters. The userId is the user ID associated with the API key used to submit the task. Refer to your provisioning information for this ID.

  • The signature does not include a secret key. It only verifies that the parameters have not been tampered with and does not prove the request originated from the platform. Do not change your application's business state based solely on callback parameters. Always confirm the task_status by calling the authenticated query API.

6.4 Response and retries

  • The platform considers the notification delivered upon receiving any 2xx status code from your endpoint. Return a 200 or 204 status code as quickly as possible. Do not wait for the result download to complete before responding. The platform does not parse the response body.

  • The platform retries the notification if it receives a non-2xx response (including 3xx redirects), or if the connection fails or times out. It retries at intervals of approximately 1, 5, and 30 minutes after the first failure. The platform makes four attempts in total (the initial request plus three retries) before ceasing delivery.

  • Each notification attempt has a connection timeout of 10 seconds and a total request timeout of 30 seconds. The platform does not follow redirects and does not send cookies or authentication information. If the URL resolves to a non-public address during an attempt, the platform halts delivery.

  • You may receive duplicate notifications for the same task. Handle these requests idempotently based on the taskId and status. Always return a 2xx status code for duplicate notifications.

The callback is a best-effort notification. The platform does not persist delivery status, so notifications may be lost during service restarts, scaling events, or if a backlog occurs. Interfaces for re-delivery or replay are not provided. A failed callback does not affect the recognition result or metering. Implement a fallback mechanism that uses active polling to query the task status, though you can use a longer polling interval. For security, do not log the full callback URL or the signature.