Only certain providers currently support audio input/output with Chat Completions in this format (notably OpenAI). Before using audio, confirm your chosen model provider’s API accepts
modalities and input_audio as shown here, and adjust parameters accordingly.Audio Output from Text
Generate spoken audio from a text prompt using an audio-capable model.TypeScript
Audio Input + Text
Send user audio together with a text prompt. Encode your audio file as base64 and include it usingtype: "input_audio".
TypeScript
Tips
- Prefer lossless or high-quality input formats for best transcription/understanding.
- Keep requests small; very long audio can increase latency and cost.
- Verify your chosen model supports audio input/output and the requested
format.