# OpenAILiveProviderExtensions

> 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.openailiveproviderextensions/
> Summary: OpenAILiveProviderExtensions: Extensions that add OpenAI's live voice provider to the Tracon chain.

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

Extensions that add OpenAI's live voice provider to the Tracon chain.

```csharp
public static class OpenAILiveProviderExtensions
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.openailiveproviderextensions/">OpenAILiveProviderExtensions</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.memberwiseclone">object.MemberwiseClone()</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 is a **separate call**, not a flag on `UseOpenAI`.
It opens an outbound connection that is billed by the second, and an application
must opt into that explicitly rather than inherit it from an unrelated call. The
separation also makes the `501` the endpoints return diagnosable: it says
which call is missing.

The API key is reused from [OpenAIProviderOptions](/api/tracon.openaiprovideroptions/), so
`UseOpenAI(...)` must be called first. The validator says so by name if it
is not.

## Methods

### <a id="Tracon_OpenAILiveProviderExtensions_UseOpenAILive_Tracon_ITraconBuilder_Microsoft_Extensions_Configuration_IConfiguration_"></a> UseOpenAILive\(ITraconBuilder, IConfiguration\)

Adds the OpenAI live voice provider, reading settings from configuration.

```csharp
public static ITraconBuilder UseOpenAILive(this ITraconBuilder builder, IConfiguration configurationSection)
```

#### Parameters

`builder` [ITraconBuilder](/api/tracon.itraconbuilder/)

The Tracon chain.

`configurationSection` [IConfiguration](https://learn.microsoft.com/dotnet/api/microsoft.extensions.configuration.iconfiguration)

The `Tracon:Providers:OpenAI:Live` section.

#### Returns

 [ITraconBuilder](/api/tracon.itraconbuilder/)

The continuation of the chain.

#### Examples

```csharp
builder.AddTracon()
       .UseOpenAI(builder.Configuration.GetSection(OpenAIProviderOptions.SectionName))
       .UseOpenAILive(builder.Configuration.GetSection(OpenAILiveOptions.SectionName))
       .UseLiveVoice();
```

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

One of the parameters is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

### <a id="Tracon_OpenAILiveProviderExtensions_UseOpenAILive_Tracon_ITraconBuilder_"></a> UseOpenAILive\(ITraconBuilder\)

Adds the OpenAI live voice provider with default settings.

```csharp
public static ITraconBuilder UseOpenAILive(this ITraconBuilder builder)
```

#### Parameters

`builder` [ITraconBuilder](/api/tracon.itraconbuilder/)

The Tracon chain.

#### Returns

 [ITraconBuilder](/api/tracon.itraconbuilder/)

The continuation of the chain.

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`builder` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

### <a id="Tracon_OpenAILiveProviderExtensions_UseOpenAILive_Tracon_ITraconBuilder_System_Action_Tracon_OpenAILiveOptions__"></a> UseOpenAILive\(ITraconBuilder, Action<OpenAILiveOptions\>\)

Adds the OpenAI live voice provider with settings given in code.

```csharp
public static ITraconBuilder UseOpenAILive(this ITraconBuilder builder, Action<OpenAILiveOptions> configure)
```

#### Parameters

`builder` [ITraconBuilder](/api/tracon.itraconbuilder/)

The Tracon chain.

`configure` [Action](https://learn.microsoft.com/dotnet/api/system.action\-1)<[OpenAILiveOptions](/api/tracon.openailiveoptions/)\>

The settings.

#### Returns

 [ITraconBuilder](/api/tracon.itraconbuilder/)

The continuation of the chain.

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

One of the parameters is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).
