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.
modelstringRequired
max_tokensdoubleRequired
messageslist of objectsRequired
systemstring or list of objectsOptional
metadataobjectOptional
stop_sequenceslist of stringsOptional
streambooleanOptional
temperaturedoubleOptional
top_pdoubleOptional
top_kdoubleOptional
toolslist of objectsOptional
tool_choiceobjectOptional
thinkingobjectOptional
service_tierenumOptional
Allowed values:
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<=128 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 128 characters.

session_idstringOptional<=128 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 128 characters.

modelslist of stringsOptional

Response

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

Errors