Creates a message using the Anthropic Messages API format. Supports text, images, PDFs, tools, and extended thinking.
Authentication
AuthorizationBearer
API key as bearer token in Authorization header
Request
This endpoint expects an object.
modelstringRequired
messageslist of objects or nullRequired
max_tokensintegerOptional
systemstring or list of objectsOptional
metadataobjectOptional
stop_sequenceslist of stringsOptional
temperaturedoubleOptional
top_pdoubleOptional
top_kdoubleOptional
toolslist of objectsOptional
tool_choiceobjectOptional
thinkingobjectOptional
service_tierenumOptional
Allowed values:
output_configobjectOptional
Configuration for controlling output behavior. Supports the effort parameter and structured output format.
cache_controlobjectOptional
streambooleanOptional
context_managementobject or nullOptional
providerobject or nullOptional
When multiple model providers are available, optionally indicate your routing preference.
pluginslist of objectsOptional
Plugins you want to enable for this request, including their settings.
userstringOptional<=256 characters
A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 256 characters.
session_idstringOptional<=256 characters
A unique identifier for grouping related requests (e.g., a conversation or agent workflow) for observability. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.
traceobjectOptional
Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.
modelslist of stringsOptional
speedenumOptional
Controls output generation speed. When set to fast, uses a higher-speed inference configuration at premium pricing. Defaults to standard when omitted.