Table of Contents

Class SpeechRequest

Namespace
OpenAI.Audio
Assembly
OpenAI-DotNet.dll
public sealed class SpeechRequest
Inheritance
SpeechRequest
Inherited Members

Constructors

SpeechRequest(string, Model, Voice, SpeechResponseFormat, float?)

Constructor.

public SpeechRequest(string input, Model model = null, Voice voice = null, SpeechResponseFormat responseFormat = SpeechResponseFormat.MP3, float? speed = null)

Parameters

input string

The text to generate audio for. The maximum length is 4096 characters.

model Model

One of the available TTS models. Defaults to tts-1.

voice Voice

The voice to use when generating the audio.

responseFormat SpeechResponseFormat

The 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

string

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

string

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

SpeechResponseFormat

Speed

The speed of the generated audio. Select a value from 0.25 to 4.0. 1.0 is the default.

[JsonPropertyName("speed")]
[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

float?

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; }

Property Value

string