nyami.fr

/ en / work / cost-observability

Cost Observability — this site, live

How I run agentic AI on a $5/day budget — with a public kill switch

→ Business impact: AI budget controlled to the cent: per-visitor / per-session / site caps, hard kill switch, public costs on /eval.

Client
nyami.fr — this site
Role
Architect & operator
Period
2026
Status
live

Business context

A public agent wired to a paid LLM is an open credit card on the internet. Here, cost control is the product — running live on this site.

Constraints

  • Structurally capped budget
  • Zero spend without a verified quota
  • Public transparency
  • Free edge worker, no dedicated database

Architecture

Anonymised architecture diagram — cost-observability

Architecture diagram — anonymised

Components: Cloudflare Workers · KV · TypeScript · SSE

Control workflow

Every request passes the caps (visitor, session, site) BEFORE the LLM call; every run is accounted; counters feed the public dashboard and the kill switch.

Key architecture decisions

  • Quotas consumed before spend — a provider failure never refunds the slot
  • Multi-level kill switch (auto day/month + manual)
  • Transparency by default: spend and state are public

My contribution

  • Full architecture and implementation
  • Per-visitor-tier cost policy
  • Public dashboard and no-auth endpoint

Outcomes

  • Structural $5/day cap
  • Cost per answer (~$0.0003) shown to the visitor
  • Verifiable by anyone, live

Confidentiality

Everything is public — /eval and the cost endpoint are open.

Learnings

  • A cost constraint becomes a product argument when it is visible.
  • Pre-spend guardrails are the only guaranteed ones.

🚧 V-next — already in the works

This system ships continuously — the next stages are already on the bench. Come back to check the status, or ask the agent where it stands.

  • Multi-model routing — planned for V1.1.
  • Multi-threshold email alerts — activation under way.
  • Hardened real-time counter aggregation — V1.1.
Follow the progress live →