# AnthropicProviderOptions

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.anthropicprovideroptions/
> Summary: AnthropicProviderOptions: Tracon's Anthropic (Claude) provider settings.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Anthropic.dll</code></div>

Tracon's Anthropic (Claude) provider settings.

```csharp
public sealed class AnthropicProviderOptions
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.anthropicprovideroptions/">AnthropicProviderOptions</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Remarks

This type is deliberately a `class`, not a `record`: a `record`'s
generated `ToString` would print every property and a single log line
would expose the API key.

Validation is done by hand in [Tracon.AnthropicProviderOptionsValidator](/api/tracon/);
`DataAnnotations` relies on reflection and breaks AOT compatibility.

## Constructors

### <a id="Tracon_AnthropicProviderOptions__ctor"></a> AnthropicProviderOptions\(\)

```csharp
public AnthropicProviderOptions()
```

## Fields

### <a id="Tracon_AnthropicProviderOptions_SectionName"></a> SectionName

The full path of the configuration section settings are read from.

```csharp
public const string SectionName = "Tracon:Providers:Anthropic"
```

#### Field Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Properties

### <a id="Tracon_AnthropicProviderOptions_ApiKey"></a> ApiKey

Anthropic API key.

```csharp
public string? ApiKey { get; set; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

#### Remarks

**This value is a secret and is never written to a file.** Use
`dotnet user-secrets`, an environment variable, or a secret manager.
The key is never written to the database, never returned from the API, and
never shown in the UI, under any condition.

### <a id="Tracon_AnthropicProviderOptions_DefaultMaxOutputTokens"></a> DefaultMaxOutputTokens

The upper bound used when [ModelBinding.MaxOutputTokens](/api/tracon.modelbinding/#Tracon_ModelBinding_MaxOutputTokens) is not given.

```csharp
public int DefaultMaxOutputTokens { get; set; }
```

#### Property Value

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

#### Remarks

The Anthropic Messages API requires `max_tokens`; it is not an
optional field like in OpenAI. Because of this, Tracon carries a
default and the default cannot be [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

The value bounds output generation, not tokens actually spent. Even so, a
very high limit is treated by some providers as a "worst case" cost (see
the `HTTP 402` encountered with OpenRouter).

### <a id="Tracon_AnthropicProviderOptions_DefaultModel"></a> DefaultModel

The model name used when [ModelBinding.Model](/api/tracon.modelbinding/#Tracon_ModelBinding_Model) is left empty.

```csharp
public string? DefaultModel { get; set; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_AnthropicProviderOptions_Endpoint"></a> Endpoint

The request address. When [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null), Anthropic's own address is
used. Filled in for setups behind a proxy or gateway.

```csharp
public Uri? Endpoint { get; set; }
```

#### Property Value

 Uri?

### <a id="Tracon_AnthropicProviderOptions_MaxRetries"></a> MaxRetries

How many times the SDK automatically retries a request. When
[null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null), the library default is used.

```csharp
public int? MaxRetries { get; set; }
```

#### Property Value

 [int](https://learn.microsoft.com/dotnet/api/system.int32)?

#### Remarks

The circuit breaker looks at failure of the `AI.IChatClient`
level, not the raw request count; this setting does not affect it. However,
if a test measures raw request count, this value must be set to `0`.

### <a id="Tracon_AnthropicProviderOptions_Models"></a> Models

The model catalog shown to the UI.

```csharp
public IList<ModelDescriptor> Models { get; }
```

#### Property Value

 [IList](https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist\-1)<[ModelDescriptor](/api/tracon.modeldescriptor/)\>

#### Remarks

Tracon carries no built-in model list; the catalog comes entirely from
here. This list is *not a validation list*: a model name absent from
it can still be used.

### <a id="Tracon_AnthropicProviderOptions_Timeout"></a> Timeout

The upper time limit for a single request. When [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null), the library default is used.

```csharp
public TimeSpan? Timeout { get; set; }
```

#### Property Value

 [TimeSpan](https://learn.microsoft.com/dotnet/api/system.timespan)?

#### Remarks

Must be from one millisecond to about 24.8 days ([Int32.MaxValue](https://learn.microsoft.com/dotnet/api/system.int32) milliseconds) when set; any other value fails at startup.
