v1

latestOpenAPI 3.1.02026-07-2616299271.2 KB
Anthropic Compatible

Create a Message

Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.

The Messages API can be used for either single queries or stateless multi-turn conversations.

Learn more about the Messages API in our user guide

post/v1/messages

Headers

anthropic-versionstring

The version of the Claude API you want to use.

Read more about versioning and our version history here.

The version of the Claude API you want to use.

Read more about versioning and our version history here.

Request body

{"stackTrail":"components:schemas:AnthropicModel","oasType":"schema","type":"unknown","description":"Referenced by this API but not published in the vendor's docs pages."}
{"stackTrail":"components:schemas:AnthropicCreateMessageParams:properties:messages","oasType":"schema","type":"unknown","description":"Input messages.\n\nOur models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn.\n\nEach input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages.\n\nIf the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response.\n\nExample with a single `user` message:"}

Example request

{
  "max_tokens": 1024,
  "messages": [
    {
      "content": "Hello, world",
      "role": "user"
    }
  ],
  "model": "claude-opus-4-6"
}

Response

Message object.

{"stackTrail":"components:schemas:AnthropicMessage","oasType":"schema","type":"unknown","description":"Referenced by this API but not published in the vendor's docs pages."}
All 16 operations