.NET API
OpenAISpeechBuilderExtensions
Tracon.OpenAI.dllAdds OpenAI speech to the Tracon chain.
public static class OpenAISpeechBuilderExtensions- Inheritance
- object ← OpenAISpeechBuilderExtensions
- Inherited Members
- object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Methods
Section titled “Methods”UseOpenAISpeech(ITraconBuilder, Action<OpenAISpeechOptions>)
Section titled “ UseOpenAISpeech(ITraconBuilder, Action<OpenAISpeechOptions>)”Registers OpenAI text-to-speech and speech-to-text as named Tracon speech providers.
public static ITraconBuilder UseOpenAISpeech(this ITraconBuilder builder, Action<OpenAISpeechOptions> configure)Parameters
Section titled “Parameters”builder ITraconBuilder
The Tracon chain.
configure Action<OpenAISpeechOptions>
The speech settings. At least one model is required.
Returns
Section titled “Returns”The continuation of the chain.
Remarks
Section titled “Remarks”Call OpenAIProviderExtensions.UseOpenAI
first. This call shares the authenticated OpenAI client that UseOpenAI
registers and does not add a package or a second connection pool.
The providers are named speech providers: every call passes the tenant’s egress policy
against the provider name openai, the name the chat provider uses, so one rule
covers chat, images and speech. A tenant that has its own OpenAI key is refused for
speech: the client was built with the setup key and cannot use another.
Billing is an estimate. The speech endpoint reports no billed characters, so Tracon records the length of the text and labels it as estimated. A transcription has no duration, so it has no cost: the client reads no duration from the answer.
builder.AddTracon() .UseOpenAI(builder.Configuration["OpenAI:ApiKey"]!) .UseOpenAISpeech(options => { options.SynthesisModel = "gpt-4o-mini-tts"; options.TranscriptionModel = "gpt-4o-mini-transcribe"; });Exceptions
Section titled “Exceptions”builder or configure is null.
configure sets neither model, or sets a name that is not a valid speech provider name,
or a character limit that is not greater than zero.