Skip to content
Tracon

GoogleSpeechBuilderExtensions

Namespace Tracon · Assembly Tracon.Google.dll

Adds Google Gemini speech to the Tracon chain.

public static class GoogleSpeechBuilderExtensions
Inheritance
object ← GoogleSpeechBuilderExtensions
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

UseGoogleSpeech(ITraconBuilder, Action<GoogleSpeechOptions>)

Section titled “ UseGoogleSpeech(ITraconBuilder, Action<GoogleSpeechOptions>)”

Registers Gemini text-to-speech as a named Tracon speech synthesizer that also voices a dialogue.

public static ITraconBuilder UseGoogleSpeech(this ITraconBuilder builder, Action<GoogleSpeechOptions> configure)

builder ITraconBuilder

The Tracon chain.

configure Action<GoogleSpeechOptions>

The speech settings. The model is required.

ITraconBuilder

The continuation of the chain.

Call GoogleProviderExtensions.UseGoogle first. This call shares the authenticated Google client that UseGoogle registers and adds no package and no second connection pool.

The synthesizer is a named speech provider: every call passes the tenant’s egress policy against the provider name google, the name the chat provider uses, so one rule covers chat, images and speech. A tenant that has its own Google key is served with that key: the request goes to the same client the tenant’s chat requests use.

One voice. POST /api/voice/speak with "provider": "gemini" answers a WAV file. SpeechRequest.OutputFormat takes wav (the default) or pcm; another format is refused before the call. A streamed answer is raw 16-bit PCM at the model’s sample rate.

A dialogue. The same instance voices a dialogue of exactly two voices (ISpeechProviderResolver.GetDialogueSynthesizerAsync). The request names its speakers in the format the model takes; see GoogleSpeechOptions.DialogueSpeakerMode. Gemini reports no timing, so a request for timestamps is refused.

Billing is an estimate. Gemini bills speech by tokens, and the answer carries no character count, so Tracon records the length of the text and labels it as estimated.

builder.AddTracon()
.UseGoogle(builder.Configuration["Google:ApiKey"]!)
.UseGoogleSpeech(options =>
{
options.Model = "gemini-3.8-flash-tts";
options.Voices.Add(new VoiceDescriptor { VoiceId = "Kore", Name = "Kore" });
options.Voices.Add(new VoiceDescriptor { VoiceId = "Puck", Name = "Puck" });
});

ArgumentNullException

builder or configure is null.

ArgumentException

configure sets no model, a name that is not a valid speech provider name, a character limit that is not greater than zero, or a GoogleSpeechOptions.DialogueSpeakerMode that is not defined.