> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neosantara.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Anthropic Messages API

> Send Claude message requests using the official Anthropic SDKs and cURL.

Neosantara provides complete protocol parity with the [Anthropic](https://www.anthropic.com/?utm_source=neosantara-docs\&utm_medium=referral) Messages API through `/anthropic/v1/messages`. You can use the official `@anthropic-ai/sdk` or Anthropic Python SDK without changing application logic.

<CodeGroup>
  ```python Python icon="python" theme={"theme":{"light":"ayu-dark","dark":"catppuccin-latte"}}
  from anthropic import Anthropic
  import os

  client = Anthropic(
      base_url="https://api.neosantara.xyz/anthropic",
      api_key=os.environ["NEOSANTARA_API_KEY"]
  )

  message = client.messages.create(
      model="claude-sonnet-4-6",
      max_tokens=1024,
      messages=[
          {"role": "user", "content": "Explain AI gateways in one concise paragraph."}
      ]
  )

  print(message.content[0].text)
  ```

  ```typescript TypeScript icon="js" theme={"theme":{"light":"ayu-dark","dark":"catppuccin-latte"}}
  import Anthropic from "@anthropic-ai/sdk";

  const client = new Anthropic({
    baseURL: "https://api.neosantara.xyz/anthropic",
    apiKey: process.env.NEOSANTARA_API_KEY,
  });

  const message = await client.messages.create({
    model: "claude-sonnet-4-6",
    max_tokens: 1024,
    messages: [
      { role: "user", content: "Explain AI gateways in one concise paragraph." },
    ],
  });

  console.log(message.content[0].text);
  ```

  ```bash cURL icon="terminal" theme={"theme":{"light":"ayu-dark","dark":"catppuccin-latte"}}
  curl -X POST https://api.neosantara.xyz/anthropic/v1/messages \
    -H "x-api-key: $NEOSANTARA_API_KEY" \
    -H "anthropic-version: 2023-06-01" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "claude-sonnet-4-6",
      "max_tokens": 1024,
      "messages": [
        {"role": "user", "content": "Explain how an AI gateway works in one paragraph."}
      ]
    }'
  ```
</CodeGroup>

## Required Headers

| Header              | Value              | Description                     |
| :------------------ | :----------------- | :------------------------------ |
| `x-api-key`         | `nsk_...`          | Your Neosantara API key.        |
| `anthropic-version` | `2023-06-01`       | Anthropic API protocol version. |
| `Content-Type`      | `application/json` | Request payload format.         |

## Anthropic vs OpenAI Protocol Differences

| Concept                | Anthropic Messages                          | OpenAI Chat Completions                            |
| :--------------------- | :------------------------------------------ | :------------------------------------------------- |
| **System Prompt**      | Top-level `system` parameter                | Message item with `role: "system"` in `messages`   |
| **Output Token Limit** | `max_tokens` is mandatory                   | `max_tokens` is optional (model default applies)   |
| **Message Output**     | Array of content objects: `content[0].text` | Single choice object: `choices[0].message.content` |
| **Base URL**           | `https://api.neosantara.xyz/anthropic`      | `https://api.neosantara.xyz/v1`                    |

## Advanced Features

| Feature                       | Guide                                                           |
| :---------------------------- | :-------------------------------------------------------------- |
| Streaming Claude responses    | [Streaming Responses](/en/gateway/anthropic-messages/streaming) |
| Anthropic tool use            | [Anthropic Tool Use](/en/gateway/anthropic-messages/tool-use)   |
| Reasoning & extended thinking | [Extended Thinking](/en/gateway/anthropic-messages/thinking)    |
| Multimodal image input        | [Anthropic Vision](/en/gateway/anthropic-messages/vision)       |


## Related topics

- [Anthropic Streaming](/en/gateway/anthropic-messages/streaming.md)
- [Anthropic Extended Thinking](/en/gateway/anthropic-messages/thinking.md)
- [Anthropic Tool Use](/en/gateway/anthropic-messages/tool-use.md)
- [Anthropic Vision](/en/gateway/anthropic-messages/vision.md)
