Skip to content

Audio

Purpose

This section documents the Audio endpoints and common usage patterns.

Key concepts

  • Inputs and outputs
  • Model and parameter compatibility
  • Streaming (when supported)

Minimal example

bash
# POST /v1/audio/speech
curl https://api.fastapi.ai/v1/audio/speech \
  -H "Authorization: Bearer $FAST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4o-mini-tts","input":"Hello!","voice":"alloy"}' \
  --output speech.mp3

Common pitfalls

  • Ensure your Authorization header is set for every request.
  • Use the correct Content-Type for the endpoint.
  • For streaming, handle SSE events and error events.

那年我双手插兜, 让bug稳如老狗