Soenneker.OpenRouter.HttpClients 11.0.172

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.OpenRouter.HttpClients --version 11.0.172
                    
NuGet\Install-Package Soenneker.OpenRouter.HttpClients -Version 11.0.172
                    
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.OpenRouter.HttpClients" Version="11.0.172" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.OpenRouter.HttpClients" Version="11.0.172" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.OpenRouter.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.OpenRouter.HttpClients --version 11.0.172
                    
#r "nuget: Soenneker.OpenRouter.HttpClients, 11.0.172"
                    
#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.OpenRouter.HttpClients@11.0.172
                    
#: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.OpenRouter.HttpClients&version=11.0.172
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.OpenRouter.HttpClients&version=11.0.172
                    
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.OpenRouter.HttpClients

Provides a cached HttpClient configured for OpenRouter's API, including bearer authentication.

Installation

dotnet add package Soenneker.OpenRouter.HttpClients

Configuration

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

OpenRouter:ClientBaseUrl, OpenRouter:AuthHeaderName, and OpenRouter:AuthHeaderValueTemplate can override the defaults.

Usage

using Soenneker.OpenRouter.HttpClients.Abstract;
using Soenneker.OpenRouter.HttpClients.Registrars;

services.AddOpenRouterOpenApiHttpClientAsSingleton();

IOpenRouterOpenApiHttpClient provider = serviceProvider
    .GetRequiredService<IOpenRouterOpenApiHttpClient>();

HttpClient client = await provider.Get(cancellationToken);
HttpResponseMessage response = await client.GetAsync("models", cancellationToken);
response.EnsureSuccessStatusCode();

The provider owns its cached client. Disposing the provider removes and disposes that client. Scoped registration gives each provider instance its own cached client.

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.OpenRouter.HttpClients:

Package Downloads
Soenneker.OpenRouter.OpenApiClientUtil

Provides a configured OpenRouter 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.180 268 11/19/2026
11.0.179 103 11/19/2026
11.0.178 99 11/19/2026
11.0.176 106 11/18/2026
11.0.175 85 11/18/2026
11.0.172 215 11/15/2026
11.0.171 110 11/15/2026
11.0.169 655 11/11/2026
11.0.168 96 11/11/2026
11.0.167 164 11/11/2026
11.0.166 97 11/11/2026
11.0.165 15,796 11/3/2026
11.0.164 621 11/3/2026
11.0.162 120 11/3/2026
11.0.160 6,991 10/27/2026
11.0.159 153 10/26/2026
11.0.158 118 10/26/2026
11.0.157 144 10/26/2026
4.0.156 246 10/15/2026
4.0.155 115 10/14/2026
Loading failed

Updated Soenneker.Utils.HttpClientCache to 11.0.2156