Guides
Anthropic API
The gateway serves the Anthropic Messages API at /v1/messages, so the Anthropic SDKs and Claude Code work against it unchanged. It is a translation onto the same chat surface, so every catalog model is reachable, not just Claude.
The endpoint
POST https://api.experientiallabs.ai/v1/messages speaks the Anthropic Messages wire protocol. Authenticate with the Anthropic-style x-api-key header or with Authorization: Bearer, either carries the same xpl_ key. Name any slug from GET https://api.experientiallabs.ai/v1/models as the model.
curl "https://api.experientiallabs.ai/v1/messages" \-H "x-api-key: $EXPLABS_API_KEY" \-H "anthropic-version: 2023-06-01" \-H "Content-Type: application/json" \-d '{"model": "qwen3.8-27b", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello"}]}'
Streaming
Set stream: trueto receive Anthropic's server-sent event stream (message_start, content_block_delta, message_stop, and the rest), exactly as the Anthropic SDKs expect.
curl -N "https://api.experientiallabs.ai/v1/messages" \-H "x-api-key: $EXPLABS_API_KEY" \-H "anthropic-version: 2023-06-01" \-H "Content-Type: application/json" \-d '{"model": "qwen3.8-27b", "max_tokens": 1024, "stream": true, "messages": [{"role": "user", "content": "Hello"}]}'
Retries and route selection
Messages generation accepts the same gateway.retry and gateway.routing extension as Chat and Responses. Python SDK users pass it through extra_body; disable the SDK's own retries independently withmax_retries=0. This example allows exactly one gateway generation dispatch, with no fallback or hidden repair redial.
curl "https://api.experientiallabs.ai/v1/messages" \-H "x-api-key: $EXPLABS_API_KEY" \-H "anthropic-version: 2023-06-01" \-H "Content-Type: application/json" \-d '{"model": "qwen3.8-27b","max_tokens": 1024,"messages": [{"role": "user","content": "Hello"}],"gateway": {"retry": {"max_attempts_per_route": 1,"max_total_attempts": 1,"backoff": {"type": "none"}},"routing": {"allow_fallbacks": false}}}'
For bounded retries, configurable exponential backoff, or selecting an eligible lower rung by its opaque route_id, see the request policy guide. The extension is not valid on /v1/messages/count_tokens or batch lines. A Messages Idempotency-Key still does not create replay protection.
Translation lane limits
The lane maps onto the gateway's shared chat surface, so a few Anthropic features are route-scoped. Where a route cannot express something, the gateway translates or drops it with a disclosure instead of failing the request; only signed provider state is rejected:
- Extended thinking works on all-Anthropic routes: the
thinkingconfig passes through verbatim and thinking/redacted-thinking history blocks round-trip with signatures intact. On a non-Anthropic reasoning route the config translates to the route's nearest reasoning effort (disclosed asthinking->reasoning_effort:<tier>; a barethinking: {type: enabled}is accepted and reads as the default depth; an explicitoutput_config.effortwins withthinking->dropped(superseded_by_effort)), and on a route with no reasoning it is dropped with a disclosure. Block-levelcache_controlmarkers are preserved on supported Anthropic and OpenRouter adapters and translated into Bedrock cache checkpoints. Generic adapters that cannot carry a marker disclose it as not forwarded; a successful request or a listed cached price does not guarantee a cache hit. There is no organization caching switch. Platform-funded requests support five-minute cache writes; one-hour markers are refused until duration-specific pricing is available. Usage distinguishescache_read_input_tokensandcache_creation_input_tokens. OpenRouter'sreasoningobject (effortormax_tokens, plusenabled) is accepted besidethinkingand wins when both are present. On a reasoning-exposed non-Anthropic rung the model's own reasoning streams as an unsignedthinkingblock (tool turns carry it sealed in a trailingredacted_thinkingblock) and replays on the next turn; Anthropic-signed thinking blocks replayed onto a non-Anthropic route are dropped with themessages.thinking->dropped(unsupported_by_provider)disclosure instead of a400. - Image blocks are served on every route whose model accepts images, up to 100 per request. Document (PDF) blocks need a document-capable route; otherwise a
400namesmessagesand suggests a capable alias. tool_result.is_error=trueis native on Anthropic rungs and folds into the result text on every other wire (disclosed), so a failed tool call never ends a session.Idempotency-Keyis not honored on this lane (Anthropic defines none)./v1/messages/count_tokensanswers with the gateway's own token estimate for the route (the response discloses that it is an estimate, not the provider's count); per-turn usage on the stream is the authoritative figure.
/v1/messages use Anthropic's envelope, {"type":"error","error":{"type":"invalid_request_error","message":"..."}}, at the same HTTP statuses as the OpenAI routes. Branch on the status and the Anthropic error type; the underlying meanings match the Errors table.Claude Code and other agents
Claude Code connects through this same lane by pointing ANTHROPIC_BASE_URL at the gateway and passing an xpl_ key as ANTHROPIC_API_KEY. Its startup connectivity probe, a keyless HEAD /api/hello, answers 200 exactly as Anthropic's API does; it is not a request and needs no key. The per-agent configuration is in Coding agents.
See also
Prefer the OpenAI protocol? The Quickstart covers Chat Completions and the Responses API. The full surface is in the API reference.