Skip to content
Tracon

OpenAISpeechOptions

Namespace Tracon · Assembly Tracon.OpenAI.dll

Settings of OpenAISpeechBuilderExtensions.UseOpenAISpeech.

public sealed class OpenAISpeechOptions
Inheritance
object ← OpenAISpeechOptions
Inherited Members
object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

At least one of OpenAISpeechOptions.SynthesisModel and OpenAISpeechOptions.TranscriptionModel must be set.

public OpenAISpeechOptions()

Gets or sets the most characters one synthesis call accepts. Default 4096, the limit the OpenAI documentation states for the speech endpoint.

public int MaxCharactersPerRequest { get; set; }

int

Gets or sets the text-to-speech model, for example gpt-4o-mini-tts. A synthesizer is registered when this is set.

public string? SynthesisModel { get; set; }

string?

The registration is bound to this model. A request that names another model is refused: the OpenAI audio client ignores a per-request model. To use a second model, register a second name with another call.

Gets or sets the registration name of the synthesizer. A caller selects it with "provider": "openai" on POST /api/voice/speak. Default openai.

public string SynthesizerName { get; set; }

string

Gets or sets the registration name of the transcriber. Transcriber names are separate from synthesizer names. Default openai.

public string TranscriberName { get; set; }

string

Gets or sets the speech-to-text model, for example gpt-4o-mini-transcribe. A transcriber is registered when this is set.

public string? TranscriptionModel { get; set; }

string?

The same rule as OpenAISpeechOptions.SynthesisModel: the registration is bound to this model.

Gets or sets whether the registered synthesizer and transcriber are also the unnamed default ones. Default false.

public bool UseAsDefault { get; set; }

bool

The unnamed default serves the speak and transcribe tools and the live conversation. It is registered with TryAdd: a default that is already there stays, so call UseOpenAISpeech before UseVoice to make OpenAI the default.

The speak and transcribe tools send Tracon:Voice:SynthesisModelId and TranscriptionModelId to the default engine, and a registration is bound to one model. Leave both empty, or set them to the OpenAI models named here, or the tool call fails with a message that names both models.

Gets the voices GET /api/voice/voices lists for the synthesizer. Empty by default.

public IList<VoiceDescriptor> Voices { get; }

IList<VoiceDescriptor>

A static declaration: the speech endpoint has no voice list. The service refuses a request without a voice, so a call that names none is spoken in alloy.