Gateway

v1.0.0Cloud Servicesstable

A blazing fast AI Gateway with integrated guardrails. Route to 1,600+ LLMs, 50+ AI Guardrails with 1 fast & friendly API.

ai-gatewaygatewaygenerative-aihacktoberfestlangchain
Share:
11,817
Stars
0
Downloads
0
Weekly
0/5

What is Gateway?

Gateway is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to 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.

This server falls under the Cloud Services category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • A blazing fast AI Gateway with integrated guardrails. Route

Use Cases

AI gateway routing
LLM provider aggregation
AI guardrails enforcement
Portkey-AI

Maintainer

LicenseMIT
Languagetypescript
Versionv1.0.0
UpdatedMay 22, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

NPM

npx -y gateway

Manual Installation

npx -y gateway

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Gateway

Portkey AI Gateway is a blazing-fast, open-source AI router that provides a single unified API to route requests to 1,600+ LLMs across 50+ providers, with built-in guardrails, fallbacks, load balancing, semantic caching, and detailed observability. Its MCP integration centralizes authentication, access control, and logging for all MCP servers your team uses, making it a control plane for AI agent infrastructure. Teams that operate multiple LLM-powered services and need reliability, cost control, and compliance in one place will benefit most from deploying the Gateway.

Prerequisites

  • Node.js 18+ and npx, OR Docker for containerized deployment
  • API keys for the LLM providers you want to route to (e.g., OPENAI_API_KEY, ANTHROPIC_API_KEY)
  • An MCP-compatible client such as Claude Desktop, Cursor, or VS Code
  • Portkey account (optional, for cloud-hosted gateway and virtual key management)
1

Start the Gateway locally with npx

Run the Gateway on your local machine. It starts an API server on port 8787 and a management console at the /public path.

npx @portkey-ai/gateway
2

Verify the Gateway is running

Confirm the API server is live by sending a test request. The Gateway is accessible at http://localhost:8787/v1.

curl http://localhost:8787/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -H 'x-portkey-provider: openai' \
  -H 'Authorization: Bearer your_openai_key' \
  -d '{"model": "gpt-4o-mini", "messages": [{"role": "user", "content": "Hello"}]}'
3

Configure routing and guardrails

Open the Gateway console at http://localhost:8787/public to set up routing configs, enable fallbacks, add guardrails, and create virtual keys that mask your real provider API keys.

4

Add the Gateway as an MCP server in your client configuration

Configure your MCP client to route all LLM and MCP server traffic through the Portkey Gateway. This centralizes auth, logging, and access control.

{
  "mcpServers": {
    "gateway": {
      "command": "npx",
      "args": ["-y", "@portkey-ai/gateway"],
      "env": {
        "PORTKEY_API_KEY": "your_portkey_api_key",
        "OPENAI_API_KEY": "your_openai_key",
        "ANTHROPIC_API_KEY": "your_anthropic_key"
      }
    }
  }
}
5

Set up fallback and retry policies

In the Gateway console or via config, define a routing strategy that automatically falls back to a secondary provider if the primary fails, and retries with exponential backoff on transient errors.

6

Monitor usage and costs

Use the Gateway dashboard to inspect request logs, latency metrics, token usage, and per-provider cost breakdown. This helps identify expensive models and opportunities for caching.

Gateway Examples

Client configuration

Claude Desktop configuration for routing AI requests through the Portkey AI Gateway.

{
  "mcpServers": {
    "gateway": {
      "command": "npx",
      "args": ["-y", "@portkey-ai/gateway"],
      "env": {
        "PORTKEY_API_KEY": "your_portkey_api_key",
        "OPENAI_API_KEY": "your_openai_key",
        "ANTHROPIC_API_KEY": "your_anthropic_key"
      }
    }
  }
}

Prompts to try

Example prompts that leverage the Portkey Gateway's routing and observability capabilities.

- "Route this request to GPT-4o with a fallback to Claude Sonnet if it fails"
- "Show me the token usage and cost breakdown for the last 100 requests through the Gateway"
- "Enable the PII guardrail on all outbound requests to prevent sensitive data leakage"
- "List all virtual keys configured in the Gateway and their associated providers"
- "What was the average latency for requests to Anthropic vs OpenAI this week?"

Troubleshooting Gateway

Gateway returns 'Provider not supported' for a model request

Verify you have set the correct x-portkey-provider header (or PORTKEY_PROVIDER env var) matching the provider name in Portkey's documentation. Also confirm the corresponding API key environment variable is set.

Port 8787 is already in use when starting the Gateway

Set the PORT environment variable to an alternate port before starting: `PORT=9000 npx @portkey-ai/gateway`. Update your MCP client configuration and any direct API calls to use the new port.

Guardrails block legitimate requests unexpectedly

Review the active guardrail rules in the Gateway console at http://localhost:8787/public. Adjust the guardrail thresholds or add exceptions for known-good patterns. Enable debug logging with LOG_LEVEL=debug to see exactly which rule triggered the block.

Frequently Asked Questions about Gateway

What is Gateway?

Gateway is a Model Context Protocol (MCP) server that blazing fast ai gateway with integrated guardrails. route to 1,600+ llms, 50+ ai guardrails with 1 fast & friendly api. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Gateway?

Install via npm with the command: npx -y gateway. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).

Which AI clients work with Gateway?

Gateway works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Gateway free to use?

Yes, Gateway is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Cloud Services MCP Servers

Explore all cloud services servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "gateway": { "command": "npx", "args": ["-y", "gateway"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Gateway?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides