Soenneker.Azure.OpenAI.Client
11.0.1080
Prefix Reserved
dotnet add package Soenneker.Azure.OpenAI.Client --version 11.0.1080
NuGet\Install-Package Soenneker.Azure.OpenAI.Client -Version 11.0.1080
<PackageReference Include="Soenneker.Azure.OpenAI.Client" Version="11.0.1080" />
<PackageVersion Include="Soenneker.Azure.OpenAI.Client" Version="11.0.1080" />
<PackageReference Include="Soenneker.Azure.OpenAI.Client" />
paket add Soenneker.Azure.OpenAI.Client --version 11.0.1080
#r "nuget: Soenneker.Azure.OpenAI.Client, 11.0.1080"
#:package Soenneker.Azure.OpenAI.Client@11.0.1080
#addin nuget:?package=Soenneker.Azure.OpenAI.Client&version=11.0.1080
#tool nuget:?package=Soenneker.Azure.OpenAI.Client&version=11.0.1080
Soenneker.Azure.OpenAI.Client
Creates and caches an API-key-authenticated AzureOpenAIClient for dependency-injected applications.
Installation
dotnet add package Soenneker.Azure.OpenAI.Client
Configuration
{
"Azure": {
"OpenAI": {
"Uri": "https://your-resource.openai.azure.com",
"ApiKey": "your-api-key"
}
}
}
The endpoint must be an absolute HTTPS URI. Store the API key in a secret provider or environment variable, not source-controlled configuration.
Registration and use
using Azure.AI.OpenAI;
using Soenneker.Azure.OpenAI.Client.Abstract;
using Soenneker.Azure.OpenAI.Client.Registrars;
builder.Services.AddAzureOpenAIClientUtilAsSingleton();
public sealed class AzureOpenAIService(IAzureOpenAIClientUtil clientUtil)
{
public ValueTask<AzureOpenAIClient> GetClient(
CancellationToken cancellationToken) =>
clientUtil.Get(cancellationToken);
}
Use the returned Azure client to obtain deployment-specific chat, audio, embedding, or other clients supported by the Azure/OpenAI SDK.
Client options and lifecycle
Call SetOptions() before the first Get() when custom AzureOpenAIClientOptions are required:
clientUtil.SetOptions(new AzureOpenAIClientOptions());
AzureOpenAIClient client = await clientUtil.Get(cancellationToken);
- The first successful
Get()creates the client; later calls return the same instance. SetOptions()after creation throws because a cached client cannot be reconfigured.- Endpoint, API key, and options changes require replacing the utility instance.
- Missing configuration or a non-HTTPS endpoint fails initialization.
- Let the DI container dispose registered instances.
For deployment-specific wrappers, see Soenneker.Azure.OpenAI.Client.Chat and Soenneker.Azure.OpenAI.Client.Audio.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Azure.AI.OpenAI (>= 2.1.0)
- Soenneker.Extensions.Configuration (>= 11.0.914)
- Soenneker.Utils.AsyncSingleton (>= 11.0.886)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Soenneker.Azure.OpenAI.Client:
| Package | Downloads |
|---|---|
|
Soenneker.Azure.OpenAI.Client.Chat
An async thread-safe singleton for the Azure OpenAI Chat (completions) client |
|
|
Soenneker.Azure.OpenAI.Client.Audio
An async thread-safe singleton for the Azure OpenAI audio client |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.1080 | 0 | 10/27/2026 |
| 11.0.1079 | 129 | 10/26/2026 |
| 11.0.1078 | 73 | 10/26/2026 |
| 11.0.1077 | 60 | 10/26/2026 |
| 11.0.1076 | 95 | 10/26/2026 |
| 11.0.1075 | 97 | 10/26/2026 |
| 4.0.1074 | 427 | 10/15/2026 |
| 4.0.1073 | 96 | 10/15/2026 |
| 4.0.1072 | 129 | 10/14/2026 |
| 4.0.1071 | 130 | 10/14/2026 |
| 4.0.1070 | 131 | 10/14/2026 |
| 4.0.1069 | 134 | 10/14/2026 |
| 4.0.1068 | 113 | 10/14/2026 |
| 4.0.1067 | 91 | 10/14/2026 |
| 4.0.1061 | 155 | 10/13/2026 |
| 4.0.1060 | 103 | 10/13/2026 |
| 4.0.1059 | 101 | 10/12/2026 |
| 4.0.1057 | 135 | 10/12/2026 |
| 4.0.1056 | 102 | 10/12/2026 |
| 4.0.1055 | 113 | 10/12/2026 |
Remove redundant framework conditions