# OpenAIProviderOptions

> 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.openaiprovideroptions/
> Summary: OpenAIProviderOptions: The OpenAI provider options of Tracon.

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

The OpenAI provider options of Tracon.

```csharp
public sealed class OpenAIProviderOptions
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.openaiprovideroptions/">OpenAIProviderOptions</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

Validation is written by hand inside [Tracon.OpenAIProviderOptionsValidator](/api/tracon/);
`DataAnnotations` is not used.

## Constructors

### <a id="Tracon_OpenAIProviderOptions__ctor"></a> OpenAIProviderOptions\(\)

```csharp
public OpenAIProviderOptions()
```

## Fields

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

Gets the full path of the configuration section the options are read from.

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

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

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

Gets or sets the OpenAI 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
user interface.

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

Gets or sets the model name to use 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_OpenAIProviderOptions_EnableResponsesSurface"></a> EnableResponsesSurface

Gets or sets a value indicating whether the Responses API surface is also enabled
for a provider registered with `UseOpenAICompatible`.

```csharp
public bool EnableResponsesSurface { get; set; }
```

#### Property Value

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

**Only `UseOpenAICompatible` reads it.** `UseOpenAI`
ignores this field; the official OpenAI provider always registers both surfaces
([OpenAIProviderNames.ChatCompletions](/api/tracon.openaiprovidernames/#Tracon_OpenAIProviderNames_ChatCompletions) and
[OpenAIProviderNames.Responses](/api/tracon.openaiprovidernames/#Tracon_OpenAIProviderNames_Responses)).

The default is [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool): most OpenAI compatible servers do not
implement the `/v1/responses` endpoint. When it is on, a second provider is
registered under the name `{name}-responses`.

### <a id="Tracon_OpenAIProviderOptions_Endpoint"></a> Endpoint

Gets or sets the request address. When [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null), the OpenAI address
is used. Set it for OpenAI compatible proxies.

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

 Uri?

### <a id="Tracon_OpenAIProviderOptions_Models"></a> Models

Gets the model catalog shown in the user interface.

```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.
Model names and prices change much faster than the package is released.

This list is *not a validation list*. A model name that is absent here can
still be used; the catalog only feeds the model picker screen and the cost
calculation of the user interface.

### <a id="Tracon_OpenAIProviderOptions_Organization"></a> Organization

Gets or sets the organization id. It is used by multi organization accounts.

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

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

Gets or sets the upper time limit of 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.
