Skip to main content
POST
/
audio
/
speech
Generate speech from text
curl --request POST \
  --url https://api.anyapi.ai/v1/audio/speech \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "MODEL_EXAMPLE",
  "input": "The quick brown fox jumped over the lazy dog.",
  "voice": "alloy"
}'
This response does not have an example.

Authorizations

Authorization
string
header
required

Bearer token authentication. Get your API key from the dashboard.

Body

application/json
model
string
required

One of the available TTS models

Example:

"gpt-4o-mini-tts"

input
string
required

The text to generate audio for. The maximum length is 4096 characters

Maximum length: 4096
voice
enum<string>
required

The voice to use when generating the audio

Available options:
alloy,
echo,
fable,
onyx,
nova,
shimmer
response_format
enum<string>
default:mp3

The format to audio in

Available options:
mp3,
opus,
aac,
flac,
wav,
pcm
speed
number
default:1

The speed of the generated audio

Required range: 0.25 <= x <= 4

Response

The audio file content

The response is of type file.

I