Generated C# SDK based on official Anthropic OpenAPI specification using NSwag.
Includes tokenizer and some helper methods.
using Anthropic;
using var client = new HttpClient();
var api = new AnthropicApi(apiKey, client);
var response = await api.CompleteAsync(new CreateCompletionRequest
{
Model = ModelIds.ClaudeInstant,
Prompt = "Once upon a time".AsPrompt(),
Max_tokens_to_sample = 250,
});
Console.WriteLine(response.Completion);
// or use history syntax
var response = await api.CompleteAsync(new CreateCompletionRequest
{
Model = ModelIds.ClaudeInstant,
Prompt = new[]
{
"What's the weather like today?".AsHumanMessage(),
"Sure! Could you please provide me with your location?".AsAssistantMessage(),
"Dubai, UAE".AsHumanMessage(),
}.AsPrompt(),
Max_tokens_to_sample = 300,
});
Priority place for bugs: https://github.com/tryAGI/Anthropic/issues
Priority place for ideas and general questions: https://github.com/tryAGI/Anthropic/discussions
Discord: https://discord.gg/Ca2xhfBf3v