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:

ModeHow you send audioFormatsDetails
File transcriptionOne 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 transcriptionRaw audio in base64 chunks, described by audio_format in session.updatepcm_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:

FormatUse it for
mp3 (default)Playback in browsers and apps, when file size matters
opusStreaming and playback over limited bandwidth
wavEditing, or when you need uncompressed audio in a standard file
flacLossless archiving at a smaller size than WAV
pcmRaw 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:

UseFormatNumber and lengthDetails
Speaker references for diarizationThe base64 encoding of an audio file, keyed by a speaker nameUp to 8 clips, 3 to 15 seconds eachName speakers with reference clips
Voice cloningAn MP3 or WAV file, base64-encoded. A URL isn't accepted.A few seconds to a few minutesPrepare 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 audioFormatsDetails
An input_audio content part with the base64 encoding of the fileAudio in chat completions
Voice agents SDK

Voice agents SDK

The Voice Agents SDK uses one audio format of its own, for input and output:

IntegrationFormatDetails
Custom audio interface, or audio sent manually16-bit signed PCM, mono, 48 kHzCustom audio
BrowserThe page's media tracks: you don't handle any formatVoice agents in the browser
Going further

Going further