# Class AnthropicApiClient

Namespace
  AnthropicClient

Assembly
  AnthropicClient.dll

Represents a client for interacting with the Anthropic API.

    public class AnthropicApiClient : IAnthropicApiClient

Inheritance
  object
  AnthropicApiClient

Implements
  IAnthropicApiClient

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

## Constructors

### AnthropicApiClient(string, HttpClient)

Initializes a new instance of the AnthropicApiClient class.

    public AnthropicApiClient(string apiKey, HttpClient httpClient)

#### Parameters

`apiKey` string

  The API key to use for the client.

`httpClient` HttpClient

  The HTTP client to use for the client.

#### Exceptions

ArgumentNullException

  Thrown when the API key or HTTP client is null.

## Methods

### CreateMessageAsync(MessageRequest)

Creates a message asynchronously.

    public 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.

    public 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.