This is core protocol compatibility, not a claim of every vendor endpoint or field. Management APIs are authenticated but not yet a versioned public OpenAPI contract.
Authentication
/health is unauthenticated. Other data-plane routes accept x-api-key or Authorization: Bearer. When both exist, x-api-key wins. Give clients gateway-issued project keys; the static administrator keys are also accepted but bypass key and project allowlists and quotas. Unauthenticated local mode never grants admin access.
Endpoint inventory
| Method | Path | Contract |
|---|---|---|
| GET | /health | Process liveness and build identity; no provider readiness. |
| GET | /v1/models | Configured, credential/policy-eligible models, endpoints, and safe aliases. |
| POST | /v1/chat/completions | Chat, tools, streaming, vision filtering, and eligible ordered failover. |
| POST | /v1/responses | Native Responses or strict stateless Chat fallback. |
| POST | /v1/messages | Native or strict adapted Anthropic Messages. |
| POST | /v1/messages/count_tokens | Native count or marked deterministic estimate. |
| POST | /v1/embeddings | One OpenAI-compatible embedding target. |
| POST | /v1/audio/transcriptions | Multipart single-target STT proxy. |
| POST | /v1/audio/speech | Single-target speech, including native Edge TTS. |
| POST | /v1/images/generations | Inline base64 image output through a capable provider. |
| POST | /v1/videos/generations | Start or poll a long-running video operation. |
Bare aliases
/models, /chat/completions, /responses, /messages, /messages/count_tokens, /embeddings, /audio/transcriptions, /audio/speech, /images/generations, and /videos/generations map to their /v1 handlers. /completions maps to Chat Completions; there is no /v1/completions.
Chat Completions
curl http://127.0.0.1:8787/v1/chat/completions \
-H 'Authorization: Bearer <GATEWAY_PROJECT_KEY>' \
-H 'Content-Type: application/json' \
-d '{"model":"<MODEL_SELECTOR>","messages":[{"role":"user","content":"hello"}]}'Core chat supports tools, tool calls, streaming, usage normalization, vision filtering, and cancellation. Experimental Chat-to-Responses adaptation is opt-in and catalog-driven. Chat, Responses, and Messages also accept a per-request failover budget and an affinity key; see failover.
Responses
Native targets preserve Responses envelopes and stream events. Strict Chat fallback is limited to compatible stateless requests. Provider state, encrypted reasoning state, built-in tools, and non-empty include require a native Responses target that supports the requested feature.
background: true is always rejected, including for native Responses targets. Native transport is not a guarantee of model or account capability.Anthropic Messages and counting
Native non-streaming targets receive Messages directly after model/preamble resolution. Adapted paths reject unsupported semantic fields before dispatch.
Token counting uses a native count where possible. Other targets receive an estimate marked X-LLMGW-Token-Count: estimate. Counting has a 32 MiB request limit and does not consume inference quota or write usage.
Embeddings and media
- Embeddings use one target to avoid mixing vector spaces.
- Transcription accepts multipart
fileandmodel. Uploads count against the request body limit, 64 MiB unlessLLMGW_MAX_REQUEST_BODY_BYTESchanges it. - Speech proxies OpenAI-shaped providers or uses native Edge TTS.
- Images return inline
b64_json; native generation is currently Google-capable-provider specific. - Video starts with HTTP 202 and an operation ID; poll with the same selector and
operation.
Errors, streaming, cancellation
A request body over the limit is refused with 413 in the standard error envelope. Meaningful upstream status is preserved while credential-shaped diagnostics are sanitized. Endpoint streaming can move to another target only before output starts. Covered coding paths stop upstream work, retry, and failover after client cancellation.