Anthropic API (Claude)
Anthropic-compatible Messages API. Works with Claude Code and the official Anthropic SDKs. The base URL is the bare domain — without /v1. Requires a key bound to a Claude group.
Environment variables
Claude Code and the Anthropic SDKs read these automatically:
export ANTHROPIC_BASE_URL="https://apixly.ai"
export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"Messages API
| Field | Meaning |
|---|---|
| content[] | The reply as an array of blocks — concatenate the text blocks for the full text |
| stop_reason | end_turn = finished normally; max_tokens = truncated by the token limit |
| usage | input_tokens / output_tokens — the basis for billing |
curl https://apixly.ai/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-6",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello"}]
}'{
"id": "msg_01ABC...",
"type": "message",
"role": "assistant",
"content": [{ "type": "text", "text": "Hello! How can I help?" }],
"model": "claude-sonnet-4-6",
"stop_reason": "end_turn",
"usage": { "input_tokens": 10, "output_tokens": 12 }
}Auth uses the x-api-key header plus anthropic-version — not a Bearer token.
Token count
POST /v1/messages/count_tokens accepts model, messages and optional system/tools with the Messages shape. Availability depends on the upstream account; model listing does not guarantee this endpoint. Use the final generation usage for billing reconciliation.
Model-specific request contracts
Discover available IDs with GET /v1/models using your key. The public price catalog is not a guarantee of current routing. Existing valid requests need no changes; optional fields are model-specific.
POST /v1/messages: model,max_tokens,messages; system is top-level. Opus4.5 supports effort=low/medium/high with or without manual enabled thinking; it does not support adaptive. Sonnet/Haiku4.5 do not support effort. Opus4.6/Sonnet4.6 support adaptive and still accept enabled+budget_tokens; budget must be below max_tokens. Opus4.7/4.8 and Claude5 use adaptive instead of enabled+budget; the gateway converts the old shape. xhigh is retained for supported Opus4.7/4.8 and the listed Claude5 models; it is not universal for4.6. Opus5.5 cannot disable thinking; Sonnet5.5 uses between_tools (low/medium/high) to omit up-front thinking, not disabled. SDK base URL is the bare domain.
| Model | Request contract |
|---|---|
| claude-fable-5 · claude-fable-5-1 · claude-haiku-4-5-20251001 · claude-opus-4-5-20251101 · claude-opus-4-6 · claude-opus-4-7 · claude-opus-4-8 · claude-opus-5 · claude-opus-5-5 · claude-sonnet-4-5-20250929 · claude-sonnet-4-6 · claude-sonnet-5 · claude-sonnet-5-5 | POST /v1/messages · system/messages/max_tokens · thinking/output_config |