Quickstart
Self-host AI Cost Gate
Buy Pro once, clone the private runtime, and put a local cost gate in front of your agents — attribution, budgets, and auto-stop without shipping prompts to a metering SaaS.
AI Cost Gate (CostBrake) is a self-hosted, metadata-only LLM cost gateway: Docker Compose brings up a FastAPI gateway (default :8000) and a dashboard (default :3000). Point OpenAI-compatible clients at the gateway with provider/model ids and project/agent metadata.
1. Buy Pro and accept the GitHub invite
Complete the one-time Pro checkout and enter the GitHub username that should receive private collaborator access to CostBrake/ai-cost-gate. Accept the invite before cloning.
2. Clone and start with Docker Compose
Clone the private Pro repo and start both services. SQLite is the default backend — Postgres is optional via ACG_PG_DATABASE_URL.
git clone git@github.com:CostBrake/ai-cost-gate.git cd ai-cost-gate cp .env.example .env # Edit .env if needed — provider keys can also be set in the dashboard after boot docker compose -f infra/docker-compose.yml up -dGateway → http://localhost:8000 · Dashboard → http://localhost:3000
3. Confirm the gateway is healthy
Hit the health endpoint, then open the dashboard to add provider keys and review requests.
curl http://localhost:8000/health # -> {"status":"ok"}4. Point agents at the local OpenAI-compatible base URL
Set client base_url to http://localhost:8000/v1. Choose upstream with model like openai/gpt-4o-mini or anthropic/claude-3-5-sonnet-latest, and pass metadata.project / metadata.agent for attribution.
curl -s http://localhost:8000/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $ACG_API_KEY" \ -d '{ "model": "openai/gpt-4o-mini", "messages": [{"role": "user", "content": "ping"}], "metadata": {"project": "demo", "agent": "quickstart"} }'Use OpenRouter-style model ids (provider/model). Upstream provider keys are configured in the dashboard — do not send them on /v1 requests. If ACG_API_KEY is unset, gateway auth on /v1 is skipped.
5. Set a budget and verify auto-stop
Create a daily/weekly/monthly budget for a noisy agent. When the critical threshold is hit, in-scope requests return HTTP 429 until the period rolls over, the budget is raised, or the event is acknowledged.
Quickstart FAQ
Is this the same as the /docs pages?
No. /docs covers this marketing portal (acg-portal). /quickstart covers the product runtime in CostBrake/ai-cost-gate after you buy Pro.
Do I need Postgres on day one?
No. SQLite is the default. Set ACG_PG_DATABASE_URL only when you want a managed Postgres backend, then run alembic upgrade head before first start.
Can I try the product story without deploying?
Yes. Use the read-only demo at https://demo.aicostgate.com, then buy Pro when you are ready to self-host.
Does AI Cost Gate replace LiteLLM?
No. LiteLLM is a multi-provider router. AI Cost Gate is a local cost gate. Many teams run both. See the compare page.