Universal.Operative.Sdk.Anthropic 1.0.0

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

About

Universal.Operative.Sdk.Anthropic plugs Anthropic's Messages API into Universal.Operative.Sdk via an IModel adapter (Model) backed by the Universal.Anthropic.Client transport, plus a small set of Anthropic-specific extensions (prompt caching, extended thinking, per-block cache_control) that don't belong in the provider-neutral core.

How to Use

Installation

dotnet add package Universal.Operative.Sdk.Anthropic

Configuration

using Universal.Operative.Sdk;
using Universal.Operative.Sdk.Anthropic;

IModel model = new Model("sk-ant-...", new Model.Options
{
    ModelId = "claude-sonnet-4-5",
    MaxTokens = 4096,          // required by Anthropic; defaults to 1024
    Temperature = 1.0f,
    UsePromptCaching = true,   // default: stamps ephemeral cache_control on system/tools automatically
});

The constructor also accepts an existing Universal.Anthropic.Client.V1.AnthropicClient in place of a raw API key, so you can reuse a client (custom HttpClient, headers) across models.

Usage

Drop the model into OperativeBuilder like any other IModel:

IOperative operative = OperativeBuilder.FromDefaults(model)
    .AddBaselineTools()
    .Build();

await foreach (OperativeEvent e in operative.ExecuteAsync(conversation))
{
    // handle events as usual — see Universal.Operative.Sdk's Package.md
}

Extended thinking

Set Model.Options.Thinking to enable Claude's extended-thinking mode; thinking blocks round-trip through the same provider-neutral Block model as everything else.

Prompt caching

With UsePromptCaching (default true), the adapter automatically stamps ephemeral cache_control breakpoints on the system prompt and tool definitions so they're reused from Anthropic's prompt cache across turns — no extra code needed for the common case.

To control caching on individual content blocks yourself, use the Anthropic extension property added onto Block:

using Universal.Operative.Sdk.Anthropic;

block.Anthropic.CacheControl = new CacheControl { Ttl = "1h" };

License

Free for noncommercial use under the Universal.Operative Noncommercial License. Source is closed; commercial use requires a separate license from Andrew Ong.

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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 54 7/4/2026
1.0.1 73 7/4/2026
1.0.0 84 7/3/2026

Initial release.