Create a message

Anthropic-compatible Messages endpoint. Accepts the Anthropic Messages request shape and routes to any catalogued model. Also served at `/v1/anthropic/v1/messages`; both paths accept the same requests. This bare path is what the Anthropic SDK builds from a bare-host base URL, so pointing the SDK at `https://api-gateway.merge.dev` works with no other changes.

Authentication

AuthorizationBearer
Your production key sent as a bearer token.

Request

This endpoint expects an object.
modelstringRequired
max_tokensintegerRequired
messageslist of objectsRequired
systemstring or list of objects or nullOptional
streambooleanOptionalDefaults to false
temperaturedouble or nullOptional
top_pdouble or nullOptional
top_kinteger or nullOptional
stop_sequenceslist of strings or nullOptional
toolslist of objects or nullOptional
tool_choicemap from strings to any or nullOptional
metadatamap from strings to any or nullOptional
service_tierstring or nullOptional
cache_controlmap from strings to any or nullOptional

Top-level prompt-caching setting.

thinkingobject or nullOptional
Extended thinking settings for models that support it.
output_configobject or nullOptional

Anthropic output settings; only effort is applied.

customerstring or nullOptional

Customer ID (UUID) to scope this request to, applying that customer’s routing policy, provider keys, budget, and usage attribution.

routing_policy_idstring or nullOptional

Routing policy ID for this request: an org-level policy, or a project or customer policy when the request carries that scope.

priority_orderlist of strings or objects or nullOptional

Ordered list of models to try, first success wins, with the same rules as priority_order on POST /v1/responses.

vendorstring or nullOptional

Restrict routing to one vendor (hosting platform).

vendorslist of strings or nullOptional

Ordered list of acceptable vendors; the first available one wins.

provider_optionsmap from strings to any or nullOptional

Provider-specific options, keyed by provider family.

include_routing_metadatabooleanOptionalDefaults to false
Return routing metadata for this request.
include_guardrails_metadatabooleanOptionalDefaults to false

Return prompt-injection and DLP results in a top-level guardrails object.

service_tier_fallbackbooleanOptionalDefaults to false

Retry once at the standard tier, billed at standard rates, if the requested tier is throttled (429 or 503).

Response

Successful Response
idstring
type"message"
role"assistant"
modelstring
contentlist of objects
usageobject
stop_reasonenum or nullOptional
Allowed values:
stop_sequencestring or nullOptional

Errors

422
Unprocessable Entity Error