- OpenAI-compatible
/v1/chat/completions - Anthropic-compatible
/v1/messages - Tenant control plane
/v1/prompts/*,/v1/guardrails/*,/v1/audit/* - Billing
/v1/billing/*,/v1/webhooks/polar - Auth
/v1/auth/whoami,/v1/webhooks/workos,/v1/keys - Operational
/health
Authorization: Bearer <jwt | tlane_*>. POST /v1/messages and POST /v1/messages/count_tokens also accept x-api-key: tlane_*, because that is what the Anthropic SDKs send; no other endpoint reads that header.
Inference
POST /v1/chat/completions
The single inference endpoint — the OpenAI Chat Completions shape. Routed by
model-name prefix across 205 providers: OpenAI for gpt-* / o1* / o3* and
every other OpenAI-compatible host by its own prefix, plus 6 native adapters —
Anthropic (claude-*), Google (gemini-*), Vertex (vertex/*), Bedrock
(bedrock/*), Azure (azure/*), Cohere (command*) — whose requests are
translated to their native wire format. Full prefix list:
Providers.
POST /v1/embeddings is a separate endpoint, in the OpenAI Embeddings shape and
routed by model name the same way.
Images, audio, moderation, rerank, files and batches
These endpoints take the OpenAI request shapes and run the same admission pipeline as chat: authentication, thechat scope, entitlements and rate limits, per-key and
workspace budgets, detection, the tamper-evident ledger append and request guardrails.
Every call uses the workspace’s own stored provider key and records one span.
The provider comes from the model name, as on chat, and must expose the endpoint at the
OpenAI path in its own documentation; otherwise the call is refused
400 unsupported_endpoint naming the provider. Send the provider’s own model id: a JSON body
may carry the gateway’s provider/ prefix, a multipart body is forwarded exactly as
received and may not.
- Request guardrails scan the image prompt, the speech input and the rerank query and
documents. A rail that would redact refuses instead (
403 guardrail_block): these bodies are not rewritten. - A batch is not a way around them. A
purpose=batchupload is held in memory and every JSONL line is checked before anything is forwarded: itsurlmust be/v1/chat/completions,/v1/embeddingsor/v1/responses; its model must route to the same provider as the upload; and its request must pass the same checks and guardrails as the equivalent chat call. One failing line refuses the whole file with400 batch_line_rejected, the line number and a code (never the line’s content). - Limits (
413 payload_too_large, with the limit in the body): the buffered batch file is capped at 100 MB and 50,000 lines; other uploads are streamed and capped at 512 MB. For a large upload sendpurposebefore the file part. - Batch spend is recorded the first time a completed batch is retrieved, from the batch’s own usage, so a budget can be exceeded by at most one batch that was in flight.
POST /v1/messages
The Anthropic Messages shape, so an Anthropic SDK — or Claude Code with
ANTHROPIC_BASE_URL pointed here — works by swapping its base URL. It serves
Anthropic models only (claude-*); any other model is refused 400 unroutable_model rather than translated, and the OpenAI-shaped
/v1/chat/completions is the endpoint for every other provider.
Your request body is forwarded to Anthropic as you sent it, with your stored
Anthropic key (BYOK) and your anthropic-version / anthropic-beta headers
attached. The response is relayed back unchanged — streaming SSE included — so
thinking blocks, tool_use blocks, cache_control and beta features reach your
SDK exactly as Anthropic emitted them. The exception is a response your workspace’s
own guardrails redact or block, which is the case where enforcement takes
precedence over relaying bytes.
The same pipeline runs as on /v1/chat/completions: entitlements and rate limits,
the monthly quota, per-key and workspace budgets, detection, the tamper-evident
ledger append, and request guardrails. Errors are returned in Anthropic’s error
shape ({"type":"error","error":{...}}) with an extra code field. Cross-provider
failover is not available on this endpoint.
POST /v1/messages/count_tokens
Anthropic’s pre-flight token count, forwarded with your stored key. It is not an
inference: it emits no span and writes no ledger row.
Prompt promotion
Audit (Audit-SKU)
The ledger is verifiable end-to-end with
tlane verify and is byte-identical
across the Rust, Python, and TypeScript verifier implementations.
Billing
Auth
API-key listing and revocation are dashboard surfaces, not gateway routes.
Guardrails
The verdict and observation routes above are read-only. Tool pinning is not:
when a Postgres control plane is configured the gateway also mounts
POST /v1/guardrails/tool-pins, POST /v1/guardrails/tool-pins/approve and
DELETE /v1/guardrails/tool-pins/{tool_name}, which write pin state. Rail
modes themselves are not settable over the API. See
Predictive guardrails for the rail catalog.
Operational
Errors
Error envelope:x-tracelane-failover— present if a fallback served the request
Related
- CLI — what the CLI calls
- Architecture — what the gateway does internally
- Providers — provider adapters behind these endpoints