Skip to content
中文

Create Speech (TTS)

Method: POSTEndpoint: /v1/audio/speech

Streaming responses are supported, so you can read the output while playing it.

Request Parameters

Header Parameters

text
Authorization
string
Optional
Default Value:
Bearer {{YOUR_API_KEY}}

Body Parameters application/json

text
model
string
Required
One of the available TTS models: tts-1 or tts-1-hd
input
string
Required
Text to generate audio from. Maximum length: 4096 characters.
voice
string
Required
Voice used for audio generation. Supported voices: alloy, echo, fable, onyx, nova, and shimmer.
response_format
string
Optional
Audio format. Defaults to mp3. Supported formats: mp3, opus, aac, and flac.
speed
number
Optional
Audio speed. Defaults to 1.0. Choose a value between 0.25 and 4.0.
Example
{
"model"
:
"gpt-4o-mini-tts"
,
"input"
:
"The quick brown fox jumped over the lazy dog."
,
"voice"
:
"alloy"
}

Example Request

Shell

bash
curl --location --request POST '/v1/audio/speech' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gpt-4o-mini-tts",
    "input": "The quick brown fox jumped over the lazy dog.",
    "voice": "alloy"
}'

Response

🟢 200 Success

Content Type: application/json

Response Schema

text
object

Example

json
{}