How the gateway works
When your application sends a request, it travels through the gateway on its way to the appropriate AI provider. The gateway inspects the request, routes it to the right destination, translates the protocol if needed, and returns a normalized response — all transparently.1
Your app sends a request
You call
https://api.portrix.ai/v1 using any OpenAI-compatible SDK or HTTP client, specifying the model you want.2
The gateway routes the request
Portrix identifies the target provider from the model name, applies your routing rules, and forwards the request to the correct provider endpoint.
3
The provider processes the request
OpenAI, Anthropic, Google, or whichever provider you targeted receives and handles the request using its native API.
4
The gateway normalizes the response
The provider’s response is translated back into OpenAI-compatible format and returned to your application — consistent regardless of which provider was used.
What the gateway handles
The gateway manages several cross-cutting concerns so your application code stays simple.Authentication & Key Management
Authenticate once with a single Portrix API key. The gateway manages provider-specific credentials on your behalf — no more storing a dozen API keys in your environment.
Request Routing
The gateway directs each request to the correct provider based on the model you specify, your routing rules, and current provider availability.
Protocol Translation
Your OpenAI-format requests are automatically converted to each provider’s native API format before being forwarded, and responses are normalized back.
Fallback Handling
When a provider is unavailable or over quota, the gateway can automatically retry against a fallback model so your application stays resilient.
Response Normalization
Every response — regardless of provider — comes back in a consistent shape, so your response-parsing code works universally.
The base URL
All requests to Portrix go through one base URL:Replace
$PORTRIX_API_KEY with your actual Portrix API key from the dashboard.OpenAI compatibility
The gateway speaks OpenAI’s API format natively — any SDK or tool that already works with OpenAI works with Portrix. You can switch by changing one line: the
base_url (or equivalent) in your client configuration.openai Python or Node.js SDK, LangChain, LlamaIndex, or any other OpenAI-compatible tooling without modification. Simply set the base URL to https://api.portrix.ai/v1 and your Portrix API key.