Create a message (Anthropic Messages format)
Use this when your client speaks Anthropic Messages. Set the client’s base URL to
MEADOW_BASE_URL and its API key to a Meadow key. Meadow accepts the key in
x-api-key, which is where Anthropic clients send it. The Anthropic Python SDK
was checked this way against the hosted service, blocking and streamed. Claude
Code uses the same route and has not been checked end to end.
The body is the Anthropic Messages request. Meadow reads model, models,
provider and stream, removes models and provider, and passes everything
else to the vendor. max_tokens is required and must be at least 1, on every
key. anthropic-version and anthropic-beta request headers are forwarded.
When you send no anthropic-version, Meadow sends a default one. A query string
such as ?beta=true is accepted. The rules for routing, fallback, limits,
headers and streaming are in the Models section above.
POST /v1/messages/count_tokens does not exist.
Scope: models.
Streaming. With stream: true the response is text/event-stream with
Anthropic’s named events, in this order: message_start, then for each content
block content_block_start, one or more content_block_delta, and
content_block_stop, then message_delta with the stop reason and final usage,
then message_stop. ping events can appear anywhere. A captured stream, with
the usage objects shortened:
Authentication
A Meadow API key, sent as Authorization: Bearer mdw_.... The header
x-api-key: mdw_... is accepted in its place.
Request
An Anthropic Messages request, plus the optional Meadow fields models and provider. At most 16 MiB.
Which model providers may serve a request, and in what order. Send it as
provider on a model request, or store it on a project as routing.models. The
field names follow OpenRouter’s provider object. A field set on the request
replaces the same field from the project. Fields the request leaves out keep
the project’s value. Every entry must be a model provider. An unknown field
returns 400.
When true, the response is a server-sent event stream.
Response headers
The provider that answered, for example anthropic. Present on a 200 and on a vendor error that was passed through.
Why this vendor answered, in stable codes only. direct: <vendor> when the
first vendor in the route served the call. fallback: <vendor> <reason> -> <vendor> when an earlier vendor failed, with the same reason codes as
attempts[].reason in an error body. failed: ... on a vendor error passed
through. It never carries vendor error text.
Comma-separated providers that rejected your stored credential during this request (HTTP 401 or 403, or a failed token exchange). Absent when none did. Replace the provider key for each one named.
Comma-separated providers that received the request and may bill for it, but whose response was not used (a timeout or broken connection after the request was sent, or an unusable 200 body). Absent when there are none.
Meadow’s id for this request, req_ and 24 hex characters. Every response
carries it, including errors, streams and unknown routes. Every error in the
Error schema repeats it as request_id. Quote it when you report a problem.
The same value as x-request-id, under the header name the Anthropic API uses.
Sent on every response of /v1/messages and of the paths under it, so
message._request_id and error.request_id are set in the Anthropic SDKs. An
error in Anthropic’s envelope repeats it as request_id.
The request id of the vendor that answered, taken from its x-request-id,
request-id, x-amzn-requestid, apim-request-id or x-generation-id header,
the first one present in that order. Use it with that vendor’s support.
Vendors tried before a fallback are not listed. Absent when the vendor sent
none.
The service tier Google served this call on, returned as Google sent it, on a
served call answered by google. standard, priority or flex.
standard after a request with service_tier priority means Google
downgraded it and bills it at the standard rate. Absent when another provider
served the call or Google sent none.
The service tier Bedrock served this call on, returned as Bedrock sent it, on a
served call answered by bedrock. default, priority, flex or
reserved. Absent when another provider served the call or Bedrock sent none.
Response
The vendor’s Messages response, or its event stream when stream is true.
Anthropic’s anthropic-ratelimit-* headers are returned as sent.