Use the Ruby SDK with Qwen-Audio-Realtime to send a recording and save the spoken response.
Prerequisites
Install the Ruby SDK and configure your API key. Replace WorkspaceId with your workspace ID in Singapore and use an API key from the same region.
Quick start
Save the example as example.rb and run ruby example.rb.
SDK reference
| Option | Description |
|---|---|
model, url, voice | Model ID, Realtime WebSocket endpoint, and a voice supported by the model. |
turn_detection_mode | Turn detection mode. Defaults to :server_vad. In :push_to_talk mode, the app triggers each response. |
connect and use pump to read events. Wait for session.updated before sending audio with append_audio. After on_response_completed, call finish to close the session.
Use 16 kHz, 16-bit, mono raw PCM input. Choose a voice supported by the model. Trailing silence lets server-side VAD detect the end of the turn.