Paraformer C# SDK

Updated at:

Use the C# SDK to transcribe audio files with Paraformer 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 paraformer-v2 and prints the text.

using DashScope.Transcription;

using var client = new FunAsrFileTranscriber(new FileTranscriberOptions
{
    Url = "https://WorkspaceId.cn-beijing.maas.aliyuncs.com/api/v1/services/audio/asr/transcription",
});

var request = new FileTranscriptionRequest
{
    Model = "paraformer-v2",
    FileUrls = ["https://dashscope.oss-cn-beijing.aliyuncs.com/samples/audio/paraformer/hello_world_female2.wav"],
};
var results = await client.TranscribeAsync(request);
foreach (var result in results)
    foreach (var channel in result.Transcription.Transcripts)
        Console.WriteLine(channel.Text);

Call workflow

In the quick start, TranscribeAsync submits the task, waits for completion, and downloads the results. To obtain the task ID first, use these steps:

  1. Create a FunAsrFileTranscriber and set FileTranscriberOptions.Url to your workspace transcription endpoint.
  2. Create a FileTranscriptionRequest and set Model to paraformer-v2. Pass one publicly accessible HTTP(S) audio URL in FileUrls. Each request accepts only one URL.
  3. Call SubmitAsync and save the returned TaskId.
  4. Call WaitForCompletionAsync to wait for completion, or QueryAsync to check the status once.
  5. Check SubtaskStatus for each entry in Results. For each successful subtask, pass its TranscriptionUrl to DownloadTranscriptionAsync and read the text from Transcripts.

For methods and result objects, see Methods and events.

Request parameters

The table lists the FileTranscriptionRequest 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-filetrans

Model ID.

NoteSet the model ID explicitly for this family, for example paraformer-v2. Otherwise, the SDK uses the default shown in the table.

FileUrls

IList<string>

[]

Required. List of publicly accessible HTTP(S) URLs for the audio to transcribe.

NoteEach request accepts only one URL.

VocabularyId

string?

null

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

NoteFor the Paraformer v2 series, use a vocabulary that matches the model. For regional availability, see Supported models and regions.

ChannelId

IList<int>?

null

Zero-based indices of the audio tracks to transcribe. If omitted, only the first track is processed.

NoteEach selected track is billed separately.

SpecialWordFilter

string?

null

Sensitive-word filter rules as a JSON string. Replace matching words with the same number of asterisks or remove them.

DiarizationEnabled

bool?

null

Enables speaker diarization. Off by default.

NoteOnly mono audio is supported. When diarization is enabled, audio of up to two hours is recommended.

SpeakerCount

int?

null

Expected number of speakers. If omitted, the service detects the number automatically.

NoteApplies only when DiarizationEnabled is true. Use an integer from 2 to 100. The number of speakers detected may differ.

LanguageHints

IList<string>?

null

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

NoteApplies only to paraformer-v2.

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. For example, {"disfluency_removal_enabled":true} enables disfluency removal.