Contact
Skip to the page text

Documentation / Guides / Inference API

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

AspectStock AnthropicThis gateway
Auth headerx-api-key: ...x-api-key: onprem-gw-your-key or Authorization: Bearer onprem-gw-your-key; both are accepted
anthropic-versionRequiredOptional. 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 idsclaude-*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
}
ParameterTypeRequiredDescription
modelstringyesDeployed model id (or a configured alias)
messagesarrayyesUser/assistant turns
max_tokensintegeryesRequired by the Anthropic schema (unlike OpenAI)
systemstringnoTop-level field, NOT a role: "system" message
streambooleanno (false)Enable SSE streaming
temperature, top_p, top_k, stop_sequences--noSampling controls
tools, tool_choice, thinking, metadata--noAccepted 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::

  1. message_start -- message metadata
  2. content_block_start -- a content block begins
  3. content_block_delta -- incremental text: {"delta": {"type": "text_delta", "text": "chunk"}}
  4. content_block_stop -- block complete
  5. message_delta -- stop_reason plus output token usage
  6. message_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.

Found a mistake, or is something missing? Suggest an improvement to this page on GitHub.

Platform release 5.10.4, . Source of this page at v5.10.4. This page as Markdown.