Перейти к содержимому

Text to speech

POST
/audio/speech
curl --request POST \
--url https://example.com/audio/speech \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "input": "Hello there!", "model": "tts-1", "voice": "alloy" }'

OpenAI-compatible TTS. Returns mp3 audio. Served by gpt-4o-mini-tts; OpenAI voices (alloy, echo, fable, nova, shimmer, …) are accepted. Charged per input characters.

Media typeapplication/json
SpeechRequest
object
model
Model

Accepted for compatibility; served by gpt-4o-mini-tts.

string
default: tts-1
input
required
Input

Text to synthesize.

string
voice
Voice

Alloy, echo, fable, nova, shimmer, … (unknown → default).

string
default: alloy
response_format
Any of:
string
speed
Any of:
number
Example
{
"input": "Hello there!",
"model": "tts-1",
"voice": "alloy"
}

Successful Response

Media typeapplication/json
Examplegenerated
example

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Examplegenerated
{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example",
"input": "example",
"ctx": {}
}
]
}