# portkey-ai/gateway

> gateway is an open-source AI gateway that lets an application send requests to more than 250 LLMs through one API. It takes client prompts and provider configuration, applies routing and reliability rules and guardrails, and returns streamed model responses. It is written in TypeScript and runs on Node.js.

Source: https://github.com/portkey-ai/gateway
Indexed: commit 669825c on 2026-09-29 by Repowise. Facts come from the source and git history, not from the maintainer.

## Facts

- Type: App
- Language: TypeScript
- Stars: 13,384 at index time
- License: MIT
- Code health: 7.5/10, Good
- Last commit: 2026-05-19
- Contributors: 133

## Install

From the README: https://github.com/portkey-ai/gateway#quickstart-2-mins

Run the gateway locally, which needs Node.js and npm.
    npx @portkey-ai/gateway

## How it works

Requests from an application enter through the server that src/start-server.ts starts, and src/index.ts is the top-level entry point. src/globals.ts is where gateway-wide behavior is set up once and made available to the rest of the codebase. Guardrails are implemented in the plugins directory, where plugins/default holds constraint logic that can be applied to request content and metadata regardless of which provider receives the request. plugins/bedrock/type.ts defines the action model used to guard chat completions, with ContentPolicy extending BedrockAction. plugins/pillar contains scan logic for detecting risky content in prompts and responses, and the output is the streamed model response returned to the application.

- cookbook/integrations/vercel/app/examples/basic-chatbot/page.tsx: entry point
- cookbook/integrations/vercel/app/examples/generate-text/action.ts: entry point
- cookbook/integrations/vercel/app/examples/generate-text/conditional-routing.ts: entry point
- cookbook/integrations/vercel/app/examples/generate-text/fallback.ts: entry point
- cookbook/integrations/vercel/app/examples/generate-text/guardrails.ts: entry point
Modules: src, plugins, cookbook, tests, root. 661 files, 66,267 lines, 2,373 symbols.

## Code health

- Score: 7.5/10 (Good)
- Rank: #112 of 4,000+ indexed repos
- Hotspots: none
- Lowest file: src/handlers/handlerUtils.ts
- Dead code: 114 findings

## Maintenance

- Last commit 2026-05-19, first commit 2023-08-23, 3,457 commits
- 133 contributors, bus factor 4

## Security

- Security findings are shown to signed-in users at https://repowise.dev/repo/portkey-ai/gateway/security

## More

- Page: https://repowise.dev/repo/portkey-ai/gateway
- Ask this codebase: https://repowise.dev/repo/portkey-ai/gateway/chat
- Docs: https://repowise.dev/repo/portkey-ai/gateway/docs
- MCP (signs in with Repowise on first use):
    claude mcp add --transport http repowise https://api.repowise.dev/mcp/portkey-ai/gateway
