Anthropic
Anthropic Messages
Send a structured list of input messages and receive a model-generated response.
POST
v1/messagesAuthorizations
X-Api-Keystringheaderrequired
Use the following format for authentication: sk-pat-YourAccessToken
anthropic-versionstringheaderrequired
API version, currently 2023-06-01
The key value is your HAI Gateway Personal Access Token (starting with sk-pat-). No separate API key from Anthropic is required.
Base URL
Body Parameters
The request body format is fully compatible with the official Anthropic Messages API. For detailed parameter descriptions, refer to the Anthropic official documentation.
cURL
curl https://api.hai.network/anthropic/v1/messages \
-H "Content-Type: application/json" \
-H "anthropic-version: 2023-06-01" \
-H "X-Api-Key: sk-pat-YourAccessToken" \
-d '{
"model": "claude-opus-4-6",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Hello, world"
}
]
}'200
{
"id": "msg_01XFDUDYJgAACzvnptvVoYEL",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! How can I help you today?"
}
],
"model": "claude-opus-4-6",
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 12,
"output_tokens": 10
}
}