
| Format | Streamed | Buffered | Use it for |
|---|---|---|---|
pcm | Yes | Yes | Low-level audio pipelines |
mp3 | Yes | Yes | Playback and compact storage |
wav | No | Yes | A complete file with a RIFF header |
PCM output is signed 16-bit little-endian mono audio. MP3 uses the audio/mpeg content type. WAV must be requested with stream=False.
Python
speech = client.audio.speech.create(
model="teen-v1",
voice="default",
input="Return a WAV file.",
response_format="wav",
stream=False,
)
speech.write_to_file("speech.wav")Provider format names are translated only when they map to PCM, MP3, or WAV. Other codecs raise UnsupportedAudioFormatError.
On this page