Messages (Anthropic)
Creates a message in a conversation. Compatible with Anthropic's messages.create endpoint — supports system, tools, tool_use, thinking, and stream.
POST /anthropic/v1/messages
The full Anthropic Messages surface — including thinking for extended reasoning.
Request body parameters
model string Required The model ID (e.g. claude-3-5-sonnet-20241022).messages array Required [{ role: "user"|"assistant", content: ... }]max_tokens int Required Maximum tokens to generate. Must be > 0.system string Optional System prompt — top-level field, not a message.temperature float Optional Sampling temperature 0–1. Default: 1.stream bool Optional Whether to stream partial tokens via SSE. Default: false.tools array Optional Tools the model may call: {name, description, input_schema}.thinking object Optional {"type":"enabled","budget_tokens":N} for extended thinking.Python
message = client.messages.create( model="claude-3-5-sonnet-20241022", max_tokens=1024, system="You are a helpful assistant.", messages=[ {"role": "user", "content": "What is 2+2?"}, ],) print(message.content[0].text)