Create a message batch
/v1/messages/batchesCreate a message batch.
Compatible with Anthropic's Message Batches API: the body is {"requests": [{"custom_id", "params"]}}, where each params is a Messages request, and the answer is Anthropic's batch object. At most 100,000 requests; each custom_id is 1 to 64 letters, digits, - or _ and unique in the batch; stream is not allowed. results_url points at this gateway's results endpoint.
Credentials: as for creating a message, but only for Anthropic: a virtual key with its own Anthropic key (not a PLATFORM key, since a batch is billed after it runs) or a raw Anthropic key. Claude on Vertex, other providers and routing configs (x-config) are a 400.
Before the batch reaches Anthropic, with a virtual key: the key is checked for each model the batch uses (status, expiry, model allowlist, rate limits; the batch counts as one request), the plan's limits apply, and every request is checked by the tool-result scan and the input guardrails (the key's plus x-guardrail). A BLOCK on any request refuses the whole batch with a 422 naming its custom_id; a REDACT is sent redacted. Output guardrails do not run, since Anthropic answers later. The batch is billed to the virtual key, at the batch rate, once it has ended, and attributed to the workspace in x-workspace-id (else the key's). With a raw Anthropic key only the tool-result scan runs (no guardrails), and nothing is recorded or billed.
Errors are in Anthropic's shape: 400 for an invalid batch (naming requests[i]), 401 for a missing or invalid credential, 403 for a disabled or expired key or a model it does not allow, 422 for a guardrail BLOCK, 429 for a rate limit.
Authorization
AuthorizationBearer <slug>.<secret>A virtual key's API key (
vk-....<secret>), asAuthorization: Bearer. What the OpenAI SDK sends from itsapi_key. Used by the inference endpoints.- or
x-virtual-keyheaderA virtual key's API key in the
x-virtual-keyheader, for clients that keepAuthorizationfor something else. - or
x-api-keyheaderDirect credentials: the provider's own API key in
x-api-key, with the provider named inx-provider(for exampleopenai). On/v1/messagesa virtual key is accepted inx-api-keytoo, which is what the Claude SDK sends.
Headers
x-providerstringWith direct credentials: the provider
x-api-keybelongs to, for exampleopenaioranthropic(case and dashes are normalised). Not used with a virtual key.x-guardrailstringA guardrail slug (
gr-...) to apply to this request, in addition to any the virtual key carries. A BLOCK is a 422 withx-guardrail-status: BLOCK.anthropic-betastringAnthropic beta features, comma-separated (for example
context-management-2025-06-27). Forwarded to Anthropic and Claude on Vertex only; at most 32 names of lower-case letters, digits and dashes.