Documentation
API Reference
POST
Audio Speech (TTS)
/v1/audio/speech
Generate audio from input text using a variety of Text-to-Speech (TTS) models.
Interactive Example
Request Example
Headers
Authorization
stringRequired
Bearer token for authentication.
Content-Type
stringRequired
The content type of the request body.
Default: application/json
Request Body
model
stringRequired
ID of the TTS model to use. Must be of type
audio/speech
.input
stringRequired
The text to synthesize into speech. The maximum length (in characters or tokens) is determined by your subscription plan. Exceeding the limit will result in an error.
voice
stringRequired
The voice to use for the audio generation. Available voices are specific to the chosen model and are listed on the Models page.
response_format
stringThe format of the audio output. Supported formats:
mp3
, opus
, aac
, flac
, wav
, pcm
.Default: mp3
speed
numberThe speed of the generated audio. Must be between 0.25 and 4.0.
Default: 1
instructions
stringOptional provider-specific instructions on how the speech should be delivered.
Response Body (200 OK)
Raw Audio File
A successful request returns the raw audio data directly in the response body. It does not return a JSON object. The `Content-Type` header of the response will correspond to the `response_format` you requested (e.g., `audio/mpeg` for mp3).
Was this page helpful?