OpenAIText to speechAvailable now

gpt-4o-mini-tts

gpt-4o-mini-tts is a text to speech tool from OpenAI that runs in the background and returns audio. Pay as you go from $0.00000078 per token, with one API key.

Try itfrom $0.00000078 / token

Pricing

About $0.00081 per run at the default inputs. $0.78 per 1M text input tokens, $15.60 per 1M audio output tokens. The final charge comes from usage.

Limits

Runs
In the background
Returns
audio
Longest queue wait
3600s
Run deadline
1800s
Largest inline input
1024 KB
Largest input file
500 MB
Largest output
4768 MB
Outputs per run
16

Input

FieldKindDefaultDescription
input requiredtext—The text to generate audio for. The maximum length is 4096 characters.
voice requiredJSON—The voice to use when generating the audio. Supported built-in voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the voices are available in the [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options). Custom voices must be created from audio samples. Voices created from text prompts are supported only in Live.
speednumber
0.25 to 4
1The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default.
instructionstext—Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`.
response_formatone of
mp3, opus, aac, flac, wav, pcm
mp3The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`.

Same request in code

curl https://api.spiral.ai/v1/runs \
  -H "Authorization: Bearer $SPIRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "provider": "openai",
    "model": "gpt-4o-mini-tts",
    "input": {
      "input": "<input>",
      "voice": {}
    }
  }'