provider Audio POST /audio/speech
@utdk/openai /audio/speech
Generates audio from the input text.

Try it

Authentication
Configure credentials for OpenAI API
Gateway
The gateway proxies requests and injects credentials server-side. Configure credentials above, then enter your gateway URL.

Saved automatically to browser storage.

createspeech
POST/audio/speech

Input

required

One of the available [TTS models](/docs/models#tts): `tts-1`, `tts-1-hd` or `gpt-4o-mini-tts`.

required

The text to generate audio for. The maximum length is 4096 characters.

Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`.

required

The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`.

The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default.

Enter a gateway URL above to enable sending.

Code snippet
Updates live as you fill in the form above.

TypeScript

import openai from '@utdk/openai';

await openai.createspeech({
  "response_format": "mp3",
  "speed": 1
})