---
title: "Create an Anthropic message"
method: POST
path: "/messages"
tags: ["Messages API"]
---

# Create an Anthropic message

`POST /messages`

Anthropic-compatible Messages endpoint supporting system prompts, tool calling, and streaming (SSE).

## Headers

- `anthropic-idempotency-key` string

## Request body

- CreateMessageRequest
  - `model` string, required
  - `max_tokens` integer, required
  - `messages` AnthropicMessageParam[], required
    - `role` 'user' | 'assistant' | 'system' | 'developer', required — user/assistant per Anthropic; system and developer are also accepted (Claude Code injects mid-conversation system/developer messages).
    - `content` union, required
      - string
      - union[]
        - union
          - AnthropicTextBlock
            - `type` 'text', required
            - `text` string, required
            - `cache_control` AnthropicCacheControl — Prompt-cache hint (e.g. { "type": "ephemeral" }). Accepted on content blocks for Anthropic SDK compatibility but ignored — no cache read/write; see the Prompt caching note.
              - …
          - AnthropicImageBlock — Image content block. Image input is supported only on multimodal models; see the Models page.
            - `type` 'image', required
            - `source` union, required
              - …
            - `cache_control` AnthropicCacheControl — Prompt-cache hint (e.g. { "type": "ephemeral" }). Accepted on content blocks for Anthropic SDK compatibility but ignored — no cache read/write; see the Prompt caching note.
              - …
          - AnthropicToolUseBlock — Tool call emitted by the model. Return its outcome as a tool_result block in a follow-up user message.
            - `type` 'tool_use', required
            - `id` string, required
            - `name` string, required
            - `input` object, required
            - `cache_control` AnthropicCacheControl — Prompt-cache hint (e.g. { "type": "ephemeral" }). Accepted on content blocks for Anthropic SDK compatibility but ignored — no cache read/write; see the Prompt caching note.
              - …
          - AnthropicToolResultBlock — Result of a tool call, sent back in a user message.
            - `type` 'tool_result', required
            - `tool_use_id` string, required
            - `content` union, required
              - …
            - `is_error` boolean
            - `cache_control` AnthropicCacheControl — Prompt-cache hint (e.g. { "type": "ephemeral" }). Accepted on content blocks for Anthropic SDK compatibility but ignored — no cache read/write; see the Prompt caching note.
              - …
          - AnthropicThinkingBlock — Extended-thinking reasoning block. When continuing a thinking conversation, replay it unchanged (including its signature).
            - `type` 'thinking', required
            - `thinking` string, required
            - `signature` string — Opaque signature returned with the block; replay unchanged.
            - `cache_control` AnthropicCacheControl — Prompt-cache hint (e.g. { "type": "ephemeral" }). Accepted on content blocks for Anthropic SDK compatibility but ignored — no cache read/write; see the Prompt caching note.
              - …
          - AnthropicRedactedThinkingBlock — Redacted extended-thinking block. Accepted when replayed; the opaque encrypted reasoning is not used.
            - `type` 'redacted_thinking', required
            - `data` string, required — Opaque, encrypted reasoning payload.
            - `cache_control` AnthropicCacheControl — Prompt-cache hint (e.g. { "type": "ephemeral" }). Accepted on content blocks for Anthropic SDK compatibility but ignored — no cache read/write; see the Prompt caching note.
              - …
  - `system` union — System prompt: a string, or an array of text blocks.
    - string
    - AnthropicTextBlock[]
      - `type` 'text', required
      - `text` string, required
      - `cache_control` AnthropicCacheControl — Prompt-cache hint (e.g. { "type": "ephemeral" }). Accepted on content blocks for Anthropic SDK compatibility but ignored — no cache read/write; see the Prompt caching note.
        - `type` 'ephemeral'
  - `temperature` number
  - `top_p` number
  - `output_config` AnthropicOutputConfig
    - `format` AnthropicOutputConfigFormat
      - `type` 'json_schema', required
      - `schema` object, required
      - `name` string
      - `strict` boolean
    - `effort` 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max' — Reasoning effort for the model (`max` is treated as `xhigh`). Overrides any effort derived from `thinking`.
  - `tools` object[] — Tool definitions the model may call. Responses include `tool_use` blocks; return outcomes as `tool_result` content blocks in a follow-up message.
  - `tool_choice` object — Controls tool use: `auto`, `any`, `tool`, or `none`.
  - `thinking` object — Extended thinking configuration; translated to the model's reasoning.
  - `stream` boolean — When `true`, the response streams as Anthropic Server-Sent Events (`message_start`, `content_block_delta`, `message_stop`, …).
  - `metadata` RequestMetadata — Optional string metadata. completion_window controls scheduling; completion_webhook/webhook_token configure completion webhooks.
    - `completion_window` 'asap' | 'priority' | 'standard' | 'flex' — [Completion window](/completion-windows) (i.e. latency tier) for the request. Support matrix is available on the [Pricing](/pricing) page. When omitted, defaults to `standard` if that window is supported for the model; otherwise `flex` for async requests when the model supports it, and `asap` in all other cases. See [default behavior](/completion-windows#default-behavior).
    - `completion_webhook` string, uri
    - `webhook_token` string
  - `context_management` object — Anthropic server-side context-editing config (Claude Code sends it automatically). Accepted for compatibility but ignored — Sail forwards the full context each turn.

## Response `200`

Anthropic-compatible message response. Returns a single JSON object by default, or an Anthropic Server-Sent Events stream when stream: true.

- AnthropicMessageResponse
  - `id` string, required
  - `type` 'message', required
  - `role` 'assistant', required
  - `content` union[], required
    - union
      - AnthropicTextBlock
        - `type` 'text', required
        - `text` string, required
        - `cache_control` AnthropicCacheControl — Prompt-cache hint (e.g. { "type": "ephemeral" }). Accepted on content blocks for Anthropic SDK compatibility but ignored — no cache read/write; see the Prompt caching note.
          - `type` 'ephemeral'
      - AnthropicToolUseBlock — Tool call emitted by the model. Return its outcome as a tool_result block in a follow-up user message.
        - `type` 'tool_use', required
        - `id` string, required
        - `name` string, required
        - `input` object, required
        - `cache_control` AnthropicCacheControl — Prompt-cache hint (e.g. { "type": "ephemeral" }). Accepted on content blocks for Anthropic SDK compatibility but ignored — no cache read/write; see the Prompt caching note.
          - `type` 'ephemeral'
      - AnthropicThinkingBlock — Extended-thinking reasoning block. When continuing a thinking conversation, replay it unchanged (including its signature).
        - `type` 'thinking', required
        - `thinking` string, required
        - `signature` string — Opaque signature returned with the block; replay unchanged.
        - `cache_control` AnthropicCacheControl — Prompt-cache hint (e.g. { "type": "ephemeral" }). Accepted on content blocks for Anthropic SDK compatibility but ignored — no cache read/write; see the Prompt caching note.
          - `type` 'ephemeral'
  - `model` string, required
  - `stop_reason` 'end_turn' | 'max_tokens' | 'tool_use' | 'stop_sequence' | 'refusal', required
  - `stop_sequence` string, nullable, required
  - `usage` AnthropicUsage, required
    - `input_tokens` integer, required
    - `output_tokens` integer, required

## Other responses

- `400` — Invalid request or unsupported feature.
- `401` — Authentication error.
- `408` — Timed out waiting for completion.
- `500` — Server error.

---

[API](https://skmtc.dev/sailresearch/apis/sail-api.md) · [All operations](https://skmtc.dev/sailresearch/apis/sail-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/sailresearch/sail-api/revisions/c2a783d507f9/schema)
