Create a message
POST
/v1/messagesGenerate a message with the Anthropic Messages format. Authenticate with x-api-key or Authorization: Bearer. Only models whose catalog entry lists /v1/messages are supported here.
x-api-key<token>
Your API key, Anthropic style. Accepted by /v1/messages.
In: header
Header Parameters
anthropic-version?string
Anthropic API version. Sent by the Anthropic SDKs automatically.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
model*string
A model ID from List models.
max_tokens*integer
Range
1 <= valuemessages*array<>
system?string|array<>
stream?boolean
Default
falsetemperature?number
Range
0 <= value <= 1top_p?number
top_k?integer
stop_sequences?array<string>
tools?array<>
tool_choice?
thinking?
Extended thinking, on models that support it.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/messages" \ -H "Content-Type: application/json" \ -d '{ "model": "<model-id>", "max_tokens": 1024, "messages": [ { "role": "user", "content": "Hello!" } ] }'{ "id": "string", "type": "message", "role": "assistant", "model": "string", "content": [ {} ], "stop_reason": "string", "usage": { "input_tokens": 0, "output_tokens": 0 }}