class

OpenAI::CreateSpeechRequest

Inherits JSON::Serializable < Reference < Object

Constructors

new(model : CreateSpeechRequestModel = "", input : String = "", instructions : String | Nil = nil, voice : VoiceIdsShared = String.new, response_format : CreateSpeechRequestResponseFormat | Nil = nil, speed : Float64 | Nil = nil, stream_format : CreateSpeechRequestStreamFormat | Nil = nil)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

input

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

Source
input=(input : String)

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

Source
instructions

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

Source
instructions=(instructions : String | Nil)

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

Source
model

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

Source
model=(model : CreateSpeechRequestModel)

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

Source
response_format

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

Source
response_format=(response_format : CreateSpeechRequestResponseFormat | Nil)

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

Source
speed

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

Source
speed=(speed : Float64 | Nil)

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

Source
stream_format

The format to stream the audio in. Supported formats are sse and audio. sse is not supported for tts-1 or tts-1-hd.

Source
stream_format=(stream_format : CreateSpeechRequestStreamFormat | Nil)

The format to stream the audio in. Supported formats are sse and audio. sse is not supported for tts-1 or tts-1-hd.

Source
validate!
Source
voice

The voice to use when generating the audio. Supported voices are alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, and verse. Previews of the voices are available in the Text to speech guide.

Source
voice=(voice : VoiceIdsShared)

The voice to use when generating the audio. Supported voices are alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, and verse. Previews of the voices are available in the Text to speech guide.

Source