---
title: "Create a new message conversation with Claude"
method: POST
path: "/v1/messages"
---

# Create a new message conversation with Claude

`POST /v1/messages`

Sends a message or a series of messages to Claude and retrieves a response, optionally including thinking traces.

## Request body

- MessageRequest
  - `model` string, required — The Claude model to use (e.g., claude-3-5-sonnet-20241022).
  - `messages` Message[], required — List of messages in the conversation, starting with a user message.
    - `role` 'user' | 'assistant', required — The role of the message sender.
    - `content` string, required — The content of the message.
  - `max_tokens` integer, required — Maximum number of tokens to generate in the response.
  - `temperature` number — Controls randomness of the response (0 to 1). Lower for analytical, higher for creative tasks.
  - `system` string — Optional system prompt to set context or instructions for Claude.
  - `top_p` number — Nucleus sampling parameter (0 to 1).
  - `top_k` integer — Only sample from the top K options for each token.
  - `thinking` object — Whether to include the thinking trace in the response (if supported by the model).
    - `type` 'enabled' | 'disabled'
    - `budget_tokens` integer — Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. Must be ≥1024 and less than max_tokens.

## Response `200`

Successful response with Claude's reply and optional thinking trace

- MessageResponse
  - `id` string — Unique identifier for the message response.
  - `type` string — Type of response, always "message" for this endpoint.
  - `role` string — Role of the responder, always "assistant".
  - `content` object[] — The generated content from Claude.
    - `type` string
    - `text` string

## Other responses

- `400` — Bad request - invalid parameters or malformed JSON
- `401` — Unauthorized - invalid or missing API key
- `429` — Too Many Requests - rate limit exceeded
- `500` — Internal Server Error

---

[API](https://skmtc.net/mmhk/apis/anthropic-claude-messages-api.md) · [All operations](https://skmtc.net/mmhk/apis/anthropic-claude-messages-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mmhk/anthropic-claude-messages-api/versions/c8f805608547/schema)
