Anthropic Messages API
POST /v1/messages speaks the Anthropic Messages schema, so anything built on it (Claude Code, the Anthropic SDKs, and the agent frameworks that wrap them)
works against Sable by changing one environment variable.
export ANTHROPIC_BASE_URL=https://api.buildsable.com
export ANTHROPIC_AUTH_TOKEN=$SABLE_API_KEY
claudeUse Sable model ids (sable-llama-3.3-70b), not Anthropic ones; the catalog is
listed in Models.
What's translated
| Anthropic | Sable / OpenAI |
|---|---|
system (string or blocks) | hoisted to a leading system message |
max_tokens | max_tokens |
stop_sequences | stop |
tools[].input_schema | tools[].function.parameters |
tool_choice: {type:"any"} | tool_choice: "required" |
tool_choice: {type:"tool", name} | tool_choice: {type:"function", …} |
tool_use content blocks | assistant tool_calls |
tool_result content blocks | tool role messages |
stop_reason: max_tokens | finish_reason: length |
stop_reason: tool_use | finish_reason: tool_calls |
Streaming emits the Anthropic event sequence: message_start,
content_block_start, content_block_delta, content_block_stop,
message_delta, message_stop. Tool calls stream in Anthropic form too: a
streamed tool call opens a content_block_start with a tool_use block and
delivers its arguments as input_json_delta deltas, so Anthropic-native tool
loops work unmodified.
Errors arrive in the Anthropic error envelope,
{"type": "error", "error": {"type": "…", "message": "…"}}, rather than the
OpenAI shape, so an Anthropic SDK's error handling parses them natively.
Sable extensions
sable_privacy_tier, sable_region, and
sable_scrub work here exactly as they do on the
OpenAI surface, and the signed receipt is returned in the same x-sable-receipt
headers. On a streaming call the trailing sable.receipt SSE event is passed
through unchanged: an Anthropic-shaped client ignores the unknown event type, and
a Sable-aware one still gets its receipt.
Implementation note
This endpoint translates the request and delegates to the same handler that
serves /v1/chat/completions. It does not open its own upstream connection.
Sealing on ingress, credit authorization, per-key scopes, metering, receipts,
multi-upstream failover, and confidential routing with its fail-closed guard all
apply identically. There is no second code path that could drift out of sync.