API
Anthropic Messages
POST /v1/messages in Anthropic's format, for Claude and every other model, so the Anthropic SDK and Claude Code work with a DigitSpace key.
POST https://api.digitspace.ai/v1/messagesAnthropic's Messages format, for every model in the catalogue, not only Claude. Point the Anthropic SDK at https://api.digitspace.ai (without /v1); it adds the path itself.
Request
model, a non-empty messages array and max_tokens are required, as in Anthropic's API.
curl https://api.digitspace.ai/v1/messages \
-H "x-api-key: $DIGITSPACE_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"max_tokens": 1024,
"system": "Answer in one sentence.",
"messages": [{ "role": "user", "content": "What is an AI gateway?" }]
}'The key can go in x-api-key, as the Anthropic SDK sends it, or in Authorization: Bearer. The anthropic-version header is optional; the gateway sends 2023-06-01 to Anthropic when you leave it out. anthropic-beta is passed on only when the request runs on your own Anthropic key.
How the request reaches the provider
- Anthropic-format providers (Anthropic, Claude on Vertex, Claude on Azure) get the body as you sent it, with
modelreplaced. On DigitSpace credits, server tools such as Anthropic's web search and code execution are removed; your own custom tools are kept. - OpenAI-format providers get it translated:
systembecomes a system message,tool_useandtool_resultbecome tool calls and tool messages,stop_sequencesbecomesstop, andthinkingbecomesreasoning_effort(highabove a 16,000-token budget, otherwisemedium).metadata,top_k,cache_control, document blocks, earlier thinking blocks and images inside tool results are dropped.
Response
The response is in Anthropic's format whichever provider answered. Answers from OpenAI-format providers are converted: finish_reason becomes stop_reason (stop to end_turn, length to max_tokens, tool_calls to tool_use), and reasoning becomes a thinking block.
{
"id": "msg_…",
"type": "message",
"role": "assistant",
"model": "auto",
"content": [{ "type": "text", "text": "An AI gateway is …" }],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 18,
"output_tokens": 24,
"cache_read_input_tokens": 0
}
}Streaming sends Anthropic's events: message_start, content_block_start, content_block_delta, content_block_stop, message_delta and message_stop. When an OpenAI-format provider answers a streamed request, its reasoning isn't sent as thinking events.
Errors
Errors use Anthropic's shape, {"type": "error", "error": {"type", "message"}}, without the code field the OpenAI format has. Errors lists every one.
Checked against the gateway on 31 October 2026. Something wrong or missing? Tell us.