Messages (Anthropic schema)
POST https://<platform-address>/v1/messages. The /v1/messages path is
always parsed with the Anthropic schema -- the path selects the schema, no
header changes it (see API Overview).
Differences from stock Anthropic
| Aspect | Stock Anthropic | This gateway |
|---|---|---|
| Auth header | x-api-key: ... | x-api-key: onprem-gw-your-key or Authorization: Bearer onprem-gw-your-key; both are accepted |
anthropic-version | Required | Optional. If present and not 2023-06-01, the gateway logs a server-side warning and processes the request anyway -- it never rejects on version |
| Model ids | claude-* | The platform's deployed model ids (see the APIs page) |
Request headers
Content-Type: application/json
Authorization: Bearer onprem-gw-your-key
anthropic-version: 2023-06-01
Request body
{
"model": "my-model-id",
"max_tokens": 1024,
"system": "You are a helpful assistant.",
"messages": [
{ "role": "user", "content": "Hello!" }
],
"stream": false,
"temperature": 0.7
}
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | yes | Deployed model id (or a configured alias) |
messages | array | yes | User/assistant turns |
max_tokens | integer | yes | Required by the Anthropic schema (unlike OpenAI) |
system | string | no | Top-level field, NOT a role: "system" message |
stream | boolean | no (false) | Enable SSE streaming |
temperature, top_p, top_k, stop_sequences | -- | no | Sampling controls |
tools, tool_choice, thinking, metadata | -- | no | Accepted by the gateway's request schema; support depends on the serving engine |
Non-streaming response
{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"content": [
{ "type": "text", "text": "Hello! How can I help?" }
],
"model": "my-model-id",
"stop_reason": "end_turn",
"usage": { "input_tokens": 10, "output_tokens": 25 }
}
content is an array of blocks, not a single string. When the gateway
translates from an OpenAI-speaking engine, stop_reason is mapped from the
engine's finish_reason: stop -> end_turn, length -> max_tokens,
tool_calls -> tool_use.
Streaming (SSE)
With "stream": true, events follow the Anthropic event vocabulary, each
with an SSE event: name and JSON data::
message_start-- message metadatacontent_block_start-- a content block beginscontent_block_delta-- incremental text:{"delta": {"type": "text_delta", "text": "chunk"}}content_block_stop-- block completemessage_delta--stop_reasonplus output token usagemessage_stop-- stream complete
event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello"}}
event: message_delta
data: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":25}}
event: message_stop
data: {"type":"message_stop"}
Mid-stream failures are emitted as an event: error with the gateway's
error envelope as data. Errors before the first token (including overload
rejections) are plain HTTP error responses -- see API Overview for the
envelope and the 503 Overloaded codes.