coloa

Cost optimization

Why: surprise bills are a top pain point (Vercel $400–$4,941 overages, €54k Firebase bill in 13 hours, Replit $250 → $1,000). Coloa’s advantage: every request, query, external call and LLM call passes through it, so it can measure and control cost precisely.

Four layers: see → prevent → optimize automatically → recommend.

1. See: cost per request

Attribution by app, route, function, team, environment, tenant, and AI agent.

$ coloa cost --app shop-app --month
  GET /api/products                 1,240,000 VND   38%   ← 12 DB queries/request
  POST /api/checkout                  610,000       19%
  reporting (microVM, always on)      890,000       27%   ← 4% CPU average
  preview envs (7 idle > 3 days)      320,000       10%
  storage + egress                    190,000        6%
  total 3,250,000 · forecast 3,900,000 (budget 5,000,000 ✓)

(Illustrative figures.) Includes LLM token spend (OpenAI/Anthropic/Gemini calls go through the gateway) per feature, user and agent.

2. Prevent

Feature What it does
Hard budget caps Per app/team/env; read_only / pause / throttle / notify
Spike detection “Traffic 40× in 10 min, 92% from 3 IP ranges, likely bots” → auto rate-limit while a human decides
Pre-deploy cost check Flags N+1 queries, estimates monthly cost delta; agent fixes before deploy
Agent spend limits Token budget per task/day per agent

3. Optimize automatically

4. Recommend: AI cost advisor

Uses Postgres-proxy query visibility:

$ coloa cost advise
 1. Add index on orders(owner, created_at)    ~450k VND/mo, faster p95
 2. /api/products: cache 60s                  ~900k VND/mo
 3. reporting → scheduled job (2×/day)        ~700k VND/mo
 4. LLM: smaller model passed eval 97%        ~1.2M VND/mo
 [apply 1-3 as a pull request?]

Advisor opens a PR that goes through preview → approval → prod.

For managers and finance

Coloa’s own pricing

Stages

Status (2026-11-29): MVP row done; v2 done except right-sizing; v3 advisor done without automatic PRs, model routing or unit economics. See 09-implementation.md.

Stage Features
MVP Usage per app/function, hard caps, scale to zero, idle-preview cleanup, LLM token tracking
v2 Pre-deploy cost check, spike/bot detection, right-sizing, per-team costs
v3 AI advisor with auto PRs, index/caching suggestions, model routing, unit economics