anthropics/anthropic-sdk-csharp

Access to Anthropic's safety-first language model APIs in C#

What it is

The Anthropic SDK for C# is a C# library that lets your .NET applications talk to the Claude API. It is distributed as the NuGet package Anthropic.

Important version note

  • Version 10+ of the Anthropic package is the official Anthropic SDK for C#.
  • Versions 3.X and below were a community-built SDK called tryAGI. That project has moved to the package name tryAGI.Anthropic.
  • If you were using the old community client, switch your package reference to tryAGI.Anthropic.

Installation

Add the package with:

dotnet add package Anthropic

Getting started

The README shows a minimal example:

using System;
using Anthropic;
using Anthropic.Models.Messages;

AnthropicClient client = new();

MessageCreateParams parameters = new()
{
    MaxTokens = 1024,
    Messages =
    [
        new UserMessageParam("Hello, Claude")
    ],
    Model = Model.ClaudeOpus5_5,
};

var message = await client.Messages.Create(parameters);

Console.WriteLine(message);

In short: create an AnthropicClient, build a MessageCreateParams object with the model, token limit, and user message, then call client.Messages.Create(...) and print the result.

Requirements

  • .NET Standard 2.0+

Documentation

Full documentation is available at: platform.claude.com/docs/en/api/sdks/csharp

Contributing

See CONTRIBUTING.md in the repository.

License

  • The project is licensed under the Apache License, Version 2.0.
  • Versions released before the change from the MIT License, and third-party contributions merged before that change, remain under the MIT License.

Related

  • Project
  • Project
  • Project
  • Project
  • Project