A blazing fast AI Gateway with integrated guardrails. Route to 1,600+ LLMs, 50+ AI Guardrails with 1 fast & friendly API.
A blazing fast AI Gateway with integrated guardrails. Route to 1,600+ LLMs, 50+ AI Guardrails with 1 fast & friendly API.
[!IMPORTANT] :rocket: Gateway 2.0 (Pre-Release) Portkey's core enterprise gateway is merging into open-source with our 2.0 release. You can try the pre-release branch here. Read more about what's next for Portkey in our Series A announcement.
The AI Gateway is designed for fast, reliable & secure routing to 1600+ language, vision, audio, and image models. It is a lightweight, open-source, and enterprise-ready solution that allows you to integrate with any language model in under 2 minutes.
[!TIP] Starring this repo helps more developers discover the AI Gateway
# Run the gateway locally (needs Node.js and npm)
npx @portkey-ai/gatewayDeployment guides: Portkey Cloud (Recommended) Docker Node.js Cloudflare Replit Others...The Gateway is running on
http://localhost:8787/v1The Gateway Console is running on
http://localhost:8787/public/
# pip install -qU portkey-ai
from portkey_ai import Portkey
# OpenAI compatible client
client = Portkey(
provider="openai", # or 'anthropic', 'bedrock', 'groq', etc
Authorization="sk-***" # the provider API key
)
# Make a request through your AI Gateway
client.chat.completions.create(
messages=[{"role": "user", "content": "What's the weather like?"}],
model="gpt-4o-mini"
)Supported Libraries: JS Python REST OpenAI SDKs Langchain LlamaIndex Autogen CrewAI More..
On the Gateway Console (http://localhost:8787/public/) you can see all of your local logs in one place.
Configs in the LLM gateway allow you to create routing rules, add reliability and setup guardrails.
config = {
"retry": {"attempts": 5},
"output_guardrails": [{
"default.contains": {"operator": "none", "words": ["Apple"]},
"deny": True
}]
}
# Attach the config to the client
client = client.with_options(config=config)
client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Reply randomly with Apple or Bat"}]
)
# This would always response with "Bat" as the guardrail denies all replies containing "Apple". The retry config would retry 5 times before giving up.You can do a lot more stuff with configs in your AI gateway. Jump to examples →
AWS Azure GCP OpenShift Kubernetes
The LLM Gateway's enterprise version offers advanced capabilities for org management, governance, security and more out of the box. View Feature Comparison →
The enterprise deployment architecture for supported platforms is available here - Enterprise Private Cloud Deployments
MCP Gateway provides a centralized control plane for managing MCP (Model Context Protocol) servers across your organization.
Works with Claude Desktop, Cursor, VS Code, and any MCP-compatible client. Get started →
Open-source LLM pricing database for 40+ providers - used by the Gateway for cost tracking.
Explore Gateway integrations with 45+ providers and 8+ agent frameworks.
| Provider | Support | Stream | |
|---|---|---|---|
| OpenAI | ✅ | ✅ | |
| Azure OpenAI | ✅ | ✅ | |
| Anyscale | ✅ | ✅ | |
| Google Gemini | ✅ | ✅ | |
| Anthropic | ✅ | ✅ | |
| Cohere | ✅ | ✅ | |
| Together AI | ✅ | ✅ | |
| Perplexity | ✅ | ✅ | |
[Feature] Add TypeSafe AI's Jev (System One model) as a supported provider
standardize auto generated ids to have 32 characters
Request: List Rhylthyme MCP server in the Portkey MCP directory
azure-ai-inference: no Responses API support — requests silently fall back to `chatComplete` with data loss
Audio transcription endpoint does not respect Gateway's override_params
SSRF allowlist bypass and credential theft via /v1/proxy/* route -- @portkey-ai/gateway <= 1.15.2
`reasoning_effort` silently no-ops for Vertex `gemini-2.5-flash-lite` on `/v1/responses`
Request: List PPT Depot MCP server in the MCP directory
[Feature] Flex Processing pricing for OpenAI
[Feature] Merge Provider Configuration Metadata into Hook Context