Skip to main content
The Gateway API runs inference. The Admin API configures what it is allowed to do. Point an OpenAI-compatible client at the gateway, name a model, and the request is routed, guarded, logged and billed according to the configuration your administrators have already put in place. Nothing about routing, credentials or policy belongs in the request itself.
Two things carry the routing: the Authorization header holds your gateway API key, and the model field is prefixed with the slug of the integration to use. @openai-prod/gpt-4o reads as the gpt-4o model, through the integration called openai-prod.
The base URL is https://aigw.portkey.ai/v1. MCP Gateway serves /m and Agent Gateway serves /agent.

Two ways in

An OpenAI-compatible SDK

Change the base URL and the API key on a client you already have. This is also how Langchain, LlamaIndex and most agent frameworks connect.

REST

Call the endpoints directly. Everything the SDKs do is available over plain HTTP.

Through an OpenAI SDK

Install the official client, then override two fields:
Gateway-specific behaviour (a saved config, request metadata, a cache directive) travels in headers, which the SDKs expose as default_headers / defaultHeaders.

Start here

Authentication

API keys, and JWT as an alternative

Headers

Every gateway header, and what each one changes

Config object

Routing, fallbacks, retries and caching as a single object

Supported providers

What can sit behind the gateway

Response schema

What comes back, and where the gateway adds to it

Error codes

Failures on the inference path
Last modified on September 18, 2026