Skip to content

Get the AI Gateway running locally and deploy it to AWS in under 5 minutes.


A fully operational LLM inference gateway on AWS that:

  • Accepts requests in both OpenAI and Anthropic API formats
  • Routes to multiple model providers (Bedrock, OpenAI, Anthropic, Google, Azure OpenAI)
  • Authenticates callers via Cognito M2M JWT tokens
  • Auto-scales on ECS Fargate behind an Application Load Balancer
  • Collects traces, metrics, and logs via OpenTelemetry

Terminal window
git clone git@github.com:theagenticguy/ai-gateway.git
cd ai-gateway
# Install all tool versions defined in mise.toml
# (Python 3.13, Terraform 1.10.5, lefthook, checkov, trivy, hadolint, gitleaks)
mise install
Terminal window
# Install Python dependencies
uv sync
# Install git hooks (pre-commit, pre-push, commit-msg)
lefthook install
Terminal window
cd infrastructure
terraform init -backend-config=environments/dev.tfvars
Terminal window
terraform plan -var-file=environments/dev.tfvars
Terminal window
terraform apply -var-file=environments/dev.tfvars

After deployment, Terraform outputs the ALB DNS name and Cognito token endpoint. You will need these to:

  1. Get a token — Use scripts/get-gateway-token.sh to obtain a JWT from Cognito
  2. Configure your agent — Point your AI coding agent at the gateway URL
  3. Start routing requests — Send LLM requests through the gateway to any provider

  • Prerequisites — Detailed tool and AWS account requirements
  • Authentication — How Cognito M2M auth works and how to get tokens
  • Agent Setup — Configure Claude Code, OpenCode, Goose, and more