CodingKeys
AudioSpeechQuery.swift:57enum CodingKeys
enum CodingKeys
import OpenAI
struct AudioSpeechQuery
Generates audio from the input text. Learn more: OpenAI Speech – Documentation
case model
case input
case voice
case responseFormat
case speed
init(from decoder: any Decoder) throws
init(model: Model, input: String, voice: AudioSpeechVoice, responseFormat: AudioSpeechResponseFormat = .mp3, speed: Double?)
static func normalizeSpeechSpeed(_ inputSpeed: Double?) -> String
let input: String
The text to generate audio for. The maximum length is 4096 characters.
let model: Model
One of the available TTS models: tts-1 or tts-1-hd
let responseFormat: AudioSpeechResponseFormat?
The format to audio in. Supported formats are mp3, opus, aac, flac, and pcm. Defaults to mp3
let speed: String?
The speed of the generated audio. Select a value from 0.25 to 4.0. 1.0 is the default. Defaults to 1
let voice: AudioSpeechVoice
The voice to use when generating the audio. Supported voices are alloy, echo, fable, onyx, nova, and shimmer. Previews of the voices are available in the Text to speech guide. https://platform.openai.com/docs/guides/text-to-speech/voice-options
enum AudioSpeechResponseFormat
Encapsulates the response formats available for audio data.
enum AudioSpeechVoice
Encapsulates the voices available for audio generation.
enum Speed
protocol CodingKey : CustomDebugStringConvertible, CustomStringConvertible, Sendable
A type that can be used as a key for encoding and decoding.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
protocol Sendable
init?(intValue: Int)
init?(rawValue: String)
init?(stringValue: String)
var debugDescription: String { get }
A textual representation of this key, suitable for debugging.
var description: String { get }
A textual representation of this key.
var hashValue: Int { get }
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
func hash(into hasher: inout Hasher)