WoW2.Sdk.Beta.Be.Ai.Providers
11.0.0-beta
Prefix Reserved
dotnet add package WoW2.Sdk.Beta.Be.Ai.Providers --version 11.0.0-beta
NuGet\Install-Package WoW2.Sdk.Beta.Be.Ai.Providers -Version 11.0.0-beta
<PackageReference Include="WoW2.Sdk.Beta.Be.Ai.Providers" Version="11.0.0-beta" />
<PackageVersion Include="WoW2.Sdk.Beta.Be.Ai.Providers" Version="11.0.0-beta" />
<PackageReference Include="WoW2.Sdk.Beta.Be.Ai.Providers" />
paket add WoW2.Sdk.Beta.Be.Ai.Providers --version 11.0.0-beta
#r "nuget: WoW2.Sdk.Beta.Be.Ai.Providers, 11.0.0-beta"
#:package WoW2.Sdk.Beta.Be.Ai.Providers@11.0.0-beta
#addin nuget:?package=WoW2.Sdk.Beta.Be.Ai.Providers&version=11.0.0-beta&prerelease
#tool nuget:?package=WoW2.Sdk.Beta.Be.Ai.Providers&version=11.0.0-beta&prerelease
WoW2.Sdk.Beta.Be.Ai.Providers
Named model providers on the Microsoft.Extensions.AI IChatClient seam, and a one-attempt caller over them.
- Kinds:
anthropic(the officialAnthropicSDK),openai(any OpenAI-compatible Chat Completions host: OpenAI, Groq, DeepSeek, Ollama's/v1) andollama(OllamaSharp, Ollama's native API). IAiModelCallercalls a model once and never throws for a provider failure: it returns the text as given, or a classifiedAiErrorKind, with token usage, latency and the provider's finish reason either way. Retries, routing, prices and the inference log belong to the Ai module;AiRetry.IsTransient(kind)says which failures to retry.IAiChatClientshands out one chat client per provider and model, wrapped with OpenTelemetry (gen_aispans and metrics on the sourceExperimental.Microsoft.Extensions.AI).
dotnet add package WoW2.Sdk.Beta.Be.Ai.Providers --prerelease
Configuration
Every child of Ai:Providers is one provider, named by its key. Keep keys in user secrets or the environment
(Ai__Providers__anthropic__ApiKey), never in a committed file.
{
"Ai": {
"Providers": {
"anthropic": { "ApiKey": "<from secrets>" },
"groq": { "Kind": "openai", "BaseUrl": "https://api.groq.com/openai/v1", "ApiKey": "<from secrets>", "TimeoutSeconds": 30 },
"ollama": { "BaseUrl": "http://localhost:11434", "TimeoutSeconds": 120 }
}
}
}
| Key | Meaning |
|---|---|
Kind |
anthropic, openai or ollama; empty takes the provider's name when it is one of these |
BaseUrl |
the host; empty takes the kind's public endpoint (https://api.anthropic.com, https://api.openai.com/v1, http://localhost:11434) and never an SDK environment variable |
ApiKey |
required for every kind but ollama; a provider without one stays unconfigured and its calls answer NotConfigured without a request. Ollama's /v1 through openai takes any non-empty key |
TimeoutSeconds |
the per-attempt timeout (default 60); passing it answers Timeout |
A model is referenced as {provider}/{model}: anthropic/claude-haiku-5-5, groq/openai/gpt-oss-20b,
ollama/llama3.2 (AiModelRef.TryParse).
Usage
services.AddAiProviders(configuration, providers =>
providers.Providers["anthropic"].TimeoutSeconds = 30); // optional: code runs after the binding
var result = await caller.CallAsync(new AiCallRequest
{
Model = new AiModelRef("anthropic", "claude-haiku-5-5"),
System = "You sort notes into one label.",
User = "Sort: buy milk",
JsonSchema = """{"type":"object","properties":{"label":{"type":"string"}},"required":["label"]}""",
SchemaName = "sort-note",
Effort = "none",
});
// result.Text, or result.ErrorKind + result.Error; result.InputTokens, CacheReadTokens, CacheWriteTokens, LatencyMs
A product that only wants a chat client registers one:
services.AddAiProviders(configuration).AddAiChatClient("ollama", "llama3.2");
// inject IChatClient
Behaviour
- Request: a system message (skipped when empty) and a user message;
ModelId,MaxOutputTokens,Temperature;JsonSchemaas a JSON-schema response format (Anthropicoutput_config.format, OpenAIresponse_format, Ollamaformat);Effortnone|low|medium|highasChatOptions.Reasoning(Anthropic:nonedisables thinking, the rest turn on adaptive thinking at that effort; OpenAI:reasoning_effort; Ollama:think). LeaveEffortempty for a model without reasoning.CacheSystemmarks Anthropic's system blockcache_control: ephemeral. - Thinking off on Anthropic:
nonesendsthinking: {"type":"disabled"}. A model that always thinks (Sonnet 5.5) answers 400 namingbetween_tools; the same attempt then goes again once with{"type":"between_tools"}, and the caller sends that first for the model from then on. No other effort sends it. One call reports both attempts' latency and the answering attempt's usage. - Schema refused as too complex: Anthropic compiles a response schema into a grammar and refuses a large one with
a 400 before any token is billed ("The compiled grammar is too large", or the documented "Schema is too complex for
compilation"; its limits are 24 optional and 16 union-typed parameters per request, plus an internal grammar size).
The same attempt then goes again once without the schema format: the system message ends with "Answer with one JSON
object that matches this JSON schema:" and the schema, still cache-marked, and the response format becomes the
kind's JSON mode (OpenAI
json_object, Ollama"json") or none (Anthropic). The caller remembers the refusal per{provider}/{model}and schema hash and sends the schema in the instructions first from then on, whatever the retry answered;AiCallResult.SchemaInInstructionssays so. Any other 400 fails as before. No OpenAI-compatible wording is matched: neither the SDK nor the docs name one. The Ai module checks the answer exactly as it checks a structured one, a fence or prose around the object stripped. - Usage:
InputTokensholds every input token, cache reads and writes included, for every kind;OutputTokensincludes reasoning. Ollama reports neither cache nor reasoning counts. - Errors: 401/403
Unauthorized, 408 and the provider timeoutTimeout, 429RateLimited, 5xx and Anthropic's 529Unavailable, other 4xxBadRequest, unreachable hostsNetwork, a refusal (refusal,content_filter)ContentFilteredwith no text, an empty answerInvalidResponse.Errorholds the provider's message, at most 500 characters, with the key removed. Every SDK runs a single attempt; the caller's own cancellation throws.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Anthropic (>= 13.8.0)
- Microsoft.AspNetCore.SignalR.StackExchangeRedis (>= 11.0.0)
- Microsoft.Extensions.AI.OpenAI (>= 10.8.3)
- OpenAI (>= 2.12.0)
- WoW2.Sdk.Beta.Be (>= 11.0.1-beta)
- WoW2.Sdk.Beta.Be.Abstractions (>= 11.0.1-beta)
- WoW2.Sdk.Beta.Be.Ai.Abstractions (>= 11.0.0-beta)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on WoW2.Sdk.Beta.Be.Ai.Providers:
| Package | Downloads |
|---|---|
|
WoW2.Sdk.Beta.Be.Ai.Module
Ai Form 1: the in-process runner, prompt registry, model prices, inference log and evals over the consumer's PostgreSQL database, with its SQL migration set. |
|
|
WoW2.Sdk.Beta.Be.Ai.Hosting
Ai HTTP API: the routes under api/ai/ over the contract's brokers, with ai.* scope policies and per-caller data scopes, for any host to mount. |
|
|
WoW2.Sdk.Beta.Be.Ai.Testing
Ai test kit: a scripted model caller and the prompts and evals conformance suites every implementation must pass. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.0-beta | 261 | 11/25/2026 |
| 10.0.5-beta | 297 | 11/19/2026 |
| 10.0.4-beta | 169 | 11/19/2026 |
| 10.0.3-beta | 156 | 11/18/2026 |
| 10.0.2-beta | 127 | 11/17/2026 |
| 10.0.1-beta | 139 | 11/17/2026 |
| 10.0.0-beta | 155 | 11/17/2026 |