# Claude Code AWS Gateway (CCAG)

> Purpose-built gateway for running Claude Code through Amazon Bedrock. One-command developer onboarding, real-time budget controls, multi-account routing, and a full admin portal.

CCAG presents as the Anthropic Messages API while routing inference through your AWS account. Developers get a single command to connect. Admins get granular controls: per-user/team budgets, multi-account endpoint routing for latency optimization and data sovereignty, OIDC SSO, and real-time analytics. A CLI (`ccag`) enables scripted management for automation.

## Key Details

- Language: Rust
- License: MIT
- Deployment: Docker Compose (evaluation) or AWS CDK (ECS Fargate + RDS)
- Docker image: ghcr.io/antkawam/claude-code-aws-gateway
- CLI binaries: GitHub Releases (linux/macOS/Windows, x86_64/ARM64)
- Claude models supported: Claude 4+ on Bedrock

## Documentation

- [README](https://antkawam.github.io/claude-code-aws-gateway/): Overview, quick start, feature list
- [Getting Started](https://antkawam.github.io/claude-code-aws-gateway/docs/getting-started): Docker Compose and CDK setup
- [Configuration](https://antkawam.github.io/claude-code-aws-gateway/docs/configuration): Environment variables reference
- [Authentication](https://antkawam.github.io/claude-code-aws-gateway/docs/authentication): OIDC SSO setup
- [CLI Reference](https://antkawam.github.io/claude-code-aws-gateway/docs/cli-reference): Management CLI commands
- [CDK Deployment](https://github.com/antkawam/claude-code-aws-gateway/blob/main/infra/README.md): Production AWS deployment guide
- [FAQ](https://antkawam.github.io/claude-code-aws-gateway/docs/faq): Common questions
- [Upgrading](https://antkawam.github.io/claude-code-aws-gateway/docs/upgrading): Version updates and rollback

## Quick Start

```bash
git clone https://github.com/antkawam/claude-code-aws-gateway.git
cd claude-code-aws-gateway
cp .env.example .env    # edit: set AWS_REGION and credentials
docker compose up -d    # gateway at http://localhost:8080
```

Log in at http://localhost:8080/portal, navigate to Connect, and follow the setup script.

## Architecture

Claude Code → CCAG (Anthropic Messages API) → Amazon Bedrock (inference)
                ↕
            Postgres (keys, teams, spend, config)

## Features

- API translation: Anthropic Messages API ↔ Bedrock, SSE streaming, model ID mapping
- Multi-endpoint routing across AWS accounts and regions with per-team assignment
- Routing strategies: sticky user (cache-aware), primary/fallback, round robin
- Cross-account Bedrock access via STS AssumeRole with automatic failover
- Web search: DuckDuckGo (default), Tavily, Serper, or custom provider per user
- Virtual API keys with per-key rate limits
- Teams with shared budgets (daily/weekly/monthly, notify/throttle/block)
- OIDC SSO: Okta, Azure AD, Google, any compliant provider
- Admin portal: embedded SPA with analytics dashboard (spend, activity, models, tools)
- Event notifications via webhook, SNS, or EventBridge (budget alerts, rate limits, system events)
- One-command developer onboarding: portal Connect page generates a setup script
- Developer self-service portal: personal usage metrics, budget consumption, key management
- CLI management tool with self-update from GitHub Releases
- 100% open source, every feature included — no enterprise tier or feature gates
