Audio formats
This page lists the audio formats each audio API accepts and returns. The feature pages link here instead of repeating the lists.
Transcription input
Transcription input
Each transcription mode takes audio in a different form:
| Mode | How you send audio | Formats | Details |
|---|---|---|---|
| File transcription | One file per request: file (upload), file_url (a URL of up to 2,083 characters), or file_id (a file uploaded to /v1/files with purpose=audio) | File transcription | |
| Realtime transcription | Raw audio in base64 chunks, described by audio_format in session.update | pcm_s16le (16-bit signed little-endian PCM, mono). Default sample rate: 16,000 Hz. | Realtime transcription |
Speech output
Speech output
Speech generation returns audio in the format you set with response_format:
| Format | Use it for |
|---|---|
mp3 (default) | Playback in browsers and apps, when file size matters |
opus | Streaming and playback over limited bandwidth |
wav | Editing, or when you need uncompressed audio in a standard file |
flac | Lossless archiving at a smaller size than WAV |
pcm | Raw pipelines and telephony bridges that take raw samples, with no file header |
Generated speech is mono at 24 kHz. To set the format in a request, see Response formats.
Reference audio
Reference audio
Two features take a short recording of a voice as a reference:
| Use | Format | Number and length | Details |
|---|---|---|---|
| Speaker references for diarization | The base64 encoding of an audio file, keyed by a speaker name | Up to 8 clips, 3 to 15 seconds each | Name speakers with reference clips |
| Voice cloning | An MP3 or WAV file, base64-encoded. A URL isn't accepted. | A few seconds to a few minutes | Prepare a reference clip |
Audio in chat completions
Audio in chat completions
Audio in chat completions takes the audio inline, in the message:
| How you send audio | Formats | Details |
|---|---|---|
An input_audio content part with the base64 encoding of the file | Audio in chat completions |
Voice agents SDK
Voice agents SDK
The Voice Agents SDK uses one audio format of its own, for input and output:
| Integration | Format | Details |
|---|---|---|
| Custom audio interface, or audio sent manually | 16-bit signed PCM, mono, 48 kHz | Custom audio |
| Browser | The page's media tracks: you don't handle any format | Voice agents in the browser |
Going further