Skip to main content
WebSocket

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 DASHSCOPE_API_KEY. Use an API key from the same region as your workspace.
  2. Create a .NET 10 console project and install the SDK as described above. 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.
Set the Singapore endpoint. For supported regions and endpoints, see WebSocket access. This example uses qwen3.8-omni-flash-realtime with the Tina voice.
# Singapore (ap-southeast-1). For another region, replace ap-southeast-1 in the URL.
# API keys are region-specific. See https://docs.qwencloud.com/developer-guides/getting-started/regions
export DASHSCOPE_REALTIME_URL="wss://ap-southeast-1.maas.qwencloudapi.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.