[api] AIN-299 W5: public live counter (aggregate-only)#91
Conversation
GET /v1/stats/public/counter · 60s cache · 3 fields + Decimal cost. NO PII (3 unit tests). AIN-293 Slack code-only deferred to post-Spark. 7 tests pass. pre-commit clean. Refs: AIN-299 · §D3 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
AIN-299 [Marketing] Live public audit counter — ainfera.ai transparency surface (eat-our-own-cooking)
Live public audit counter — eat-our-own-cooking transparency surfacePolsia-style transparency move on Ainfera's terrain. Free positioning, single Aulë day, no critical path. WhatComponent on
Display in dark mode (Brand v1.3: #070B14 bg · #E8EDF5 ink · #4D95E8 accent · IBM Plex Sans 500). WhyPerplexity external pressure-test 2026-05-28 surfaced this as the highest-extraction insight: Ainfera's Eat-our-own-cooking corollary: routing 100% of internal LLM calls (fleet + Aulë IDE) through ainfera-inference is already locked. Surfacing the audit publicly = marketing for free. Scope
Acceptance
Apply windowPost-Spark migration (Week of 2026-06-08+). Not on critical path. Single Aulë day once daily cadence is stable. Linked
SourceExternal pressure-test 2026-05-28 (Perplexity analysis) — sole actionable extraction. Other Perplexity recommendations (local Qwen judge, α=25%, agentium.yaml) rejected for lock conflicts. |
…l cache Refs: AIN-299 W5 follow-up Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
GET /v1/stats/public/counter — 4 aggregate fields, 60s cache, NO PII (3 unit tests enforce). AIN-293 Slack code deferred to post-Spark Fri.
Note
Medium Risk
New unauthenticated public endpoint reads production aggregates (routing, agents, cost); privacy is schema- and test-guarded but cache is per-process only until multi-worker scaling.
Overview
Adds a public
GET /v1/stats/public/counterendpoint on the existing stats router so the marketing site can poll aggregate-only live metrics: routed decisions (lifetime and 24h,cheapest_clearing_flooronrouting_outcomes), active agents, and cumulative succeeded inference cost in USD.Responses are built from a single multi-subquery SQL read, wrapped in a
CounterResponseschema withfetched_atandcache_ttl_sec. A 60-second in-process cache limits DB load under frequent polling; module notes call out single-worker behavior and a future Redis/shared cache if the API scales out.Privacy is explicit in the API contract (no agent/tenant/per-row IDs).
tests/unit/test_audit_counter_no_pii.pylocks schema fields, types, and absence of UUID-shaped strings in JSON. The OpenAPI v1 contract smoke test now expects this route.Reviewed by Cursor Bugbot for commit 13805df. Bugbot is set up for automated code reviews on this repo. Configure here.