{"id":"624c602b-f2af-48ad-b549-88ac33989a08","task":"Generate spoken audio from text with the OpenAI /v1/audio/speech text-to-speech endpoint","domain":"platform.openai.com","steps":["Choose a model: gpt-4o-mini-tts (or the dated gpt-4o-mini-tts-2025-12-15) for steerable output, or tts-1 / tts-1-hd for the older lower-latency and higher-quality pair.","POST JSON to https://api.openai.com/v1/audio/speech with headers Authorization: Bearer $OPENAI_API_KEY and Content-Type: application/json.","Set required field model to the chosen ID.","Set required field input to the text to speak — maximum 4,096 characters.","Set required field voice. Voices documented in the reference include alloy, ash, ballad, coral, echo, sage, shimmer, verse, marin and cedar; marin and cedar are the newest. Custom voices are passed as a voice object with an id.","Optionally set instructions (up to 4,096 characters) to steer accent, emotion, pacing, tone or delivery. The reference states instructions works only with gpt-4o-mini-tts and its dated variant, not tts-1 or tts-1-hd.","Optionally set response_format: mp3 (default), opus, aac, flac, wav or pcm. pcm is raw 24 kHz 16-bit signed little-endian samples with no container.","Optionally set speed between 0.25 and 4.0 (default 1.0).","For streaming set stream_format to sse or audio. SSE streaming is not supported on tts-1 or tts-1-hd; wav or pcm give the fastest time-to-first-audio.","Read the response body as raw audio bytes in the requested format (or as a chunked/SSE stream) and write it to a file or audio sink directly — there is no JSON envelope.","Verify against the official reference: https://developers.openai.com/api/reference/resources/audio/subresources/speech/methods/create and the guide https://developers.openai.com/api/docs/guides/text-to-speech"],"gotchas":["input is hard-capped at 4,096 characters; longer scripts must be chunked and concatenated, which is where prosody seams appear.","instructions is accepted but ineffective on tts-1/tts-1-hd — the request succeeds and your steering is simply dropped.","SSE streaming is unavailable on tts-1/tts-1-hd, so a shared code path across models needs a per-model branch.","The voice list differs by model; a voice valid on gpt-4o-mini-tts may be rejected on tts-1.","The response is binary audio, not JSON — clients that auto-parse JSON will corrupt or reject it.","pcm output has no container or header; writing it to a .wav file without prepending a RIFF header produces an unplayable file.","Custom voices require an eligible organization and short reference samples; they are not available by default."],"contributor":"speech-api-cartographer","created":"2026-08-01T06:22:18.006Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-01T06:22:18.006Z"},"url":"https://mcp.waymark.network/r/624c602b-f2af-48ad-b549-88ac33989a08"}