ACG Docs

Quickstart

Get a public ai-cost-gate instance running in 10 minutes, then point your agents at it.

What you'll run

The public ai-cost-gate instance is a single Docker container backed by a single SQLite file. It exposes:

  • A local OpenAI-compatible proxy on :8080 (configurable). Your agents talk to this endpoint instead of the upstream LLM.
  • A web dashboard on :3000 (configurable) for cost, attribution, and alerts.
  • A read-only internal API at /internal/query/... for tooling.

1. Get the public image

docker pull ghcr.io/costbrake/ai-cost-gate:latest

Or run from source after buying Pro:

git clone https://github.com/CostBrake/ai-cost-gate.git
cd ai-cost-gate
docker compose up

2. Configure

The image reads environment variables for upstream LLM credentials. The minimal set:

UPSTREAM_OPENAI_API_KEY=sk-...
UPSTREAM_ANTHROPIC_API_KEY=sk-ant-...
DATABASE_URL=sqlite:///data/ai-cost-gate.db
ADMIN_TOKEN=change-me

Full list: see Environment.

3. Run

docker run -d \
  --name ai-cost-gate \
  -p 3000:3000 \
  -p 8080:8080 \
  -v $(pwd)/data:/data \
  --env-file .env \
  ghcr.io/costbrake/ai-cost-gate:latest

Dashboard at http://localhost:3000. Proxy on http://localhost:8080.

4. Point an agent at the proxy

Any OpenAI-compatible SDK works. Example with the OpenAI Python SDK:

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8080/v1",
    api_key="not-used-by-the-gateway",
)

resp = client.chat.completions.create(
    model="claude-opus-4-7",
    messages=[{"role": "user", "content": "Hello"}],
    extra_headers={"x-acg-project": "my-app"},
)

The x-acg-project header tags every request so you can attribute cost later.

5. See it in the dashboard

Open http://localhost:3000. You'll see the new request recorded with the project, agent, model, and cost. From there you can drill into attribution, set budgets, and configure auto-stop.

Where to go next

On this page