Attributing AI Gateway Spend by Service Using Stateful Actors
An AI gateway bill shows total spend but not which service, environment, or tenant caused a sudden rise, which matters when several applications share one gateway. Attribution Wheel, an open-source TypeScript sample running on Telnyx Edge Compute, addresses this by attaching metadata such as service, environment, and tenant to each request via the x-ltg-metadata header. It groups spend by these dimensions, stores one daily ledger row per service, and compares each service against its own seven-day baseline. When a new anomaly appears, the system can send an SMS alert to an on-call number. The design uses one Stateful Actor per AI Gateway token group, a SQL ledger keyed by date and service to prevent duplicate rows, and a demo mode for testing without real traffic or alerts.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in