Generate speech
generate_speechConvert text into spoken audio with OpenAI text-to-speech models, saving the file and returning its path by default or returning inline base64 audio when needed.
Instructions
Convert text to spoken audio using an OpenAI text-to-speech model. By default returns the local file path the audio was saved to rather than inline data; set returnAs to 'base64' for inline audio instead
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | The text to convert to speech (max 4096 characters) | |
| model | Yes | OpenAI model to use for speech generation | |
| speed | No | Playback speed from 0.25 to 4.0 (default 1.0) | |
| voice | No | Voice to use, e.g. alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, verse, marin, or cedar | alloy |
| format | No | Audio file format to generate | mp3 |
| returnAs | No | How to return the generated audio. 'path' (default) saves it to disk and returns its file path, avoiding the large inline payloads that can exceed an MCP client's tool result size limit. 'base64' returns the audio data inline instead | path |
| outputPath | No | File path to save the audio to when returnAs is 'path'. Ignored when returnAs is 'base64'. Defaults to a temp file if omitted | |
| instructions | No | Optional guidance on tone, style, or delivery. Ignored by tts-1 and tts-1-hd |