gateway
A blazing fast AI Gateway with integrated guardrails. Route to 1,600+ LLMs, 50+ AI Guardrails with 1 fast & friendly API.
- 13.3k stars
- 1.4k forks
- 307 open issues
- Language: TypeScript
- License: MIT
- updated
Install
local · npxclaude mcp add gateway -- npx -y @portkey-ai/gateway{
"mcpServers": {
"gateway": {
"command": "npx",
"args": ["-y", "@portkey-ai/gateway"]
}
}
}{
"mcpServers": {
"gateway": {
"command": "npx",
"args": ["-y", "@portkey-ai/gateway"]
}
}
}- Run the command above in your terminal (Claude Code), or paste the JSON config into claude_desktop_config.json (Claude Desktop).
- Replace any <placeholder> values with your API keys or paths.
- Restart Claude. The MCP server and its tools appear automatically.
Editor's note
Portkey AI Gateway is an open-source TypeScript routing layer that sits between applications and over 250 LLM providers, exposing a single OpenAI-compatible API endpoint so developers can swap models without rewriting client code. It supports automatic retries, fallbacks, and load balancing across providers to reduce downtime, and includes more than 50 configurable guardrails for content safety and compliance. The gateway runs locally via a single npx command, weighs 122kb, and adds under one millisecond of latency. Its MCP Gateway feature adds enterprise-grade authentication and observability specifically for MCP server management, making it relevant to teams building Claude-powered agents through the Model Context Protocol. It also integrates with LangChain, LlamaIndex, and Autogen. The project claims to process over 10 billion tokens daily, which gives a sense of its production scale. Platform engineers, AI product teams, and developers who need provider redundancy or policy enforcement across multiple models are the primary beneficiaries.
MCP Servers overview
English | 中文 | 日本語
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.
🆕 Portkey Models - Open-source LLM pricing for 2,300+ models across 40+ providers. Explore →
AI Gateway
Route to 250+ LLMs with 1 fast & friendly API
Docs | Enterprise | Hosted Gateway | Changelog | API Reference
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.
[x] Blazing fast (<1ms latency) with a tiny footprint (122kb)
[x] Battle tested, with over 10B tokens processed everyday
[x] Enterprise-ready with enhanced security, scale, and custom deployments
What can you do with the AI Gateway?
Integrate with any LLM in under 2 minutes - Quickstart
Prevent downtimes through automatic retries and fallbacks
Scale AI apps with load balancing and conditional routing
Protect your AI deployments with guardrails
Go beyond text with multi-modal capabilities
Explore agentic workflow integrations
Manage MCP servers with enterprise auth & observability using MCP Gateway
Tip
Starring this repo helps more developers discover the AI Gateway 🙏🏻
Quickstart (2 mins)
1. Setup your AI Gateway
# Run the gateway locally (needs Node.js and npm)
npx @portkey-ai/gatewayThe Gateway is running on
http://localhost:8787/v1The Gateway Console is running on
http://localhost:8787/public/
Deployment guides: Portkey Cloud (Recommended) Docker Node.js Cloudflare Replit Others...
2. Make your first request
# 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.
3. Routing & Guardrails
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 →
Enterprise Version (Private deployments)
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
MCP Gateway provides a centralized control plane for managing MCP (Model Context Protocol) servers across your organization.
Authentication — Single auth layer at the gateway. Users authenticate once; your MCP servers receive verified requests
Access Control — Control which teams and users can access which servers and tools. Revoke access instantly
Observability — Every tool call logged with full context: who called what, parameters, response, latency
Identity Forwarding — Forward user identity (email, team, roles) to MCP servers automatically
Works with Claude Desktop, Cursor, VS Code, and any MCP-compatible client. Get started →
Core Features
Reliable Routing
Fallbacks: Fallback to another provider or model on failed requests using the LLM gateway. You can specify the errors on which to trigger the fallback. Improves reliability of your application.
Automatic Retries: Automatically retry failed requests up to 5 times. An exponential backoff strategy spaces out retry attempts to prevent network overload.
What people ask about gateway
What is Portkey-AI/gateway?
Portkey-AI/gateway is mcp servers for the Claude AI ecosystem. A blazing fast AI Gateway with integrated guardrails. Route to 1,600+ LLMs, 50+ AI Guardrails with 1 fast & friendly API. It has 13.3k GitHub stars and its last recorded update is dated 2026-05-25.
How do I install gateway?
You can install gateway by cloning the repository (https://github.com/Portkey-AI/gateway) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is Portkey-AI/gateway safe to use?
Our security agent has analyzed Portkey-AI/gateway and assigned a Trust Score of 100/100 (tier: Verified). See the full breakdown of passed checks and flags on this page.
Who maintains Portkey-AI/gateway?
Portkey-AI/gateway is maintained by Portkey-AI. The last recorded GitHub activity is dated 2026-05-25, with 307 open issues.
Are there alternatives to gateway?
Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.
Deploy gateway to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Show its Trust Score in your README
The badge shows this repository's current Trust Score and verdict, and links back to this page. It follows the catalogue data: nobody can buy or edit the score it displays.
[](https://claudewave.com/en/repo/portkey-ai-gateway)<a href="https://claudewave.com/en/repo/portkey-ai-gateway"><img src="https://claudewave.com/api/badge/portkey-ai-gateway" alt="ClaudeWave Trust Score for Portkey-AI/gateway" width="320" height="64"></a>