Soenneker.Azure.OpenAI.Client
4.0.1041
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Azure.OpenAI.Client --version 4.0.1041
NuGet\Install-Package Soenneker.Azure.OpenAI.Client -Version 4.0.1041
<PackageReference Include="Soenneker.Azure.OpenAI.Client" Version="4.0.1041" />
<PackageVersion Include="Soenneker.Azure.OpenAI.Client" Version="4.0.1041" />
<PackageReference Include="Soenneker.Azure.OpenAI.Client" />
paket add Soenneker.Azure.OpenAI.Client --version 4.0.1041
#r "nuget: Soenneker.Azure.OpenAI.Client, 4.0.1041"
#:package Soenneker.Azure.OpenAI.Client@4.0.1041
#addin nuget:?package=Soenneker.Azure.OpenAI.Client&version=4.0.1041
#tool nuget:?package=Soenneker.Azure.OpenAI.Client&version=4.0.1041
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 | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Azure.AI.OpenAI (>= 2.1.0)
- Soenneker.Extensions.Configuration (>= 4.0.895)
- Soenneker.Utils.AsyncSingleton (>= 4.0.849)
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 |
|---|---|---|
| 4.0.1049 | 110,201 | 10/1/2026 |
| 4.0.1048 | 30,200 | 9/29/2026 |
| 4.0.1047 | 8,857 | 9/29/2026 |
| 4.0.1046 | 17,323 | 9/25/2026 |
| 4.0.1045 | 122 | 9/25/2026 |
| 4.0.1044 | 117 | 9/25/2026 |
| 4.0.1043 | 104 | 9/25/2026 |
| 4.0.1042 | 94 | 9/24/2026 |
| 4.0.1041 | 115 | 9/24/2026 |
| 4.0.1040 | 211 | 9/16/2026 |
| 4.0.1039 | 154 | 9/16/2026 |
| 4.0.1038 | 111 | 9/16/2026 |
| 4.0.1037 | 117 | 9/15/2026 |
| 4.0.1036 | 129 | 9/15/2026 |
| 4.0.1035 | 150 | 9/13/2026 |
| 4.0.1034 | 127 | 9/13/2026 |
| 4.0.1033 | 118 | 9/13/2026 |
| 4.0.1032 | 120 | 9/13/2026 |
| 4.0.1031 | 123 | 9/12/2026 |
| 4.0.1030 | 93 | 9/12/2026 |
Enable Native AOT compatibility analysis