/anthropic/v1/messages. You can use the official @anthropic-ai/sdk or Anthropic Python SDK without changing application logic.
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)
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);
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."}
]
}'
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 |
| Anthropic tool use | Anthropic Tool Use |
| Reasoning & extended thinking | Extended Thinking |
| Multimodal image input | Anthropic Vision |