WoW2.Sdk.Beta.Be.Ai.Providers 11.0.0-beta

Prefix Reserved
This is a prerelease version of WoW2.Sdk.Beta.Be.Ai.Providers.
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
                    
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="WoW2.Sdk.Beta.Be.Ai.Providers" Version="11.0.0-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WoW2.Sdk.Beta.Be.Ai.Providers" Version="11.0.0-beta" />
                    
Directory.Packages.props
<PackageReference Include="WoW2.Sdk.Beta.Be.Ai.Providers" />
                    
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 WoW2.Sdk.Beta.Be.Ai.Providers --version 11.0.0-beta
                    
#r "nuget: WoW2.Sdk.Beta.Be.Ai.Providers, 11.0.0-beta"
                    
#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 WoW2.Sdk.Beta.Be.Ai.Providers@11.0.0-beta
                    
#: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=WoW2.Sdk.Beta.Be.Ai.Providers&version=11.0.0-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=WoW2.Sdk.Beta.Be.Ai.Providers&version=11.0.0-beta&prerelease
                    
Install as a Cake Tool

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 official Anthropic SDK), openai (any OpenAI-compatible Chat Completions host: OpenAI, Groq, DeepSeek, Ollama's /v1) and ollama (OllamaSharp, Ollama's native API).
  • IAiModelCaller calls a model once and never throws for a provider failure: it returns the text as given, or a classified AiErrorKind, 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.
  • IAiChatClients hands out one chat client per provider and model, wrapped with OpenTelemetry (gen_ai spans and metrics on the source Experimental.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; JsonSchema as a JSON-schema response format (Anthropic output_config.format, OpenAI response_format, Ollama format); Effort none|low|medium|high as ChatOptions.Reasoning (Anthropic: none disables thinking, the rest turn on adaptive thinking at that effort; OpenAI: reasoning_effort; Ollama: think). Leave Effort empty for a model without reasoning. CacheSystem marks Anthropic's system block cache_control: ephemeral.
  • Thinking off on Anthropic: none sends thinking: {"type":"disabled"}. A model that always thinks (Sonnet 5.5) answers 400 naming between_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.SchemaInInstructions says 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: InputTokens holds every input token, cache reads and writes included, for every kind; OutputTokens includes reasoning. Ollama reports neither cache nor reasoning counts.
  • Errors: 401/403 Unauthorized, 408 and the provider timeout Timeout, 429 RateLimited, 5xx and Anthropic's 529 Unavailable, other 4xx BadRequest, unreachable hosts Network, a refusal (refusal, content_filter) ContentFiltered with no text, an empty answer InvalidResponse. Error holds 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 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 (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