.NET API
OpenAICompatibleProviderExtensions
Tracon.OpenAI.dllExtensions that add named providers with an OpenAI compatible chat API to the Tracon chain (OpenRouter, Groq, vLLM, Ollama, LM Studio, …).
public static class OpenAICompatibleProviderExtensionsInheritance
Section titled “Inheritance”object ← OpenAICompatibleProviderExtensions
Inherited Members
Section titled “Inherited Members”object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”The difference from UseOpenAI: this call takes a name and
registers one or two providers (see
OpenAIProviderOptions.EnableResponsesSurface) under that name. It uses
the same OpenAIProviderOptions shape; the base address
(OpenAIProviderOptions.Endpoint) points at the compatible server.
Only the Chat Completions surface is registered; the Responses surface is
off by default (most compatible servers do not implement
/v1/responses).
Methods
Section titled “Methods”UseOpenAICompatible(ITraconBuilder, string, Action<OpenAIProviderOptions>)
Section titled “ UseOpenAICompatible(ITraconBuilder, string, Action<OpenAIProviderOptions>)”Adds a named OpenAI compatible provider whose options are set in code.
public static ITraconBuilder UseOpenAICompatible(this ITraconBuilder builder, string name, Action<OpenAIProviderOptions> configure)Parameters
Section titled “Parameters”builder ITraconBuilder
The Tracon chain.
name string
The provider name. It is limited to [a-z0-9][a-z0-9-]{0,31}.
OpenAIProviderNames.ChatCompletions and
OpenAIProviderNames.Responses are reserved.
configure Action<OpenAIProviderOptions>
The options callback. It must set at least OpenAIProviderOptions.Endpoint.
Returns
Section titled “Returns”The same chain, for chaining.
Examples
Section titled “Examples”builder.AddTracon() .UseOpenAICompatible("openrouter", o => { o.Endpoint = new Uri("https://openrouter.ai/api/v1"); o.ApiKey = configuration["OpenRouter:ApiKey"]; }) .UseOpenAICompatible("ollama", o => { o.Endpoint = new Uri("http://localhost:11434/v1"); // No ApiKey — the local server does not ask for one });Exceptions
Section titled “Exceptions”builder
or
configure
is null.
name is empty, reserved, or does not match the pattern.
UseOpenAICompatible(ITraconBuilder, string, IConfiguration)
Section titled “ UseOpenAICompatible(ITraconBuilder, string, IConfiguration)”Adds a named OpenAI compatible provider whose options are read from the
Tracon:Providers:OpenAICompatible:{name} section.
public static ITraconBuilder UseOpenAICompatible(this ITraconBuilder builder, string name, IConfiguration configurationSection)Parameters
Section titled “Parameters”builder ITraconBuilder
The Tracon chain.
name string
The provider name. See OpenAICompatibleProviderExtensions.UseOpenAICompatible.
configurationSection IConfiguration
The section the options are read from. Usually
configuration.GetSection($"{OpenAICompatibleProviderOptions.SectionName}:{name}").
Returns
Section titled “Returns”The same chain, for chaining.
Exceptions
Section titled “Exceptions”Any parameter is null.