struct

AI::OpenAI::OpenAISpeechRequest

Inherits JSON::Serializable < Struct < Value < Object

Request body for OpenAI speech generation API.

https://platform.openai.com/docs/api-reference/audio/createSpeech

Constructors

new(model : String, input : String, voice : String, response_format : String | Nil = nil, speed : Float64 | Nil = nil, instructions : String | Nil = nil)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

input

The text to generate audio for. Max 4096 characters.

Source
instructions

Instructions for the speech generation. Does not work with tts-1 or tts-1-hd.

Source
model

One of the available TTS models: tts-1, tts-1-hd, gpt-4o-mini-tts.

Source
response_format

The format to return audio in. Supported formats: mp3, opus, aac, flac, wav, pcm. Default: mp3

Source
speed

The speed of the generated audio. Select a value from 0.25 to 4.0. Default: 1.0

Source
voice

The voice to use when generating the audio. Supported voices: alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, verse.

Source