Soenneker.OpenAI.HttpClients 11.0.166

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.OpenAI.HttpClients --version 11.0.166
                    
NuGet\Install-Package Soenneker.OpenAI.HttpClients -Version 11.0.166
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.OpenAI.HttpClients" Version="11.0.166" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.OpenAI.HttpClients" Version="11.0.166" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.OpenAI.HttpClients" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.OpenAI.HttpClients --version 11.0.166
                    
#r "nuget: Soenneker.OpenAI.HttpClients, 11.0.166"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.OpenAI.HttpClients@11.0.166
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.OpenAI.HttpClients&version=11.0.166
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.OpenAI.HttpClients&version=11.0.166
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.OpenAI.HttpClients

Provides a cached, bearer-authenticated HttpClient for the OpenAI API.

Installation

dotnet add package Soenneker.OpenAI.HttpClients

Configuration

{
  "OpenAI": {
    "ApiKey": "your-api-key"
  }
}

OpenAI:ClientBaseUrl can override the default https://api.openai.com/v1 endpoint. OpenAI:AuthHeaderName and OpenAI:AuthHeaderValueTemplate can override the default bearer header for a compatible endpoint.

Usage

using Soenneker.OpenAI.HttpClients.Abstract;
using Soenneker.OpenAI.HttpClients.Registrars;

services.AddOpenAIOpenApiHttpClientAsSingleton();

IOpenAIOpenApiHttpClient openAI = serviceProvider
    .GetRequiredService<IOpenAIOpenApiHttpClient>();

HttpClient client = await openAI.Get(cancellationToken);

Do not dispose the returned HttpClient; the registered provider owns it and removes it from the cache when disposed.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Soenneker.OpenAI.HttpClients:

Package Downloads
Soenneker.OpenAI.OpenApiClientUtil

Provides a configured OpenAI REST API client and reuses it for the lifetime of the registered service.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.183 127 11/19/2026
11.0.182 58 11/19/2026
11.0.181 68 11/18/2026
11.0.179 50 11/18/2026
11.0.178 54 11/18/2026
11.0.177 199 11/15/2026
11.0.176 111 11/15/2026
11.0.174 232 11/11/2026
11.0.173 112 11/11/2026
11.0.172 103 11/11/2026
11.0.171 102 11/11/2026
11.0.170 161 11/11/2026
11.0.169 405 11/3/2026
11.0.168 134 11/3/2026
11.0.167 117 11/3/2026
11.0.166 127 11/3/2026
11.0.165 123 11/3/2026
11.0.164 358 10/27/2026
11.0.163 131 10/27/2026
11.0.162 110 10/26/2026
Loading failed

Updated Multiple NuGet packages