Table of Contents

Interface IAnthropicApiClient

Namespace
AnthropicClient
Assembly
AnthropicClient.dll

Represents a client for interacting with the Anthropic API.

public interface IAnthropicApiClient

Methods

CountMessageTokensAsync(CountMessageTokensRequest)

Counts the tokens in a message asynchronously.

Task<AnthropicResult<TokenCountResponse>> CountMessageTokensAsync(CountMessageTokensRequest request)

Parameters

request CountMessageTokensRequest

The count message tokens request.

Returns

Task<AnthropicResult<TokenCountResponse>>

A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T> where T is TokenCountResponse.

CreateMessageAsync(MessageRequest)

Creates a message asynchronously.

Task<AnthropicResult<MessageResponse>> CreateMessageAsync(MessageRequest request)

Parameters

request MessageRequest

The message request to create.

Returns

Task<AnthropicResult<MessageResponse>>

A task that represents the asynchronous operation. The task result contains the response as an AnthropicResult<T>.

CreateMessageAsync(StreamMessageRequest)

Creates a message asynchronously and streams the response.

IAsyncEnumerable<AnthropicEvent> CreateMessageAsync(StreamMessageRequest request)

Parameters

request StreamMessageRequest

The message request to create.

Returns

IAsyncEnumerable<AnthropicEvent>

An asynchronous enumerable that yields the response event by event.