Class SpeechRequest
Generates audio from the input text.
public class SpeechRequest : OpenAIRequest
- Inheritance
-
objectRESTRequestBodySpeechRequest
- Inherited Members
- Extension Methods
Properties
Prompt
Required. The input text to generate audio for. The maximum length is 4096 characters.
public string Prompt { get; set; }
Property Value
- string
ResponseFormat
The format of the response.
public AudioEncoding? ResponseFormat { get; set; }
Property Value
- AudioEncoding?
Speed
The speed of the generated audio. Select a value from 0.25 to 4.0.
public float? Speed { get; set; }
Property Value
- 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.
public AudioStreamFormat? StreamFormat { get; set; }
Property Value
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.
public Voice Voice { get; set; }
Property Value
Methods
ValidateRequestBody()
Validate the request. This is used to check if all required properties are set. Fix the request if needed.
public override void ValidateRequestBody()