POST
/
messages
curl --request POST \
  --url https://api.anthropic.com/v1/messages \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "model": "<string>",
  "messages": "[{\"role\": \"user\", \"content\": \"Hello, Claude\"}]",
  "system": "<string>",
  "max_tokens": 123,
  "metadata": {},
  "stop_sequences": [
    "<string>"
  ],
  "stream": true,
  "temperature": 123,
  "top_p": 123,
  "top_k": 123
}'
{
  "id": "<string>",
  "type": "message",
  "role": "assistant",
  "content": "[{\"type\": \"text\", \"text\": \"Hi, I'm Claude.\"}]",
  "model": "<string>",
  "stop_reason": "end_turn",
  "stop_sequence": "<string>",
  "usage": {
    "input_tokens": 123,
    "output_tokens": 123
  }
}

Authorizations

x-api-key
string
header
required

API key to authorize requests.

Body

application/json

Model settings and a structured list of input messages with text and/or image content.

The body is of type object.

Response

200
application/json

Message object.

The response is of type object.