You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Admin][API] Meter platform-paid AI into the ledger (embeddings/summaries/translation) #44
Follow-up split from #32 (PR #43). The platform-paid env.AI calls are not written to ai_usage, so platform spend is invisible in-app.
Instrument the platform call sites to ledger with provider="platform" + a CF Workers-AI neuron cost estimate (label it an estimate):
agent-storage.ts embeddings (@cf/baai/bge-base-en-v1.5, ~line 345) and conversation summary (~line 988) — needs the acting/owner userId threaded into the DO storage engine (getStorageEngine).
routes/instances-translation.ts platform path (has session.uid; the CF .run returns no token usage → estimate tokens from text length).
Add a CF-neuron estimator to lib/ai-pricing.ts so platform CF rows carry non-zero cost (BYOK-CF stays estimate-free — user pays CF directly).
Once done, /v1/admin/spendingplatformPaid.metered flips true and the split in aggregateAdminUsage (already provider-aware, PLATFORM_PROVIDER) populates automatically.
Part of the PAGS Admin Portal epic (#27). Depends on #28.
Activity
feat(admin): meter platform-paid AI into the ledger (#44)
serge-ivo commentedon Aug 1, 2026
Done — landed on
mainas 8ea80e2.feat(admin): admin SPA served at /admin (#29, #35)