From 00ef6288d38185805847fd46755b940aab1e529d Mon Sep 17 00:00:00 2001 From: Alvaro Balbin <153404840+AlvaroBalbin@users.noreply.github.com> Date: Wed, 29 Jul 2026 01:26:25 +0100 Subject: [PATCH] docs: iterate audio chunks in text-to-speech snippets --- README.md | 3 ++- docs/Migrating-v3-to-v5.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fb08dbef..1199054d 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,8 @@ response = client.speak.v1.audio.generate( # Save the audio file with open("output.mp3", "wb") as audio_file: - audio_file.write(response.stream.getvalue()) + for chunk in response: + audio_file.write(chunk) ``` #### Text Analysis diff --git a/docs/Migrating-v3-to-v5.md b/docs/Migrating-v3-to-v5.md index 70b11ddb..33bed249 100644 --- a/docs/Migrating-v3-to-v5.md +++ b/docs/Migrating-v3-to-v5.md @@ -316,7 +316,8 @@ response = client.speak.v1.audio.generate( # Save the audio file with open("output.mp3", "wb") as audio_file: - audio_file.write(response.stream.getvalue()) + for chunk in response: + audio_file.write(chunk) ``` #### WebSocket Streaming (Speak V1)