Anthropic.SDK
1.1.1
See the version list below for details.
dotnet add package Anthropic.SDK --version 1.1.1
NuGet\Install-Package Anthropic.SDK -Version 1.1.1
<PackageReference Include="Anthropic.SDK" Version="1.1.1" />
<PackageVersion Include="Anthropic.SDK" Version="1.1.1" />
<PackageReference Include="Anthropic.SDK" />
paket add Anthropic.SDK --version 1.1.1
#r "nuget: Anthropic.SDK, 1.1.1"
#:package Anthropic.SDK@1.1.1
#addin nuget:?package=Anthropic.SDK&version=1.1.1
#tool nuget:?package=Anthropic.SDK&version=1.1.1
Anthropic.SDK
Anthropic.SDK is an unofficial C# client designed for interacting with the Claude AI API. This powerful interface simplifies the integration of the Claude AI into your C# applications. It targets netstandard2.0, and .net6.0.
Table of Contents
Installation
Install Anthropic.SDK via the NuGet package manager:
PM> Install-Package Anthropic.SDK
API Keys
You can load the API Key from an environment variable named ANTHROPIC_API_KEY by default. Alternatively, you can supply it as a string to the AnthropicClient constructor.
IHttpClientFactory
The AnthropicClient can optionally take an IHttpClientFactory, which allows you to control elements such as retries and timeouts.
Usage
To start using the Claude AI API, simply create an instance of the AnthropicClient class.
Examples
Non-Streaming Call
Here's an example of a non-streaming call to the Claude AI API:
var client = new AnthropicClient();
var prompt = AnthropicSignals.HumanSignal + "Write me a sonnet about Joe Biden." +
AnthropicSignals.AssistantSignal;
var parameters = new SamplingParameters()
{
// required
Model = AnthropicModels.Claude_v2_0
Prompt = prompt,
MaxTokensToSample = 512,
//optional
Temperature = 1,
Top_k = 1,
Top_p = 1
StopSequences = new[] { AnthropicSignals.HumanSignal },
Stream = false
};
var response = await client.Completions.GetClaudeCompletionAsync(parameters);
Streaming Call
The following is an example of a streaming call to the Claude AI API:
var client = new AnthropicClient();
var prompt = AnthropicSignals.HumanSignal + "Write me a sonnet about Joe Biden." +
AnthropicSignals.AssistantSignal;
var parameters = new SamplingParameters()
{
MaxTokensToSample = 512,
Prompt = prompt,
Temperature = 0.0m,
StopSequences = new[] { AnthropicSignals.HumanSignal },
Stream = true,
Model = AnthropicModels.Claude_v2
};
await foreach (var res in client.Completions.StreamClaudeCompletionAsync(parameters))
{
Console.Write(res.Completion);
}
Contributing
Pull requests are welcome. If you're planning to make a major change, please open an issue first to discuss your proposed changes.
License
This project is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.Http (>= 7.0.0)
- System.Text.Json (>= 6.0.7)
-
net6.0
- Microsoft.Extensions.Http (>= 7.0.0)
NuGet packages (30)
Showing the top 5 NuGet packages that depend on Anthropic.SDK:
| Package | Downloads |
|---|---|
|
JD.SemanticKernel.Connectors.ClaudeCode
Claude connector for Semantic Kernel with API-key-first authentication and optional local interactive OAuth support. Provides UseClaudeCodeChatCompletion() to wire Claude access into Semantic Kernel applications. |
|
|
OBotService
OBase Framework |
|
|
Weavy.Core
A class library containing core business logic, data access and utility methods required by Weavy. |
|
|
CleanCodeJN.GenericApis
Build production-ready .NET Web APIs in minutes, not days. CleanCodeJN.GenericApis is the ultimate full-stack API framework combining REST (Minimal APIs + MVC Controllers), GraphQL (HotChocolate), and MCP (Model Context Protocol) — all from a single generic setup. Powered by MediatR CQRS, AutoMapper, FluentValidation, and Entity Framework, it eliminates boilerplate for GET, GET by ID, POST, PUT, PATCH, and DELETE operations across every layer. Built-in pipeline behaviors deliver transparent caching and structured logging out of the box. The integrated AI Proxy streams responses from Anthropic Claude directly through your API, while the MCP server automatically exposes all your CRUD endpoints as discoverable tools for AI assistants like Claude, Cursor, and Copilot. Designed around the Integration Operation Segregation Principle (IOSP) for clean, testable, and maintainable business logic — at any scale. |
|
|
Weavy.Admin
Razor class library containing the management interface for Weavy. |
GitHub repositories (5)
Showing the top 5 popular GitHub repositories that depend on Anthropic.SDK:
| Repository | Stars |
|---|---|
|
SciSharp/BotSharp
AI Multi-Agent Framework in .NET
|
|
|
PederHP/mcpdotnet
.NET implementation of the Model Context Protocol (MCP)
|
|
|
signumsoftware/framework
Open Source framework for writing data-centric applications using the latest versions of .Net Core, C# (not-nullable), ASP.NET Web API, Typescript (strict), React, D3 and Sql Server or PostgreeSQL
|
|
|
suxrobGM/logistics-app
AI-powered fleet management platform with an agentic dispatcher that autonomously matches loads to trucks, ensures HOS compliance, and optimizes routes. Built for trucking companies.
|
|
|
NeilMacMullen/kusto-loco
C# KQL query engine with flexible I/O layers and visualization
|
| Version | Downloads | Last Updated |
|---|---|---|
| 5.10.0 | 386,676 | 2/20/2026 |
| 5.9.0 | 161,197 | 1/22/2026 |
| 5.8.0 | 245,104 | 10/24/2025 |
| 5.7.1 | 10,382 | 10/21/2025 |
| 5.7.0 | 3,770 | 10/20/2025 |
| 5.6.0 | 60,490 | 10/6/2025 |
| 5.5.3 | 114,071 | 9/30/2025 |
| 5.5.2 | 30,863 | 9/23/2025 |
| 5.5.1 | 45,741 | 8/23/2025 |
| 5.5.0 | 151,949 | 8/2/2025 |
| 5.4.3 | 69,397 | 7/10/2025 |
| 5.4.2 | 14,532 | 6/28/2025 |
| 5.4.1 | 98,233 | 5/27/2025 |
| 5.4.0 | 4,712 | 5/25/2025 |
| 5.3.0 | 8,352 | 5/16/2025 |
| 5.2.3 | 11,586 | 5/15/2025 |
| 5.2.2 | 6,272 | 5/9/2025 |
| 5.2.1 | 4,152 | 5/9/2025 |
| 5.2.0 | 7,695 | 4/28/2025 |
| 1.1.1 | 1,296 | 7/24/2023 |
Adds model constants and signal types as well as better validations.