---
title: "POST /v1/messages"
method: POST
path: "/v1/messages"
tags: ["inference"]
---

# POST /v1/messages

`POST /v1/messages`

## Request

- The document declares no server URL.
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Anthropic Messages API. The request is translated into a /v1/chat/completions request, served by the chat route with all of its limits, and the answer is translated back. Buffered and streaming answers are supported. POST /v1/messages/count_tokens is not served.

## Headers

- `anthropic-version` string, nullable
- `anthropic-beta` string, nullable
- `X-SIE-MACHINE-PROFILE` string, nullable
- `X-SIE-Pool` string, nullable
- `X-SIE-Remote` 'forbid'

## Request body

- MessagesRequest: Anthropic Messages request, as accepted by ``POST /v1/messages``. The request is translated into a ``/v1/chat/completions`` request and served by the chat route, so every chat limit applies. Fields outside this set fail with ``400 invalid_request_error`` and the message ``<field>: Extra inputs are not permitted``. ``metadata`` and every ``cache_control`` are accepted and have no effect: prefix caching is automatic and ``metadata`` is neither logged nor forwarded.
  - `cache_control` unknown
  - `max_tokens` integer, required: Output token limit, at least 1 and at most the serving profile's ``max_output_tokens``.
  - `messages` unknown, required
  - `metadata` unknown
  - `model` string, required: The model id, used as on ``/v1/chat/completions`` (``model`` or ``model:profile``, or an operator alias).
  - `output_config` EmptyOutputConfig: An ``output_config`` with no fields, the only one accepted.
  - `stop_sequences` string[], nullable
  - `stream` boolean, nullable: Server-sent events: ``message_start``, content block events, ``message_delta`` with the final usage, ``message_stop``, and ``ping`` whenever no other event was sent for 10 seconds. A failure after the stream opened is an ``error`` event, and the stream then ends without ``message_stop``.
  - `system` unknown
  - `temperature` number, double, nullable: In ``[0, 1]``.
  - `thinking` unknown
  - `tool_choice` unknown
  - `tools` unknown
  - `top_k` integer, nullable: At least 1.
  - `top_p` number, double, nullable: In ``(0, 1]``.

## Response `200`

Message, or a text/event-stream of Messages events when stream is true

- MessagesResponse: Anthropic Message answered by ``POST /v1/messages`` without ``stream``.
  - `content` unknown, required
  - `id` string, required: ``msg_`` followed by the gateway request id.
  - `model` string, required
  - `role` string, required: Always ``assistant``.
  - `stop_reason` string, required: ``end_turn``, ``tool_use``, ``max_tokens`` or ``refusal``.
  - `stop_sequence` string, nullable: Always ``null``.
  - `type` string, required: Always ``message``.
  - `usage` MessagesUsage, required: Token usage of a Message. ``input_tokens`` plus ``cache_read_input_tokens`` equals the prompt tokens the chat route reports; ``cache_creation_input_tokens`` is always 0.
    - `cache_creation_input_tokens` integer, required
    - `cache_read_input_tokens` integer, required
    - `input_tokens` integer, required
    - `output_tokens` integer, required: Includes reasoning tokens.

## Other responses

- `400`: Invalid or unsupported request
- `401`: Missing or invalid bearer token
- `404`: Model not found
- `413`: Request body is too large
- `429`: Rate limited; retry after Retry-After
- `500`: Worker emitted a malformed response; gateway auth enabled but no tokens configured
- `502`: The model failed to load
- `503`: Capacity is not ready; retry after Retry-After
- `504`: Generation timed out

## Changes

- **2026-10-15** `82e5cc465fe9`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/superlinked/apis/sie-gateway/changes/v1/messages/post.md)

---

[API](https://skmtc.dev/superlinked/apis/sie-gateway.md) - [All operations](https://skmtc.dev/superlinked/apis/sie-gateway/llms.txt) - [OpenAPI document](https://skmtc.dev/superlinked/apis/sie-gateway/revisions/796338a4d23c?raw)
