Skip to content
Tracon

VoiceOptions

Namespace Tracon · Assembly Tracon.Voice.dll

Settings for the voice tools.

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

The type cannot be a record: the compiler-generated ToString writes every property, and a single LogDebug("{Options}", o) call would leak VoiceOptions.ApiKey into the log. SecretLeakTests verifies the type does not define its own ToString.

public VoiceOptions()

Default output format.

public const string DefaultOutputFormat = "mp3_44100_128"

string

MP3 is chosen because the attachment store does type checking from the magic byte. pcm_* and ulaw_* outputs have no header and are rejected.

Default name of the configuration section.

public const string SectionName = "Tracon:Voice"

string

The API key. A secret: it lives only in dotnet user-secrets or an environment variable.

public string? ApiKey { get; set; }

string?

The key’s value is held here, not its name. The rule forbids writing secrets to the DATABASE; voice configuration never reaches the database, and the other four provider packages also carry a plain ApiKey.

Voice to use when the request gives no voice id.

public string? DefaultVoiceId { get; set; }

string?

The dialogue model of the built-in client. When empty, the request names none and the provider uses its own default.

public string? DialogueModelId { get; set; }

string?

VoiceOptions.SynthesisModelId is not used for a dialogue: the single-voice default (eleven_multilingual_v2) is not a dialogue model. A result made with the provider’s default reports no model, so its price is looked up without one.

Base address. When empty, the provider’s public address is used.

public Uri? Endpoint { get; set; }

Uri?

Maximum characters that can be spoken in a single request. Default 5,000.

public int MaxCharactersPerRequest { get; set; }

int

When the limit is exceeded, the tool returns an error; it does not silently truncate the text. Truncation produces a sentence the user never hears, and the reason becomes invisible.

How many voice requests can run at once. Default 2.

public int MaxConcurrentRequests { get; set; }

int

Synthesis, dialogue and transcription share this one limit.

Maximum characters one dialogue request can carry, summed over its turns. Default 2,000, the provider’s guidance for reliable generation.

public int MaxDialogueCharactersPerRequest { get; set; }

int

A longer dialogue is refused, not split: the caller splits it at a point that suits its content and joins the audio. ISpeechDialogueSynthesizer.DialogueCapabilities reports this value.

Output format.

public string OutputFormat { get; set; }

string

The built-in client to use. Currently only elevenlabs is supported.

public string Provider { get; set; }

string

This setting, VoiceOptions.ApiKey and VoiceOptions.Endpoint configure the built-in client only. When your own ISpeechSynthesizer and ISpeechTranscriber are registered BEFORE UseVoice, the three are not validated and not required.

Prices in Tracon:Pricing:Voice are keyed by the ProviderName of the implementation that did the work, not by this value.

Whether voice tools require explicit approval before a call. Default false.

public bool RequireApproval { get; set; }

bool

The tool causes no irreversible side effect — it produces a file and spends money. Cost can be a reason on its own; that is why the setting exists, off by default.

Default synthesis model.

public string? SynthesisModelId { get; set; }

string?

Request timeout. 100 seconds when empty.

public TimeSpan? Timeout { get; set; }

TimeSpan?

Must be from one millisecond to about 24.8 days (Int32.MaxValue milliseconds) when set; any other value fails at startup.

Default transcription model.

public string? TranscriptionModelId { get; set; }

string?