Deployment Options
The AI Gateway can be deployed in multiple ways to suit your infrastructure needs:NPM/Bun
Quick local development
Docker
Containerized deployment
Node.js Server
Self-hosted production server
Cloudflare Workers
Edge deployment
Kubernetes
Scalable orchestration
Cloud Providers
AWS, Azure, GCP
For a fully managed solution without infrastructure concerns, consider Portkey’s hosted gateway which processes billions of tokens daily in production.
Quick Start (npx)
The fastest way to get started:1
Run with npx
No installation required - just run:Or with Bun:
2
Verify it's running
The gateway starts on port 8787:You should see:
- API:
http://localhost:8787/v1 - Console:
http://localhost:8787/public/
AI Gateway says hey!3
Make your first request
Now follow the quickstart guide to make your first API call.
Docker
Deploy using Docker for containerized production environments.1
Run with Docker
Pull and run the latest image from Docker Hub:
The gateway is now running at
http://localhost:87872
Run with environment variables
Pass configuration via environment variables:
3
Build from source (optional)
Clone the repository and build your own image:
Docker Compose
For multi-container setups with Redis caching:1
Download docker-compose.yaml
2
Start the services
- AI Gateway on port 8787
- Redis for caching (if configured)
3
View logs
4
Stop the services
The Docker image is built from the Dockerfile which uses a multi-stage build for optimal size.
Node.js Server
Run the gateway as a standalone Node.js application.1
Clone the repository
2
Install dependencies
3
Build the project
4
Start the server
5
Configure (optional)
Create a
conf.json file to customize settings. See conf_sample.json for available options.You can also use environment variables:Running as a Service
Create a systemd service file for production:/etc/systemd/system/portkey-gateway.service
Cloudflare Workers
Deploy to Cloudflare’s edge network for low-latency global distribution.1
Clone and setup
2
Configure Wrangler
Make sure you have the Wrangler CLI installed and authenticated:
3
Deploy to Cloudflare
4
Get your worker URL
Wrangler will output your worker URL:
Cloudflare Workers have request limits on the free tier. Consider upgrading for production use.
Kubernetes
Deploy to Kubernetes for production-grade orchestration.1
Create deployment manifest
Create
deployment.yaml:2
Apply to cluster
3
Verify deployment
4
Access the gateway
Get the external IP:
AWS EC2
Quick deployment to AWS EC2 using CloudFormation.1
2
Configure parameters
Set:
- VPC ID
- Subnet ID
- Instance Type (t2.micro for testing, t3.small for production)
3
Launch stack
CloudFormation will:
- Launch an EC2 instance
- Install Docker
- Run the gateway container
- Configure security groups (port 8787)
4
Access your gateway
Get the public DNS from CloudFormation outputs:
Other Platforms
Replit
Deploy with one click:Zeabur
Use the template:Azure, GCP, OpenShift
For enterprise deployments on:- Azure
- Google Cloud Platform
- Red Hat OpenShift
- Other cloud providers
Configuration
Environment Variables
Common configuration options:Configuration File
Createconf.json for advanced settings:
conf_sample.json in the repository for all available options.
Verification
After installation, verify your deployment:1
Health check
AI Gateway says hey!2
Test API endpoint
3
Check the console
Open
http://localhost:8787/public/ to view the web console.Next Steps
Make Your First Request
Follow the quickstart to make your first API call
Configure Routing
Learn about routing, fallbacks, and load balancing
Add Guardrails
Protect your AI apps with input/output validation
Production Deployment
Best practices for production deployments
Need help? Join our Discord community or check the GitHub repository.