POST /v1/messages accepts the Anthropic Messages format. Existing Anthropic SDK applications can preserve native structures such as system, content blocks, tool calls, and streaming events while changing only the Base URL and API key.
Basic request
curl https://api.nbility.ai/v1/messages \
-H "x-api-key: $NBILITY_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 512,
"messages": [
{"role": "user", "content": "Explain API gateways in two sentences."}
]
}'
Python SDK
import os
from anthropic import Anthropic
client = Anthropic(
api_key=os.environ["NBILITY_API_KEY"],
base_url="https://api.nbility.ai",
)
message = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=512,
messages=[{"role": "user", "content": "Summarize this in two lines."}],
)
print(message.content[0].text)
Common fields
| Field | Required | Description |
|---|---|---|
model | yes | Claude model ID from the live catalog |
max_tokens | yes | Maximum output tokens |
messages | yes | Array of user and assistant messages |
system | no | String or system content blocks; do not use system as a message role |
stream | no | Returns Anthropic-style streaming events |
tools / tool_choice | no | Tool definitions and selection policy |
thinking | no | Extended-thinking configuration, only when supported by the model and channel |
Nbility preserves the Anthropic format where possible, but caching, extended thinking, tool details, beta headers, and newly introduced fields may vary by channel. If a native field is unsupported, use Chat Completions, or configure Nbility directly in Claude Code.