Skip to main content
The Portkey AI Gateway exposes an OpenAI-compatible REST API. You can point any OpenAI SDK or HTTP client at the gateway and route requests to any supported provider by adding a few extra headers.

Base URL

When running locally with npx @portkey-ai/gateway, the gateway listens on http://localhost:8787/v1. The console UI is available at http://localhost:8787/public/.

Request requirements

Every request must include either:
  • x-portkey-provider — to route directly to a single provider, or
  • x-portkey-config — to use a routing config (fallback, load balancing, guardrails, etc.)
See Authentication and Headers for details.

Endpoints

OpenAI compatibility

The gateway is a drop-in replacement for the OpenAI API base URL. To migrate an existing OpenAI integration:
  1. Change the base URL to http://localhost:8787/v1 (local) or your deployed gateway URL.
  2. Add the x-portkey-provider header to specify which provider to route to.
  3. Add an Authorization header with the provider API key.

Provider passthrough

For endpoints not explicitly handled by the gateway, requests to /v1/* are forwarded directly to the configured provider. This enables access to provider-specific endpoints beyond the standard OpenAI surface.