Table of Contents

Interface IAnthropicApiClient

Namespace
AnthropicClient
Assembly
AnthropicClient.dll

Represents a client for interacting with the Anthropic API.

public interface IAnthropicApiClient

Methods

CancelMessageBatchAsync(string)

Cancels a message batch asynchronously.

Task<AnthropicResult<MessageBatchResponse>> CancelMessageBatchAsync(string batchId)

Parameters

batchId string

The ID of the message batch to cancel.

Returns

Task<AnthropicResult<MessageBatchResponse>>

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

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.

CreateMessageBatchAsync(MessageBatchRequest)

Creates a batch of messages asynchronously.

Task<AnthropicResult<MessageBatchResponse>> CreateMessageBatchAsync(MessageBatchRequest request)

Parameters

request MessageBatchRequest

The message batch request to create.

Returns

Task<AnthropicResult<MessageBatchResponse>>

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

DeleteMessageBatchAsync(string)

Deletes a message batch asynchronously.

Task<AnthropicResult<MessageBatchDeleteResponse>> DeleteMessageBatchAsync(string batchId)

Parameters

batchId string

The ID of the message batch to delete.

Returns

Task<AnthropicResult<MessageBatchDeleteResponse>>

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

GetMessageBatchAsync(string)

Gets a message batch asynchronously.

Task<AnthropicResult<MessageBatchResponse>> GetMessageBatchAsync(string batchId)

Parameters

batchId string

The ID of the message batch to get.

Returns

Task<AnthropicResult<MessageBatchResponse>>

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

GetMessageBatchResultsAsync(string)

Gets the results of a message batch asynchronously.

Task<AnthropicResult<IAsyncEnumerable<MessageBatchResultItem>>> GetMessageBatchResultsAsync(string batchId)

Parameters

batchId string

The ID of the message batch to get the results for.

Returns

Task<AnthropicResult<IAsyncEnumerable<MessageBatchResultItem>>>

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

GetModelAsync(string)

Gets a model by its ID asynchronously.

Task<AnthropicResult<AnthropicModel>> GetModelAsync(string modelId)

Parameters

modelId string

The ID of the model to get.

Returns

Task<AnthropicResult<AnthropicModel>>

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

ListAllMessageBatchesAsync(int)

Lists all message batches asynchronously.

IAsyncEnumerable<AnthropicResult<Page<MessageBatchResponse>>> ListAllMessageBatchesAsync(int limit = 20)

Parameters

limit int

The maximum number of message batches to return in each page.

Returns

IAsyncEnumerable<AnthropicResult<Page<MessageBatchResponse>>>

An asynchronous enumerable that yields the response as an AnthropicResult<T> where T is Page<T> where T is MessageBatchResponse.

ListAllModelsAsync(int)

Lists the models asynchronously

IAsyncEnumerable<AnthropicResult<Page<AnthropicModel>>> ListAllModelsAsync(int limit = 20)

Parameters

limit int

The maximum number of models to return in each page.

Returns

IAsyncEnumerable<AnthropicResult<Page<AnthropicModel>>>

An asynchronous enumerable that yields the response as an AnthropicResult<T> where T is Page<T> where T is AnthropicModel.

ListMessageBatchesAsync(PagingRequest?)

Lists the message batches asynchronously.

Task<AnthropicResult<Page<MessageBatchResponse>>> ListMessageBatchesAsync(PagingRequest? request = null)

Parameters

request PagingRequest

The paging request to use for listing the message batches.

Returns

Task<AnthropicResult<Page<MessageBatchResponse>>>

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

ListModelsAsync(PagingRequest?)

Lists the models asynchronously.

Task<AnthropicResult<Page<AnthropicModel>>> ListModelsAsync(PagingRequest? request = null)

Parameters

request PagingRequest

The paging request to use for listing the models.

Returns

Task<AnthropicResult<Page<AnthropicModel>>>

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