USAIGE: FinOps for the Laravel AI SDK
Your AI feature has a margin, and right now you can’t see it — USAIGE turns every agent call into a costed line item.
Paul Redmond covered USAIGE, a package that records every Laravel AI SDK request as a "run" with token counts, USD cost to sub-cent precision, provider, timing, and error status. It needs <code>laravel/ai ^0.8.1</code>. Two helpers — <code>ai_run()</code> and <code>ai_usage()</code> — auto-detect responses from the SDK, the OpenAI PHP SDK, or plain arrays, with pluggable user resolvers, JSON metadata, and a dashboard at <code>/usaige</code>. Notably, no budget caps or spend alerts.
Cost per agent isn’t a nice-to-have — it’s the denominator of your pricing. Ship an AI feature without per-user, per-tenant cost attribution and you’re flying blind on whether each customer is profitable, finding out at month-end on the invoice. USAIGE makes that attribution a few lines instead of a side project.
Build-vs-buy, and I’d buy the recording half tomorrow. I already track cost per agent across Kai, Sol and HelpMatch — it’s how I know which client conversations earn their keep. What’s conspicuously missing is the control layer: recording spend after the fact tells you the house burned down. I want a budget cap that refuses or downgrades the call when a tenant blows their allowance, plus alerting. Great v1 — but <code>/usaige</code> is a dashboard, not a guardrail.
EC TV is written by Eduardo Cruz — a senior Laravel engineer who ships production AI agents and MCP servers.
Work with me → Read the deep-dives