Skip to navigation

Create a message

Anthropic Messages-compatible endpoint for any Anthropic SDK client. Models that list POST /v1/messages in supported_endpoints accept the Messages request shape, and tool_use / tool_result blocks round-trip. Count the input tokens of a request first with POST /v1/messages/count_tokens.

max_tokens is optional; without it the model’s default output limit applies. thinking turns reasoning on (enabled with budget_tokens, or adaptive) or off, output_config.effort sets the reasoning effort, and output_config.format takes a JSON schema for the output. A web_search tool turns on web search on models that offer it; any other server tool, such as web fetch, code execution, or an MCP toolset, returns 400 naming the tool. A content block the model cannot take returns 400 naming its position, for example messages.0.content.2.

With stream: true the response is Anthropic’s event stream, from message_start to message_stop. A stream that fails after it starts ends with one error event in the Anthropic error shape, and no event follows it.

Errors use the Anthropic error shape, {"type": "error", "error": {"type": "...", "message": "..."}}. Every response carries the request ID in the request-id and x-request-id headers.

Authentication

AuthorizationBearer

Pass your EmpirioLabs API key as a bearer token. The Anthropic-style x-api-key header is also accepted on every endpoint.

Request

This endpoint expects an object.
modelstringRequired
messageslist of objectsRequired

The conversation. Content blocks of type text, image (base64 or url source), document (text, content, base64 or url source), tool_use, tool_result, and thinking are accepted where Anthropic accepts them.

max_tokensintegerOptional

The most tokens the model may generate, thinking included. Optional; without it the model’s default output limit applies.

streambooleanOptionalDefaults to false

Stream the message as Anthropic server-sent events.

systemstring or list of objectsOptional
stop_sequenceslist of stringsOptional

Text that ends generation. A matched sequence is reported as stop_reason stop_sequence.

temperaturedoubleOptional
top_pdoubleOptional
top_kintegerOptional
toolslist of objectsOptional

Tools the model may call: client tools with name, description and input_schema, Anthropic’s client tool types such as bash_20250124, and web_search, which turns on web search on models that offer it. Any other server tool returns 400.

tool_choiceobjectOptional

{"type": "auto"}, {"type": "any"}, {"type": "none"}, or {"type": "tool", "name": "..."}. Set disable_parallel_tool_use to true for at most one tool call.

thinkingobjectOptional

Anthropic-style thinking control. enabled turns reasoning on and budget_tokens maps to thinking_budget for supported models; adaptive turns it on without a budget; disabled turns it off.

output_configobjectOptional
Output settings.
enable_thinkingbooleanOptional
Enable model reasoning on models that advertise this parameter.
thinking_budgetintegerOptional>=1
Maximum tokens reserved for model reasoning on models that advertise this parameter.

Response

The message, or an event stream when stream is true.

idstringOptional

Message ID, msg_ followed by 24 hex characters.

typeenumOptional
Allowed values:
roleenumOptional
Allowed values:
modelstringOptional
The model ID the request named.
contentlist of objectsOptional

Content blocks: thinking (with a signature to send back unchanged in later turns), text, and tool_use.

stop_reasonenumOptional
Allowed values:
stop_sequencestring or nullOptional

The stop sequence that ended generation, when stop_reason is stop_sequence.

usageobjectOptional

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error