Qwen-Audio-ASR C# SDK

Updated at:

Use the C# SDK to transcribe audio files with Qwen-Audio-ASR and retrieve the results.

Quick start

Follow SDK overview to install the SDK and configure your API key. Replace WorkspaceId in the example endpoint with your workspace ID from the same region.

This example transcribes an audio file with qwen-audio-3.1-asr-flash and prints the text.

using DashScope.Transcription;

using var client = new FunAsrFlashFileTranscriber(new FlashFileTranscriberOptions
{
    Url = "https://WorkspaceId.cn-beijing.maas.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation",
});
var request = new FlashTranscriptionRequest
{
    Model = "qwen-audio-3.1-asr-flash",
    Audio = "https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav",
    Format = "wav",
};

var result = await client.TranscribeAsync(request);
Console.WriteLine(result.Text);

Call workflow

  1. Create a FunAsrFlashFileTranscriber and set FlashFileTranscriberOptions.Url to your workspace endpoint.

  2. Create a FlashTranscriptionRequest and set Model to qwen-audio-3.1-asr-flash. Set Audio to a public URL, a data URI, or a local file path. Match Format to the input format. For raw PCM, set SampleRate to the actual sample rate.

  3. Call TranscribeAsync and read the complete transcript from Text in the result.

  4. To receive results over SSE instead, call TranscribeStreamingAsync and read the results with await foreach.

    NoteWith qwen-audio-3.0-asr-flash, multiple updates are returned only for audio at least one minute long.

For methods and result objects, see Methods and events.

Request parameters

The table lists the FlashTranscriptionRequest properties supported by this model family. Defaults are the initial SDK property values. For protocol fields, see HTTP API.

ParameterTypeDefaultDescription

Model

string

qwen-audio-3.1-asr-flash

Model ID.

Audio

string

null

Required. A public audio URL, a Base64 data URI, or a local file path. For a local path, the SDK reads the file and converts it to a data URI.

Format

string

wav

Input audio format, such as wav, mp3, or pcm. Set it to match the audio.

SampleRate

int?

null

Audio sample rate in Hz.

NoteFor raw PCM, set this property to the actual sample rate of the recording.

VocabularyId

string?

null

ID of a precompiled vocabulary that can be reused across requests.

NoteFor regional availability, see Supported models and regions.

Vocabulary

IDictionary<string, int>?

null

Instant hotwords, specified as a map from hotword text to integer weight.

NoteUse weights of 1–5 for regular hotwords or 50 for super hotwords. You can specify up to 50 super hotwords. When you also specify a precompiled vocabulary, the service merges both sets. If the total exceeds 2,000, it selects 2,000 hotwords at random. For regional availability, see Supported models and regions.

LanguageHints

IList<string>?

null

Language hints for recognition, for example ["zh"].

NoteOnly the first four values take effect.

KeepDialect

bool?

null

Set to true to preserve dialect expressions. By default, dialect speech is transcribed into Mandarin.

NoteApplies only to qwen-audio-3.1-asr-flash.

SpeakerDiarizationEnabled

bool?

null

Enables speaker diarization.

NoteApplies only to qwen-audio-3.1-asr-flash. When enabled, KeepDialect and LanguageHints have no effect.

Context

IList<FlashContextMessage>?

null

Use FlashContextMessage.Role and FlashContextMessage.Text to set the role and text.

NotePut each user message before the corresponding assistant message. Only the five most recent messages of each type are retained, with up to 400 characters of text per turn.

ExtraParametersJson

string?

null

Pass additional parameters as a JSON object serialized to a string. The SDK merges its fields into the request’s parameters object. Use only protocol fields supported by the model.