Skip to main content

Qwen-Omni-Realtime C# SDK

Use the C# SDK to call Qwen-Omni-Realtime over WebSocket. The examples use audio input and return text and audio.

Install the SDK

Download and extract Bailian.DashScope-1.1.0.zip. To use the SDK in a C# project, install it from the local NuGet source.

Quickstart

  1. Get an API key and set the DASHSCOPE_API_KEY environment variable.
  2. Create a .NET 10 console project, install the SDK, and copy the complete C# example into Program.cs.
  3. Place input.pcm in the project directory. Use 16 kHz, mono, 16-bit little-endian raw PCM. Convert WAV files to raw PCM first.
qwen3.8-omni-flash-realtime uses a workspace-specific domain. Replace WorkspaceId with the workspace ID for your API key. This example uses China (Beijing) and the Tina voice. For endpoint details, see WebSocket access.
export DASHSCOPE_REALTIME_URL="wss://WorkspaceId.cn-beijing.maas.aliyuncs.com/api-ws/v1/realtime"
dotnet run -- input.pcm qwen3.8-omni-flash-realtime Tina
The terminal displays the response text and writes the response audio to output.pcm.

Model configuration and session lifecycle

See the C# SDK API reference for options, methods, and events. Call FinishAsync after the final ResponseCompleted event. The SDK chooses CloseOnly for Omni Realtime and ends the session by closing the connection. To send image frames, use SendRawEventAsync to send complete events. For configuration, input formats, and event order, see Omni Realtime WebSocket access.