POST /v1/messages

Anthropic-compatible messages API.

Inference APIs

Send native Anthropic messages through the gateway while keeping Anthropic request and response shapes intact.

POST/v1/messages

Request

  • Auth: tenant auth when enabled; otherwise dev mode is open
  • Content-Type: application/json
  • Max body size: 4 MiB
  • Provider restriction: Anthropic only

Request fields

FieldTypeRequiredNotes
modelstringyesMust resolve to provider: anthropic
messagesarrayyesAnthropic messages array
max_tokensintegeryesRequired by the gateway
streambooleannoEnables SSE streaming
systemany JSONnoPassed upstream unchanged
temperaturenumbernoPassed upstream when present
top_pnumbernoPassed upstream when present
top_kintegernoPassed upstream when present
toolsany JSONnoPassed upstream unchanged
tool_choiceany JSONnoPassed upstream unchanged
metadata or arammobjectnoAttribution fields stripped before upstream dispatch
any other fieldsany JSONnoPreserved and forwarded unchanged

Response schema

FieldTypeRequiredNotes
idstringyesGateway-owned message ID
typestringyesAlways message
rolestringyesUsually assistant
modelstringyesRewritten to the public alias
contentarrayyesNative Anthropic content blocks
content[].typestringyesBlock type such as text
content[].textstringnoText payload for text blocks
stop_reasonstringnoNative stop reason
usageobjectnoUsage returned by Anthropic
usage.input_tokensintegernoInput token count
usage.output_tokensintegernoOutput token count
usage.cache_read_input_tokensintegernoCache-read tokens when available
usage.cache_creation_input_tokensintegernoCache-write tokens when available

Errors

HTTPCodeWhen
400invalid_request_errorMalformed JSON, missing required fields, or invalid content
400invalid_request_errorResolved target is not Anthropic
400invalid_request_errorAnthropic provider not configured
422pii_detectedPII blocked by guardrails
422BLOCKED_POLICY_VIOLATIONPDPA keyword policy block
403CROSS_BORDER_TRANSFER_BLOCKEDPDPA cross-border transfer rejected
429rate_limit_exceededTenant rate limit exceeded
402monthly_budget_exceededMonthly spend limit exceeded
402insufficient_creditsCredit balance too low
502api_errorUnexpected upstream Anthropic failure

Notes

  • Only Anthropic-resolved models are allowed.
  • The gateway preserves the native Anthropic response shape.
  • Response model and id are rewritten at the boundary.
  • Streaming SSE events are forwarded event-by-event.