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

# Create a message (Anthropic Messages API)

`POST /v1/messages`

## Request body

- AnthropicapiMessagesRequest
  - `cache_control` object
  - `max_tokens` integer
  - `messages` AnthropicapiMessage[]
    - `content` union
      - string
      - AnthropicapiContentBlock[]
        - `content` union
          - string
          - AnthropicapiContentBlock[]
        - `id` string
        - `input` object
        - `is_error` boolean
        - `name` string
        - `source` union
          - string
          - object
        - `text` string
        - `thinking` string
        - `tool_use_id` string
        - `type` string
    - `role` string
  - `metadata` AnthropicapiMetadata
    - `user_id` string
  - `model` string
  - `stop_sequences` string[]
  - `stream` boolean
  - `system` union
    - string
    - AnthropicapiContentBlock[]
      - `content` union
        - string
        - AnthropicapiContentBlock[]
      - `id` string
      - `input` object
      - `is_error` boolean
      - `name` string
      - `source` union
        - string
        - object
      - `text` string
      - `thinking` string
      - `tool_use_id` string
      - `type` string
  - `temperature` number
  - `thinking` AnthropicapiThinking
    - `budget_tokens` integer
    - `type` string
  - `tool_choice` AnthropicapiToolChoice
    - `disable_parallel_tool_use` boolean
    - `name` string
    - `type` string
  - `tools` AnthropicapiTool[]
    - `cache_control` object
    - `description` string
    - `input_schema` object
    - `name` string
    - `type` string
  - `top_k` integer
  - `top_p` number

## Response `200`

JSON response or SSE stream when stream=true

- AnthropicapiMessagesResponse
  - `content` AnthropicapiResponseContentBlock[]
    - `id` string
    - `input` object
    - `name` string
    - `text` string
    - `thinking` string
    - `type` string
  - `id` string
  - `model` string
  - `role` string
  - `stop_reason` string
  - `stop_sequence` string
  - `type` string
  - `usage` AnthropicapiUsage
    - `cache_creation_input_tokens` integer
    - `cache_read_input_tokens` integer
    - `input_tokens` integer
    - `output_tokens` integer

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `429` — Too Many Requests
- `502` — Bad Gateway

## Changes

- **2026-08-22** `496ff50bdfef` — 9 info
  - added the optional property `anyOf[#/components/schemas/anthropicapi.SSEErrorEvent]/error/provider` to the response with the `200` status
  - added the optional property `error/provider` to the response with the `400` status (media type: application/json)
  - added the optional property `error/provider` to the response with the `400` status (media type: text/event-stream)
  - added the optional property `error/provider` to the response with the `401` status (media type: application/json)
  - …5 more
- **2026-08-14** `e31b805bf9ac` — 2 info
  - added the new optional request property `cache_control`
  - added the new optional request property `tools/items/cache_control`
- **2026-05-22** `4473702da82e` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/enterpilot/apis/gomodel-api/changes/v1/messages/post.md)

---

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