---
title: "Create Anthropic Message (v1)"
method: POST
path: "/v1/messages"
tags: ["Anthropic Messages"]
---

# Create Anthropic Message (v1)

`POST /v1/messages`

Send a message to the Anthropic models. Supports streaming and non-streaming responses.

## Headers

- `x-api-key` string

## Request body

- MessagesRequest
  - `model` string, required
  - `max_tokens` integer, required
  - `messages` MessageInput[], required
    - `role` 'user' | 'assistant', required
    - `content` union, required
      - string
      - union[]
        - union
          - TextBlock
            - `type` 'text'
            - `text` string, required
            - `cache_control` object, nullable
          - ImageBlock
            - `type` 'image'
            - `source` ImageSource, required
              - …
          - DocumentBlock
            - `type` 'document'
            - `source` DocumentSource, required
              - …
          - ToolUseBlock
            - `type` 'tool_use'
            - `id` string, required
            - `name` string, required
            - `input` object, required
          - ToolResultBlock
            - `type` 'tool_result'
            - `tool_use_id` string, required
            - `content` union, required
              - …
            - `is_error` boolean, nullable
  - `system` union
    - string
    - union[]
      - union
        - TextBlock
          - `type` 'text'
          - `text` string, required
          - `cache_control` object, nullable
        - ImageBlock
          - `type` 'image'
          - `source` ImageSource, required
            - `type` 'base64' | 'url', required
            - `media_type` 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp', required
            - `data` string, nullable
            - `url` string, nullable
        - DocumentBlock
          - `type` 'document'
          - `source` DocumentSource, required
            - `type` 'base64' | 'url', required
            - `media_type` 'application/pdf', required
            - `data` string, nullable
            - `url` string, nullable
        - ToolUseBlock
          - `type` 'tool_use'
          - `id` string, required
          - `name` string, required
          - `input` object, required
        - ToolResultBlock
          - `type` 'tool_result'
          - `tool_use_id` string, required
          - `content` union, required
            - string
            - object[]
              - …
          - `is_error` boolean, nullable
  - `stream` boolean, nullable
  - `temperature` number, nullable
  - `top_p` number, nullable
  - `top_k` integer, nullable
  - `stop_sequences` string[], nullable
  - `tools` ToolDefinition[], nullable
    - `name` string, required
    - `description` string, required
    - `input_schema` ToolInputSchema, required
      - `type` 'object'
      - `properties` object, required
      - `required` string[]
    - `input_examples` object[], nullable
    - `cache_control` object, nullable
    - `strict` boolean, nullable
    - `defer_loading` boolean, nullable
    - `allowed_callers` string[], nullable
  - `tool_choice` union
    - ToolChoiceAuto
      - `type` 'auto'
    - ToolChoiceNone
      - `type` 'none'
    - ToolChoiceAny
      - `type` 'any'
    - ToolChoiceSpecific
      - `type` 'tool'
      - `name` string, required
  - `disable_parallel_tool_use` boolean, nullable
  - `thinking` union
    - ThinkingConfigEnabled
      - `type` 'enabled'
      - `budget_tokens` integer, required
    - ThinkingConfigDisabled
      - `type` 'disabled'
    - ThinkingConfigAdaptive
      - `type` 'adaptive'
      - `budget_tokens` integer, nullable
  - `metadata` object, nullable

## Response `200`

Successful Response

- MessagesResponse
  - `id` string, required
  - `type` 'message'
  - `role` 'assistant'
  - `model` string, required
  - `content` union[], required
    - union
      - TextBlock
        - `type` 'text'
        - `text` string, required
        - `cache_control` object, nullable
      - ImageBlock
        - `type` 'image'
        - `source` ImageSource, required
          - `type` 'base64' | 'url', required
          - `media_type` 'image/jpeg' | 'image/png' | 'image/gif' | 'image/webp', required
          - `data` string, nullable
          - `url` string, nullable
      - DocumentBlock
        - `type` 'document'
        - `source` DocumentSource, required
          - `type` 'base64' | 'url', required
          - `media_type` 'application/pdf', required
          - `data` string, nullable
          - `url` string, nullable
      - ToolUseBlock
        - `type` 'tool_use'
        - `id` string, required
        - `name` string, required
        - `input` object, required
      - ToolResultBlock
        - `type` 'tool_result'
        - `tool_use_id` string, required
        - `content` union, required
          - string
          - object[]
        - `is_error` boolean, nullable
  - `stop_reason` 'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' | 'content_filter', required
  - `stop_sequence` string, nullable
  - `usage` SchemasAnthropicUsage, required
    - `input_tokens` integer, required
    - `output_tokens` integer, required
    - `cache_creation_input_tokens` integer
    - `cache_read_input_tokens` integer
    - `cache_creation` CacheCreation
      - `ephemeral_5m_input_tokens` integer
      - `ephemeral_1h_input_tokens` integer
    - `service_tier` 'standard' | 'priority', nullable

## Other responses

- `400` — Bad Request - Invalid query parameters or body format.
- `401` — Unauthorized - Missing or invalid API key.
- `403` — Forbidden - Key does not have permission or is disabled.
- `422` — Unprocessable Entity - Request body validation failed.
- `429` — Too Many Requests - Rate limit exceeded.
- `500` — Internal Server Error - Internal error occurred.
- `502` — Bad Gateway - Provider error occurred.

---

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