# AspireConfigurableOpenAIExtensions

- Kind: `class`
- Package: [Aspire.Azure.AI.OpenAI](/reference/api/csharp/aspire.azure.ai.openai.md)
- Version: `13.3.0-preview.1.26254.5`
- Namespace: `Microsoft.Extensions.Hosting`
- Target framework: `net10.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Components/Aspire.Azure.AI.OpenAI/AspireConfigurableOpenAIExtensions.cs)

Provides extension methods for registering `OpenAIClient` or `OpenAI.AzureOpenAIClient` as a singleton in the services provided by the `Hosting.IHostApplicationBuilder`.

## Definition

```csharp
namespace Microsoft.Extensions.Hosting;

public static class AspireConfigurableOpenAIExtensions
{
    // ...
}
```

## Methods

- [AddKeyedOpenAIClientFromConfiguration(IHostApplicationBuilder, string)](/reference/api/csharp/aspire.azure.ai.openai/aspireconfigurableopenaiextensions/methods.md#addkeyedopenaiclientfromconfiguration-ihostapplicationbuilder-string) : `AspireOpenAIClientBuilder` `extension` -- Registers `OpenAIClient` as a singleton in the services provided by the `builder`. The concrete implementation is selected automatically from configuration.
- [AddOpenAIClientFromConfiguration(IHostApplicationBuilder, string)](/reference/api/csharp/aspire.azure.ai.openai/aspireconfigurableopenaiextensions/methods.md#addopenaiclientfromconfiguration-ihostapplicationbuilder-string) : `AspireOpenAIClientBuilder` `extension` -- Registers `OpenAIClient` or `OpenAI.AzureOpenAIClient` as a singleton in the services provided by the `builder`. The concrete implementation is selected automatically from configuration.
