Class SpeechRequest
Generates audio from the input text.
Namespace: Glitch9.AIDevKit.OpenAI
Assembly: .dll
Syntax
public class SpeechRequest : OpenAIRequest
Properties
Prompt
Required. The input text to generate audio for. The maximum length is 4096 characters.
Declaration
public string Prompt { get; set; }
Property Value
Type | Description |
---|---|
string |
ResponseFormat
The format of the response.
Declaration
public AudioEncoding? ResponseFormat { get; set; }
Property Value
Type | Description |
---|---|
AudioEncoding? |
Speed
The speed of the generated audio. Select a value from 0.25 to 4.0.
Declaration
public float? Speed { get; set; }
Property Value
Type | Description |
---|---|
float? |
Remarks
1.0 is the default.
StreamFormat
Optional. Defaults to audio. Set this value to stream the audio response instead of returning it as a single response. The format to stream the audio in. Supported formats are sse and audio. sse is not supported for tts-1 or tts-1-hd.
Declaration
public AudioStreamFormat? StreamFormat { get; set; }
Property Value
Type | Description |
---|---|
AudioStreamFormat? |
Voice
Required. 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.
Declaration
public Voice Voice { get; set; }
Property Value
Type | Description |
---|---|
Voice |
Methods
ValidateRequestBody()
Validate the request. This is used to check if all required properties are set. Fix the request if needed.
Declaration
public override void ValidateRequestBody()