Create a message

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.
messageslist of objects or nullRequired
modelstringRequired
cache_controlobjectOptional
context_managementobject or nullOptional
max_tokensintegerOptional
metadataobjectOptional
modelslist of stringsOptional
output_configobjectOptional
Configuration for controlling output behavior. Supports the effort parameter and structured output format.
pluginslist of objectsOptional
Plugins you want to enable for this request, including their settings.
providerobjectOptional
When multiple model providers are available, optionally indicate your routing preference.
routeanyOptional
service_tierenumOptional
Allowed values:
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.

speedobjectOptional
stop_sequenceslist of stringsOptional
streambooleanOptional
systemstring or list of objectsOptional
temperaturedoubleOptional
thinkingobjectOptional
tool_choiceobjectOptional
toolslist of objectsOptional
top_kintegerOptional
top_pdoubleOptional
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.

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.

Response

Successful response
containerobject
contentlist of objects
idstring
modelstring
roleenum
Allowed values:
stop_reasonenum
stop_sequencestring or null
typeenum
Allowed values:
providerenum
usageobject

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error