Endpoint
model and stream, resolves the model through the virtual key, and sends the request to the provider that serves it. Authorization: Bearer <key> works in place of x-api-key.
Point the Anthropic SDK at the gateway with base_url="https://gateway.langwatch.ai" and the virtual key as api_key. Claude Code takes ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN; see Claude Code.
Request
Response
Which providers serve it
Parameters the gateway changes or refuses
The
X-LangWatch-End-User-Id, X-LangWatch-Metadata and Traceparent request headers work as on Chat Completions.
Response headers
The same set as Chat Completions:X-LangWatch-Gateway-Version, X-LangWatch-Gateway-Request-Id, X-LangWatch-Fallback-Count, X-LangWatch-Budget-Warning, X-LangWatch-Cache-Mode, X-LangWatch-Params-Dropped, Traceparent, X-LangWatch-Heartbeat-Active, and X-LangWatch-Provider on a forwarded provider error. X-LangWatch-Handled-Error carries the error.code when the gateway wrote the error itself, and is removed from a forwarded provider response.
Streaming
Set"stream": true. The response is text/event-stream in Anthropic’s own event framing, and there is no data: [DONE] trailer. On an Anthropic-compatible provider the frames reach the client as the provider wrote them. On a translated lane the gateway builds the Anthropic events itself from the provider’s own stream. A failure after the stream opens adds one terminal event: error frame:
event: error frame; see Errors.
Errors
Errors the gateway raises use the envelope on Errors:{"error": {"type", "code", "message", ...}}. A provider’s own error is forwarded with its status and body, under X-LangWatch-Provider.
Codes this endpoint raises before the provider is called: missing_model, model_not_allowed, model_provider_not_bound, model_not_recognized, unsupported_parameter and end_user_required, all 400. A policy rule that blocks the resolved model, or a model outside a policy allow-only list, answers 403 policy_violation.
Also check: Streaming, Parameter mapping, Model aliases.