struct
AI::OpenAI::OpenAISpeechRequest
- AI::OpenAI::OpenAISpeechRequest
- Struct
- Value
- Object
Overview
Request body for OpenAI speech generation API.
https://platform.openai.com/docs/api-reference/audio/createSpeech
Included Modules
- JSON::Serializable
Defined in:
ai/openai/speech/openai_speech_api.crConstructors
- .new(model : String, input : String, voice : String, response_format : String | Nil = nil, speed : Float64 | Nil = nil, instructions : String | Nil = nil)
- .new(pull : JSON::PullParser)
- .new(*, __pull_for_json_serializable pull : JSON::PullParser)
Instance Method Summary
-
#input : String
The text to generate audio for.
-
#instructions : String | Nil
Instructions for the speech generation.
-
#model : String
One of the available TTS models: tts-1, tts-1-hd, gpt-4o-mini-tts.
-
#response_format : String | Nil
The format to return audio in.
-
#speed : Float64 | Nil
The speed of the generated audio.
-
#voice : String
The voice to use when generating the audio.
Constructor Detail
def self.new(model : String, input : String, voice : String, response_format : String | Nil = nil, speed : Float64 | Nil = nil, instructions : String | Nil = nil)
#
Instance Method Detail
def instructions : String | Nil
#
Instructions for the speech generation. Does not work with tts-1 or tts-1-hd.
def response_format : String | Nil
#
The format to return audio in. Supported formats: mp3, opus, aac, flac, wav, pcm. Default: mp3
def speed : Float64 | Nil
#
The speed of the generated audio. Select a value from 0.25 to 4.0. Default: 1.0
def voice : String
#
The voice to use when generating the audio. Supported voices: alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, verse.