Skip to content
Tracon

AnthropicProviderExtensions

Namespace Tracon · Assembly Tracon.Anthropic.dll

Extensions that add the Anthropic (Claude) provider to the Tracon chain.

public static class AnthropicProviderExtensions

objectAnthropicProviderExtensions

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

UseAnthropic(ITraconBuilder, string, Action<AnthropicProviderOptions>?)

Section titled “ UseAnthropic(ITraconBuilder, string, Action<AnthropicProviderOptions>?)”

Adds the Anthropic provider using an API key.

public static ITraconBuilder UseAnthropic(this ITraconBuilder builder, string apiKey, Action<AnthropicProviderOptions>? configure = null)

builder ITraconBuilder

The Tracon chain.

apiKey string

Anthropic API key.

configure Action<AnthropicProviderOptions>?

Additional settings modifier.

ITraconBuilder

The continuation of the chain.

builder.AddTracon()
.UseAnthropic(builder.Configuration["Anthropic:ApiKey"]!);

ArgumentNullException

builder is null.

ArgumentException

apiKey is empty.

UseAnthropic(ITraconBuilder, IConfiguration)

Section titled “ UseAnthropic(ITraconBuilder, IConfiguration)”

Adds the Anthropic provider, reading settings from the Tracon:Providers:Anthropic section.

public static ITraconBuilder UseAnthropic(this ITraconBuilder builder, IConfiguration configurationSection)

builder ITraconBuilder

The Tracon chain.

configurationSection IConfiguration

The section settings are read from. Typically configuration.GetSection(AnthropicProviderOptions.SectionName).

ITraconBuilder

The continuation of the chain.

ArgumentNullException

One of the parameters is null.

UseAnthropic(ITraconBuilder, Action<AnthropicProviderOptions>)

Section titled “ UseAnthropic(ITraconBuilder, Action<AnthropicProviderOptions>)”

Adds the Anthropic provider using settings given in code.

public static ITraconBuilder UseAnthropic(this ITraconBuilder builder, Action<AnthropicProviderOptions> configure)

builder ITraconBuilder

The Tracon chain.

configure Action<AnthropicProviderOptions>

Settings modifier.

ITraconBuilder

The continuation of the chain.

This call registers a single provider: AnthropicProviderNames.Anthropic.

Registration uses AddModelProvider(...); no existing service is replaced. Calling this more than once merges the settings; the provider is registered only once.

ArgumentNullException

One of the parameters is null.