POST /v1/messages — Native Anthropic Claude API format
Endpoint
POST /v1/messages
Overview
This endpoint accepts the native Anthropic Claude Messages API format. Use this if you're already using the Anthropic SDK or want to use Claude-specific features like extended thinking.
Authentication
x-api-key: YOUR_API_KEY
anthropic-version: 2023-06-01
Request Body
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | yes | Claude model, e.g. "claude-opus-4-5", "claude-sonnet-4-5" | |
max_tokens | integer | yes | Maximum tokens to generate | |
messages | array | yes | Array of message objects (role + content) | |
system | string | array | no | System prompt (string or content block array) | |
stream | boolean | no | false | Enable streaming |
temperature | number | no | Sampling temperature (0–1) | |
top_p | number | no | Nucleus sampling threshold | |
top_k | integer | no | Top-K sampling | |
thinking | object | no | Enable extended thinking: {"type":"enabled","budget_tokens":10000} |
Example
cURL
curl https://api.nbility.dev/v1/messages \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-5",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Explain the theory of relativity briefly."}
]
}'
Python
import anthropic
client = anthropic.Anthropic(
api_key="YOUR_API_KEY",
base_url="https://api.nbility.dev"
)
message = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1024,
messages=[
{"role": "user", "content": "Explain the theory of relativity briefly."}
]
)
print(message.content[0].text)
Response
{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "The theory of relativity..."
}
],
"model": "claude-sonnet-4-5",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 15,
"output_tokens": 120
}
}
Note You can also use Claude models via the standard
/v1/chat/completionsendpoint usingAuthorization: Bearerauthentication — no format conversion needed.