Class SpeechRequest
public sealed class SpeechRequest
- Inheritance
-
SpeechRequest
- Inherited Members
Constructors
SpeechRequest(string, Model, Voice, SpeechResponseFormat, float?)
[Obsolete("use new .ctr overload with instructions parameter")]
public SpeechRequest(string input, Model model, Voice voice, SpeechResponseFormat responseFormat, float? speed = null)
Parameters
input
stringmodel
Modelvoice
VoiceresponseFormat
SpeechResponseFormatspeed
float?
SpeechRequest(string, Model, Voice, string, SpeechResponseFormat, float?)
Constructor.
public SpeechRequest(string input, Model model = null, Voice voice = null, string instructions = null, SpeechResponseFormat responseFormat = SpeechResponseFormat.MP3, float? speed = null)
Parameters
input
stringThe text to generate audio for. The maximum length is 4096 characters.
model
ModelOne of the available TTS models. Defaults to tts-1.
voice
VoiceThe voice to use when generating the audio.
instructions
stringControl the voice of your generated audio with additional instructions. Does not work with tts-1 or tts-1-hd.
responseFormat
SpeechResponseFormatThe format to audio in. Supported formats are mp3, opus, aac, flac, wav and pcm.
speed
float?The speed of the generated audio. Select a value from 0.25 to 4.0. 1.0 is the default.
Properties
Input
The text to generate audio for. The maximum length is 4096 characters.
[JsonPropertyName("input")]
[FunctionProperty("The text to generate audio for. The maximum length is 4096 characters.", true, null, new object[] { })]
public string Input { get; }
Property Value
Instructions
Control the voice of your generated audio with additional instructions. Does not work with tts-1 or tts-1-hd.
[JsonPropertyName("instructions")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[FunctionProperty("Control the voice of your generated audio with additional instructions. Does not work with tts-1 or tts-1-hd.", false, null, new object[] { })]
public string Instructions { get; }
Property Value
Model
One of the available TTS models. Defaults to tts-1.
[JsonPropertyName("model")]
[FunctionProperty("One of the available TTS models. Defaults to tts-1.", true, "tts-1", new object[] { "tts-1-hd" })]
public string Model { get; }
Property Value
ResponseFormat
The format to audio in. Supported formats are mp3, opus, aac, flac, wav and pcm.
[JsonPropertyName("response_format")]
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
[JsonConverter(typeof(JsonStringEnumConverter<SpeechResponseFormat>))]
[FunctionProperty("The format to audio in. Supported formats are mp3, opus, aac, flac, wav and pcm.", false, SpeechResponseFormat.MP3, new object[] { })]
public SpeechResponseFormat ResponseFormat { get; }
Property Value
Speed
The speed of the generated audio. Select a value from 0.25 to 4.0. 1.0 is the default.
[JsonPropertyName("speed")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[FunctionProperty("The speed of the generated audio. Select a value from 0.25 to 4.0. 1.0 is the default.", false, 1, new object[] { })]
public float? Speed { get; }
Property Value
Voice
The voice to use when generating the audio.
[JsonPropertyName("voice")]
[FunctionProperty("The voice to use when generating the audio.", true, "alloy", new object[] { "echo", "fable", "onyx", "nova", "shimmer" })]
public string Voice { get; }