Create speech
audio.speech.create(**kwargs) -> StringIO
POST/audio/speech
Generates audio from the input text.
Parameters
input: String
The text to generate audio for. The maximum length is 4096 characters.
maxLength4096
instructions: String
Control the voice of your generated audio with additional instructions. Does not work with tts-1 or tts-1-hd.
maxLength4096
speed: Float
The speed of the generated audio. Select a value from 0.25 to 4.0. 1.0 is the default.
minimum0.25
maximum4
Returns
StringIO
Create speech
require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
speech = openai.audio.speech.create(input: "input", model: :"tts-1", voice: :ash)
puts(speech)