struct AI::OpenAI::OpenAISpeechRequest

Overview

Request body for OpenAI speech generation API.

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

Included Modules

Defined in:

ai/openai/speech/openai_speech_api.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(model : String, input : String, voice : String, response_format : String | Nil = nil, speed : Float64 | Nil = nil, instructions : String | Nil = nil) #

[View source]
def self.new(pull : JSON::PullParser) #

[View source]
def self.new(*, __pull_for_json_serializable pull : JSON::PullParser) #

[View source]

Instance Method Detail

def input : String #

The text to generate audio for. Max 4096 characters.


[View source]
def instructions : String | Nil #

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


[View source]
def model : String #

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


[View source]
def response_format : String | Nil #

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


[View source]
def speed : Float64 | Nil #

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


[View source]
def voice : String #

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


[View source]