> For the complete documentation index, see [llms.txt](https://docs.wisej.com/ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/ai/components/api/smartendpoint/wisej.ai.endpoints.anthropicendpoint.md).

# AnthropicEndpoint

Namespace: **Wisej.AI.Endpoints**

Assembly: **Wisej.AI** (3.5.0.0)

* [SmartEndpoint](/ai/components/api/smartendpoint.md)
  * [SmartHttpEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.smarthttpendpoint.md)
    * [AnthropicEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.anthropicendpoint.md)

Represents an endpoint for connecting to Anthropic services.

{% tabs %}
{% tab title="C#" %}

```csharp
public class AnthropicEndpoint : SmartHttpEndpoint
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class AnthropicEndpoint
    Inherits SmartHttpEndpoint
```

{% endtab %}
{% endtabs %}

This class is used to configure and manage connections to Anthropic endpoints, providing methods to send messages and handle responses. It inherits from [SmartHttpEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.smarthttpendpoint.md).

## Constructors

### ![](/files/ptrKjmmRoQB76pvrIqh0) AnthropicEndpoint()

Initializes a new instance of the [AnthropicEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.anthropicendpoint.md) class.

Sets default values for authentication, model, URL, and headers.

## Properties

### ![](/files/ptrKjmmRoQB76pvrIqh0) Authentication

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the authentication method for the endpoint. (Default: `"x-api-key"`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) Model

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the model used by the Anthropic endpoint. (Default: `"claude-3-5-sonnet-20241022"`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) URL

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the URL for the Anthropic API endpoint. (Default: `"https://api.anthropic.com/v1/messages"`)

## Methods

### ![](/files/KL0Ik37djZRr8a07Wopd) AddMessages(payload, session, messages)

Adds messages to the payload for the Anthropic API request.

| Parameter    | Type                                                                                        | Description                      |
| ------------ | ------------------------------------------------------------------------------------------- | -------------------------------- |
| **payload**  | [Object](https://docs.microsoft.com/dotnet/api/system.object)                               | The payload to be sent.          |
| **session**  | [SmartSession](/ai/components/api/smartsession.md)                                          | The current session.             |
| **messages** | [IList\<Message>](https://docs.microsoft.com/dotnet/api/system.collections.generic.ilist-1) | The list of messages to include. |

Prepares the system message and other messages for the API request.**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown if *session* , *payload* , or *messages* is null.

### ![](/files/KL0Ik37djZRr8a07Wopd) AddOptions(message, session)

Adds options to the message before sending it to the Anthropic endpoint.

| Parameter   | Type                                                          | Description             |
| ----------- | ------------------------------------------------------------- | ----------------------- |
| **message** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The message to be sent. |
| **session** | [SmartSession](/ai/components/api/smartsession.md)            | The current session.    |

Sets default values for temperature and max tokens in the message.

### ![](/files/KL0Ik37djZRr8a07Wopd) BuildMessage(message)

Builds a message object for the Anthropic API.

| Parameter   | Type                                                                        | Description                  |
| ----------- | --------------------------------------------------------------------------- | ---------------------------- |
| **message** | [Message](/ai/components/api/smartsession/wisej.ai.smartsession.message.md) | The message to be converted. |

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). An object representing the message for the API.

Handles different input types, including text and images.**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown if *message* is null.

### ![](/files/KL0Ik37djZRr8a07Wopd) ReadAssistantMessage(response, message)

Reads the assistant's message from the response.

| Parameter    | Type                                                                            | Description                     |
| ------------ | ------------------------------------------------------------------------------- | ------------------------------- |
| **response** | [Response](/ai/components/api/smartendpoint/wisej.ai.smartendpoint.response.md) | The response from the API.      |
| **message**  | [Message](/ai/components/api/smartsession/wisej.ai.smartsession.message.md)     | The message object to populate. |

Parses the response content and updates the message text.**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown if *response* or *message* is null.

### ![](/files/KL0Ik37djZRr8a07Wopd) ReadUsage(message, reply)

Reads the usage information from the API reply.

| Parameter   | Type                                                                        | Description                            |
| ----------- | --------------------------------------------------------------------------- | -------------------------------------- |
| **message** | [Message](/ai/components/api/smartsession/wisej.ai.smartsession.message.md) | The message object to update.          |
| **reply**   | [Object](https://docs.microsoft.com/dotnet/api/system.object)               | The dynamic reply object from the API. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/ai/components/api/smartendpoint/wisej.ai.endpoints.anthropicendpoint.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
