POST /v1/messages implements Anthropic’s Messages API shape. If your code already
speaks that format — through the Anthropic SDK or a hand-rolled client — you can
switch the base URL to Mesh and keep the rest of the integration unchanged.
The endpoint is not restricted to Anthropic models. Any model this gateway
serves is reachable through it, so an existing Anthropic client can call an
OpenAI, Google, or open-weight model without changing its request shape.
/v1/chat/completions remains the
recommended entry point — it has the widest feature coverage.
Authentication
Both header styles are accepted:x-api-key form is what Anthropic’s own SDKs send, which is why an unmodified
client works once the base URL is pointed at Mesh.
Basic request
- curl
- Python (Anthropic SDK)
- Node.js (Anthropic SDK)
Streaming
Setstream: true for Anthropic’s SSE event sequence — message_start,
content_block_start, content_block_delta, content_block_stop,
message_delta, message_stop. Anthropic’s SDKs consume it unchanged.
Token counts arrive on
message_delta, not message_start. Anthropic reports
input tokens on the first frame; Mesh only knows them once the upstream response
completes, so message_start.usage carries zeros and message_delta.usage carries
the real figures. SDKs that accumulate usage across the stream end up with the
correct totals.Request fields
Which endpoint should I use?
Related
- Claude Code — point the CLI at Mesh
- Tool Calling — the function-calling cycle
- Responses API — reasoning effort and hosted tools
- Available Models — every model this endpoint can reach