InferHub.Client
0.1.0
See the version list below for details.
dotnet add package InferHub.Client --version 0.1.0
NuGet\Install-Package InferHub.Client -Version 0.1.0
<PackageReference Include="InferHub.Client" Version="0.1.0" />
<PackageVersion Include="InferHub.Client" Version="0.1.0" />
<PackageReference Include="InferHub.Client" />
paket add InferHub.Client --version 0.1.0
#r "nuget: InferHub.Client, 0.1.0"
#:package InferHub.Client@0.1.0
#addin nuget:?package=InferHub.Client&version=0.1.0
#tool nuget:?package=InferHub.Client&version=0.1.0
InferHub.Client
A small, typed .NET client for InferHub — a self-hosted, Ollama-compatible inference mesh.
Point it at a coordinator, pass a Bearer token, and call chat, generate, model listing and status from C# with typed requests, dependency injection, and no heavy dependencies.
v0.1.0 — foundation and core blocking inference. Streaming, embeddings, vector data plane, RAG retrieval and admin follow in later phases.
Install
dotnet add package InferHub.Client
Targets net9.0 and net10.0.
Quick start
using InferHub.Client;
using InferHub.Client.Configuration;
using InferHub.Client.Models.Ollama;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddInferHubClient(o =>
{
o.BaseAddress = new Uri("http://localhost:5080");
o.ApiKey = "<your-client-api-key>";
});
var provider = services.BuildServiceProvider();
var client = provider.GetRequiredService<IInferHubClient>();
var chat = await client.ChatAsync(new ChatRequest
{
Model = "llama3",
Messages = new[]
{
new ChatMessage { Role = "user", Content = "Say hi in one word." }
},
Stream = false
}, CancellationToken.None);
Console.WriteLine(chat.Message?.Content);
What ships in v0.1.0
| Method | Endpoint |
|---|---|
ListModelsAsync |
GET /api/tags |
GenerateAsync (blocking) |
POST /api/generate with stream:false |
ChatAsync (blocking) |
POST /api/chat with stream:false |
GetStatusAsync |
GET /api/status |
PingAsync |
GET /health |
Request models carry an extension bag (AdditionalProperties), so any unknown fields
from the Ollama contract pass through untouched — you can hand-set options, format,
tool definitions, etc. without waiting on the client to type them.
Auth
- Non-loopback calls need
ApiKey(attached asAuthorization: Bearer <key>by aDelegatingHandler). - Loopback calls to the coordinator skip auth by default (unless the coordinator sets
Auth:RequireAuthForLoopback=true). /healthis always open.- Admin routes require a separate
AdminApiKeyand land on a dedicated interface in a later phase; a client key alone never surfaces admin methods.
Errors
Any non-success HTTP response is surfaced as InferHubException, carrying:
StatusCode— the HTTP statusMessage— the coordinator's{ "error": "…" }body if present
The client treats 404 (model missing) and 424 Failed Dependency (retrieval unavailable,
added in a later phase) as distinct signals worth checking with StatusCode.
Links
- InferHub server: https://github.com/Dev-Art-Solutions/InferHub
- Product page: https://inferhub.devart.solutions
- Blog: https://blog.devart.solutions
License
MIT — see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Http (>= 10.0.0)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Http (>= 10.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.