API overview
The gateway exposes an OpenAI-compatible REST API surface so you can reuse existing OpenAI SDKs and tooling โ point the client's base_url at the gateway and keep your code unchanged.
Base URLโ
Use the gateway host as the base URL, for example:
http://localhost:8080
Authenticationโ
/v1/* requires a bearer token by default:
Authorization: Bearer fgw_...
Set ALLOW_UNAUTHENTICATED_PROXY=true to disable this for local development โ it is refused at startup under GATEWAY_ENV=production. See Authentication.
Inference endpointsโ
These route through the gateway's targets, plugins, and circuit breakers like any other request:
| Endpoint | Method | Notes |
|---|---|---|
/v1/chat/completions | POST | Supports stream: true (SSE) |
/v1/completions | POST | Legacy text completions, served as a single-message chat |
/v1/embeddings | POST | |
/v1/images/generations | POST | |
/v1/audio/speech | POST | Text-to-speech โ JSON in, binary audio out |
/v1/audio/transcriptions, /v1/audio/translations | POST | Speech-to-text โ multipart upload, 25 MiB cap |
/v1/rerank | POST | Cohere-v2 contract |
/v1/moderations | POST | |
/v1/responses | POST | Governed and priced โ routes by model like chat |
/v1/audio/* is natively routed, not blindly proxied: it goes through targets, plugins, the circuit breaker, and request logging like the endpoints above.
Discoveryโ
| Endpoint | Method | Notes |
|---|---|---|
/v1/models | GET | Union of catalog, live discovery, and operator-declared models |
/v1/capabilities | GET | Per-provider OpenAI parameter support, from the capability matrix |
Files, batches, and responses sub-routesโ
| Endpoint | Method | Notes |
|---|---|---|
/v1/files, /v1/files/* | GET, POST, DELETE | Pass-through to the single configured batch_target |
/v1/batches, /v1/batches/* | GET, POST, DELETE | Pass-through to the single configured batch_target |
/v1/responses/* | GET, POST, DELETE | Id sub-routes (retrieve/delete/cancel/input_items), pin to responses_target |
These carry no model โ a batch or response id is opaque and provider-scoped โ so they pin to one configured target instead of being routed. Each returns 501 when its target (batch_target / responses_target) is unset.
Pass-through proxyโ
Any other /v1/* path is forwarded transparently to the provider that owns the request's model, resolved through the same routing index every native endpoint uses โ an unowned model is refused 404 model_not_found rather than forwarded.
Health and observabilityโ
| Endpoint | Method | Auth |
|---|---|---|
/livez | GET | None โ process is alive |
/readyz | GET | None โ gateway can route traffic |
/health | GET | None โ deep diagnostic (per-provider status, circuit state) |
/metrics | GET | Bearer token, read_only or admin scope |
/debug/vars, /debug/pprof/* | GET | Bearer token, admin scope (/debug/pprof/* also requires ENABLE_PPROF=true) |
/metrics and everything under /debug require a scoped bearer token โ unlike /v1/*, an unauthenticated request always gets 401 here, even with ALLOW_UNAUTHENTICATED_PROXY=true.
Relatedโ
- Endpoints โ full request/response reference
- Streaming โ SSE wire format
- Admin API โ key management, config history, logs
- Errors โ error envelope and status codes
- Interactive API reference โ Scalar-rendered OpenAPI explorer