Documentation Index
Fetch the complete documentation index at: https://portkey-docs-feat-proxy-apis.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Available on all Portkey plans.
Quick start
<provider-path> with the suffix the provider expects (rerank, videos, listen, etc.). On a self-hosted gateway, use that deployment’s host; keep the /v1/<provider-path> pattern.
Unified routes vs proxy
Dedicated routes register before the catch-all. They use unified handlers—not the proxy.| Path | Handler |
|---|---|
POST /v1/chat/completions | Chat completions |
POST /v1/images/generations | Unified image handler |
POST /v1/embeddings | Unified embeddings handler |
POST /v1/messages | Messages API |
POST /v1/responses | Responses API |
POST /v1/audio/... | Unified audio handler |
/v1/files, /v1/batches, … | Dedicated handlers |
Anything else under /v1/* | Proxy handler |
Pick a URL
| Goal | URL |
|---|---|
| Chat (configs, fallbacks, retries) | POST https://api.portkey.ai/v1/chat/completions (unified) |
| Image generation | POST https://api.portkey.ai/v1/images/generations (unified) |
| Provider path without a unified route | POST https://api.portkey.ai/v1/<that-path> (proxy) |
| Force proxy on a path that would hit a unified route | POST https://api.portkey.ai/v1/proxy/<that-path> — see Legacy /v1/proxy |
How the proxy works
For paths that reach the proxy:- Send method, path, query string, and body (JSON, multipart, or binary) to the gateway.
- Portkey applies auth, config, credentials, routing, retries, caching, guardrails, and the rest of the gateway pipeline.
- The request is sent to the provider base URL (or
x-portkey-custom-host) with the remaining path the provider expects. - The response is essentially the provider response (pass-through), plus standard Portkey response headers.
Supported HTTP methods
| Method | Supported |
|---|---|
POST | Yes |
GET | Yes (realtime path excluded on Workers) |
PUT | Yes |
DELETE | Yes |
PATCH | No — not registered on the /v1/* catch-all |
Required and optional headers
Required
| Header | Purpose |
|---|---|
x-portkey-api-key | Portkey API key |
x-portkey-provider or x-portkey-config | Routing: provider slug, Model Catalog @slug, or full config JSON |
Authorization | Provider secret when credentials are not supplied only via Model Catalog |
Content-Type | Match the provider (application/json for JSON bodies) |
Optional
| Header | Purpose |
|---|---|
x-portkey-metadata | JSON tags for analytics and conditional routing |
x-portkey-custom-host | Override provider base URL — Custom hosts |
x-portkey-forward-headers | Comma-separated client header names to forward upstream |
Authenticate
Model Catalog (recommended)
Model Catalog (recommended)
Add credentials in Model Catalog. Use
x-portkey-provider: @<slug> and omit Authorization when the catalog supplies auth.Model Catalog centralizes keys, budget and rate limits, and rotation.
Direct provider auth
Direct provider auth
Use a supported provider slug and pass the provider secret on each request.
Custom hosted endpoint
Custom hosted endpoint
Choose a compatible
x-portkey-provider (openai, cohere, etc.). Set the URL with x-portkey-custom-host (header) or custom_host / customHost in the SDK.On Portkey SaaS, custom hosts must be publicly reachable. Private IPs apply only to self-hosted / hybrid enterprise setups. See Custom hosts.
https://api.portkey.ai/v1 plus the provider suffix (e.g. https://api.portkey.ai/v1/rerank).
Examples
POST /rerank (Model Catalog)
POST /videos (direct provider auth)
Replace the body with the payload the provider’s video API expects.
GET, PUT, DELETE
The SDK exposes.get(), .post(), .put(), and .delete() for proxy paths.
Custom host (full POST /rerank)
Fallback with x-portkey-config
Same JSON shape as Configs: strategies, targets, retries, hooks.
jq -c . config.json) or set the header in application code.
Legacy /v1/proxy prefix
Prefix with /v1/proxy so the gateway strips that segment and forwards the remainder—forcing proxy semantics on a path that would otherwise hit a unified handler (raw passthrough on chat/completions, for example).
/v1/proxy/... only when passthrough on a unified path is required.
Advanced examples
Cohere rerank (extended parameters)
Cohere rerank (extended parameters)
AWS Bedrock rerank
AWS Bedrock rerank
For Bedrock, pass the full ARN with the model name in the
model field.Tokens, pricing, and analytics
- Token / usage fields in the body come from the provider, same as calling them without Portkey.
- Portkey billing and analytics run on proxy traffic. Pricing accuracy depends on endpoint and model recognition; unusual paths may need cost / pricing configuration—validate in the dashboard or contact support if numbers look off.
- Proxy requests appear in logs like any other gateway call.
Limitations and gotchas
- Response bodies are pass-through from the provider—no Portkey JSON reshape on proxy routes.
PATCHis not supported on the proxy catch-all.- Streaming, multipart, and binary use different internal paths—validate with the exact content type and provider before production.
- End-to-end success still requires gateway support for that provider (auth, signing, allowed paths) and a real provider API behind the path.
- SDKs typed for one provider’s contract can break when the upstream changes—same as calling that provider directly.
Checklist
- Prefer a unified route when one exists.
- Send
x-portkey-api-key. - Send
x-portkey-providerorx-portkey-config. - Keep provider secrets in
Authorizationor Model Catalog—not inx-portkey-*headers as fake “secrets.” - Match the provider’s request body.
- For passthrough on a unified path, use
/v1/proxy/....

