Skip to content

Create Speech gpt-4o-mini-tts

POST https://www.kkiai.com/v1/audio/speech

Official documentation: https://platform.openai.com/docs/guides/text-to-speech

Request Parameters

Authorization

Add the Authorization parameter to the Header. Its value is the Token concatenated after Bearer.

Example: Authorization: Bearer YOUR_API_KEY

Body Parameters (application/json)

ParameterTypeRequiredDescription
modelstringRequiredOne of the available TTS models: tts-1 or tts-1-hd
inputstringRequiredThe text to generate audio for. Maximum length is 4096 characters.
voicestringRequiredThe voice to use when generating the audio. Supported voices are: alloy, echo, fable, onyx, nova, and shimmer.
response_formatstringOptionalThe format of the audio. Defaults to mp3. Supported formats are: mp3, opus, aac, and flac.
speednumberOptionalThe speed of the generated audio. Defaults to 1. Select a value between 0.25 and 4.0. 1.0 is the default value.

Request Example

json
{
    "model": "gpt-4o-mini-tts",
    "input": "The quick brown fox jumped over the lazy dog.",
    "voice": "alloy"
  }

cURL Example

bash
curl --location --request POST 'https://www.kkiai.com/v1/audio/speech' \
--header 'Authorization: Bearer <token>' \
--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

Response Example

json
{}