AIRouter.Core 0.0.2

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

AIRouter

NuGet AIRouter.Core NuGet AIRouter.AspNetCore GHCR

AIRouter is a library-first AI provider router for .NET 10. Use it directly from any .NET application, optionally expose an OpenAI-compatible /v1 API from your own ASP.NET Core host, or run the ready-made AiRouter.Server gateway/container with its bundled Angular admin console.

Packages

There are exactly two public NuGet packages.

AIRouter.Core

View AIRouter.Core on NuGet.org

Use AIRouter.Core in console apps, workers, Windows services, desktop apps, MCP servers, or any other .NET project. Core includes provider management, built-in OpenAI-compatible upstream providers, fallback and round-robin routing, Responses support, streaming, health/cooldown behavior, and in-memory provider/route stores.

dotnet add package AIRouter.Core --version 0.0.1
<PackageReference Include="AIRouter.Core" Version="0.0.1" />
var services = new ServiceCollection();
services.AddAiRouter();

await using var serviceProvider = services.BuildServiceProvider();
var providers = serviceProvider.GetRequiredService<IProviderManager>();
var router = serviceProvider.GetRequiredService<IAiRouter>();

SQLite is not required. Applications can keep the default in-memory stores or replace IProviderStore and IRouteStore with their own persistence.

AIRouter.AspNetCore

View AIRouter.AspNetCore on NuGet.org

Add AIRouter.AspNetCore when your application should expose the OpenAI-compatible API. It depends on AIRouter.Core and only adds ASP.NET Core hosting integration.

dotnet add package AIRouter.AspNetCore --version 0.0.1
<PackageReference Include="AIRouter.AspNetCore" Version="0.0.1" />
builder.Services.AddAiRouter();

var app = builder.Build();
app.UseAiRouter();

By default this maps:

  • POST /v1/chat/completions
  • POST /v1/responses
  • GET /v1/models

Use an optional prefix when the routes should live below another path:

app.UseAiRouter("api");

That maps the same endpoints at /api/v1/.... Prefixes such as api, /api, api/, and /api/ are normalized to the same route prefix.

Management endpoints are optional and can use the same bearer key:

app.MapAiRouterManagementEndpoints(adminKey);
app.MapAiRouterConfigurationManagementEndpoints(adminKey);

See docs/library-usage.md for provider, route, custom-host, and streaming examples.

Standalone server and Angular admin

AiRouter.Server is optional. It composes Core, ASP.NET hosting, internal SQLite persistence, and a small Angular admin application into one ready-made gateway. Applications embedding AIRouter should depend on the NuGet packages instead of the server project.

The release container is published to GitHub Container Registry:

docker pull ghcr.io/dhhieu113pro/ai-router:latest

Run the latest image with an admin key:

docker run --rm \
  -p 8080:8080 \
  -e AIROUTER_ADMIN_KEY=change-me \
  -v ai-router-data:/data \
  ghcr.io/dhhieu113pro/ai-router:latest

Then open http://localhost:8080/admin/ and unlock it with the value of AIROUTER_ADMIN_KEY.

The admin console provides:

  • provider add/edit/delete and enable/disable,
  • priority, health, connectivity tests, and model discovery,
  • fallback and round-robin route editing,
  • JSON configuration import/export,
  • responsive system light/dark appearance.

The server also exposes /health and the OpenAI-compatible /v1 routes. By default SQLite is stored at /data/ai-router.db.

Optional server keys:

AIROUTER_API_KEY    Protects /v1 routes when configured
AIROUTER_ADMIN_KEY  Enables and protects management/configuration routes when configured

Provider and route management remains unavailable when AIROUTER_ADMIN_KEY is not configured.

Configuration migration API

When the admin key is configured, the standalone server maps:

GET  /config/export?includeSecrets=false
POST /config/import?mode=merge
POST /config/import?mode=replace

Configuration documents use schemaVersion: 1. Export redacts provider API keys unless includeSecrets=true is explicitly requested.

merge adds or updates matching provider/route ids and preserves unrelated configuration. replace additionally deletes provider/route ids that are absent from the imported file. During provider updates, an imported apiKey: null preserves the currently stored key.

Releases

Push a semantic-version tag such as v0.1.0 from a commit contained in main.

The dedicated release workflow then:

  1. restores, builds, and tests the solution,
  2. packs and smoke-tests AIRouter.Core and AIRouter.AspNetCore,
  3. publishes both packages to NuGet.org through trusted publishing,
  4. runs the Angular tests/production build as part of the server container build,
  5. publishes linux/amd64 and linux/arm64 server images to GHCR as 0.1.0, 0.1, and latest.

NuGet.org trusted publishers for both package IDs must target repository dhhieu113pro/ai-router, workflow .github/workflows/release.yml, and GitHub environment production. No long-lived NuGet API-key repository secret is required.

License

MIT

Product 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. 
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 AIRouter.Core:

Package Downloads
AIRouter.AspNetCore

ASP.NET Core OpenAI-compatible hosting adapter for AIRouter.Core.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.4 39 9/6/2026
0.0.3 40 9/6/2026
0.0.2 45 9/6/2026
0.0.1 87 9/5/2026