Skip to content

Commit

Permalink
RM
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Mar 6, 2024
1 parent 0ea9583 commit 726ccb6
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,41 @@
# Claudia

Unofficial [Anthropic API](https://www.anthropic.com/api) client for .NET.

We have built a C# API similar to the official [Python SDK](https://github.com/anthropics/anthropic-sdk-python) and [TypeScript SDK](https://github.com/anthropics/anthropic-sdk-typescript). It supports netstandard2.1, net6.0, and net8.0. If you want to use it in Unity, please reference it from [NuGetForUnity](https://github.com/GlitchEnzo/NuGetForUnity).


Installation
---
This library is distributed via NuGet, supporting .NET Standard 2.1, .NET 6(.NET 7) and .NET 8 or above.

PM> Install-Package [Claudia](https://www.nuget.org/packages/Claudia)

Usage
---
For details about the API, please check the [official API reference](https://docs.anthropic.com/claude/reference/getting-started-with-the-api).

```csharp
using Claudia;

var anthropic = new Anthropic
{
ApiKey = "my_api_key"
};

var message = await anthropic.Messages.CreateAsync(new()
{
Model = "claude-3-opus-20240229",
MaxTokens = 1024,
Messages = [new() { Role = "user", Content = "Hello, Claude" }]
});

Console.WriteLine(message);
```

Handling errors
---
If the API call fails, a `ClaudiaException` will be thrown. You can check the `ErrorCode`, `Type`, and `Message` from the `ClaudiaException`.

License
---
Expand Down
4 changes: 4 additions & 0 deletions src/Claudia/Claudia.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<Description>Anthropic Claude Client for .NET.</Description>
</PropertyGroup>

<ItemGroup>
<None Include="../../Icon.png" Pack="true" PackagePath="/" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="PolySharp" Version="1.13.2">
<PrivateAssets>all</PrivateAssets>
Expand Down

0 comments on commit 726ccb6

Please sign in to comment.