---
title: "Create a message"
method: POST
path: "/v1/messages"
tags: ["Messages"]
---

# Create a message

`POST /v1/messages`

Generate an Anthropic-compatible message response from Messages API input. Supports streaming, tool use, and multimodal content blocks.

## Request body

- MessagesRequest — Stateless Messages API endpoint (Anthropic Messages API compatibility). Request surface is intentionally limited to what maps into our internal `/v1/chat/completions` pipeline.
  - `model` string, required — Model identifier to route the request to.
  - `max_tokens` integer, required — Maximum number of output tokens to generate.
  - `messages` MessageParam[], required — Conversation history in Anthropic Messages format.
    - `role` 'user' | 'assistant', required
    - `content` union, required
      - string
      - union[]
        - union
          - TextBlockParam
            - `type` 'text', required
            - `text` string, required — Plain text content block.
          - ImageBlockParam
            - `type` 'image', required
            - `source` union, required
              - …
          - DocumentBlockParam
            - `type` 'document', required
            - `source` union, required
              - …
            - `title` string, nullable
          - SearchResultBlockParam
            - `type` 'search_result', required
            - `title` string, nullable
            - `source` string, nullable
            - `content` TextBlockParam[]
              - …
          - ThinkingBlockParam
            - `type` 'thinking', required
            - `thinking` string, required
            - `signature` string, nullable
          - RedactedThinkingBlockParam
            - `type` 'redacted_thinking', required
            - `data` string, required
          - ToolUseBlockParam
            - `type` 'tool_use', required
            - `id` string, required
            - `name` string, required
            - `input` object
          - ToolResultBlockParam
            - `type` 'tool_result', required
            - `tool_use_id` string, required
            - `content` union
              - …
  - `system` union
    - string
    - TextBlockParam[]
      - `type` 'text', required
      - `text` string, required — Plain text content block.
  - `stream` boolean — Return Anthropic-style SSE events instead of a single JSON response.
  - `temperature` number, nullable
  - `top_p` number, nullable
  - `stop_sequences` string[], nullable
  - `tools` union[], nullable
    - union
      - ToolParam
        - `name` string, required — Tool name exposed to the model.
        - `description` string, nullable
        - `input_schema` object, required
      - WebSearchToolParam
        - `type` 'web_search_20250305', required
        - `name` 'web_search', required
  - `tool_choice` union
    - ToolChoiceAutoParam
      - `type` 'auto', required
      - `disable_parallel_tool_use` boolean, nullable
    - ToolChoiceAnyParam
      - `type` 'any', required
      - `disable_parallel_tool_use` boolean, nullable
    - ToolChoiceToolParam
      - `type` 'tool', required
      - `name` string, required
      - `disable_parallel_tool_use` boolean, nullable
    - ToolChoiceNoneParam
      - `type` 'none', required
  - `thinking` union
    - ThinkingConfigEnabledParam
      - `type` 'enabled', required
      - `budget_tokens` integer, nullable
    - ThinkingConfigDisabledParam
      - `type` 'disabled', required
    - ThinkingConfigAdaptiveParam
      - `type` 'adaptive', required
  - `output_config` OutputConfigParam
    - `effort` 'low' | 'medium' | 'high' | 'max', nullable

## Response `200`

JSON response when stream=false, or Anthropic-style Server-Sent Events when stream=true.

- AnthropicMessageResponse
  - `id` string, required
  - `type` 'message'
  - `role` 'assistant'
  - `model` string, required
  - `content` union[], required
    - union
      - AnthropicTextBlockResponse
        - `type` 'text', required
        - `text` string, required
      - AnthropicThinkingBlockResponse
        - `type` 'thinking', required
        - `thinking` string, required
        - `signature` string, nullable
      - AnthropicImageBlockResponse
        - `type` 'image', required
        - `source` AnthropicImageSourceResponse, required
          - `type` 'url', required
          - `url` string, required
      - AnthropicSearchResultBlockResponse
        - `type` 'search_result', required
        - `title` string, nullable
        - `source` string, nullable
        - `content` AnthropicTextBlockResponse[]
          - `type` 'text', required
          - `text` string, required
      - AnthropicToolUseBlockResponse
        - `type` 'tool_use', required
        - `id` string, nullable
        - `name` string, nullable
        - `input` union
          - object
          - string
  - `stop_reason` string, nullable
  - `stop_sequence` string, nullable
  - `usage` AnthropicUsageResponse
    - `input_tokens` integer, required
    - `output_tokens` integer, required
    - `cache_read_input_tokens` integer, nullable
  - `created` integer, required

## Other responses

- `400` — Bad request
- `401` — Unauthorized
- `402` — Insufficient credits
- `403` — Forbidden
- `410` — Model deprecated
- `422` — Validation error
- `429` — Rate limited
- `500` — Internal server error
- `503` — Upstream service error

---

[API](https://skmtc.net/naga/apis/nagaai-api.md) · [All operations](https://skmtc.net/naga/apis/nagaai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/naga/nagaai-api/revisions/8bfb4677a79e/schema)
