apicheats.dev openai/llms.txt Raw .md
POST

POST /audio/speech — OpenAI API

OpenAI API key (required); https://api.openai.com/v1

OpenAI API

Create speech

Base URL
https://api.openai.com/v1
Auth
Authorization: Bearer <OPENAI_API_KEY>
Last verified
2026-10-20 · upstream hash matched
Actions Try in browser→
Agents: curl -H "Accept: text/markdown" this URL
→ 359 tokens · Vary: Accept

Critical gotchas

The Responses API is the primary interface for new text and tool workflows; Chat Completions remains a separate compatibility API.

Audio transcription uploads use multipart form data rather than a JSON request body.

cURL

curl -X POST 'https://api.openai.com/v1/audio/speech' \  -H "Authorization: Bearer $OPENAI_API_KEY" \  -H 'Content-Type: application/json' \  -d '{  "model": "example-model",  "input": "example-input",  "voice": "ash"}'

Parameters

Name In Type Required Description
model body string Yes One of the available [TTS models](https://developers.openai.com/api/docs/guides/text-to-speech): `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`.
input body string Yes The text to generate audio for. The maximum length is 4096 characters.
instructions body string No Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`.
voice body string Yes 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.
response_format body string No The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`.
speed body number No The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default.
stream_format body string No The format to stream the audio in. Supported formats are `sse` and `audio`. `sse` is not supported for `tts-1` or `tts-1-hd`.

Response 200 OK

"binary"
Get a free OpenAI API key → sponsored

Affiliate link - we may earn a commission, at no extra cost to you.