spaanproductions/laravel-ai-usage
A Laravel package for tracking AI model usage, token consumption, and costs across your application. It helps log requests from AI providers, monitor spending, and gain visibility into usage through a simple, configurable integration.
ai_usage_records and ai_usage_budget_alerts tables supports the "buy/adopt" side of the decision: instead of building internal token-accounting, per-tenant quota tracking, and alert plumbing, the team adopts a package and spends the saved engineering time on the actual product surface (dashboards, customer-facing usage views, billing integration).ai-usage-migrations tag after an update previously copied every migration again under a new date, so migrate failed on pre-existing tables. The release now publishes only new migrations. This is a reminder to treat migration publishing as a controlled operational step, not an ad-hoc command.create_ai_usage_records_table and create_ai_usage_budget_alerts_table migrations if you followed the v0.1.4 upgrade note), the package is early-stage. That informs whether to adopt now for internal tooling versus wait for a 1.0 before putting it on a revenue-critical path.Consider adoption when:
migrate runs should pause.Look elsewhere — or build in-house — when:
Practical adoption gate: pin the version, run the publish-and-migrate step on a disposable branch first, review the generated migration files, and document the upgrade procedure in your runbook so the v0.1.6 class of duplication issue does not reach staging.
For executives: This is a small, focused Laravel package that gives us the database foundation for tracking AI usage and enforcing budget alerts. It converts a would-be internal build — schema design, migrations, alert plumbing — into an adoption decision, so we can stand up cost visibility and spend controls in days rather than a sprint. The trade-off is maturity: it is pre-1.0, and the latest patch fixes a migration re-publishing bug that could otherwise cause failed deploys. Recommended posture is to pilot it on internal cost dashboards now, keep it off the billing critical path, and revisit a 1.0 commitment once the API stabilizes.
For engineering: v0.1.6 makes vendor:publish --tag=ai-usage-migrations incremental — it now copies only new migrations instead of re-copying every file under a fresh timestamp, which previously broke migrate with "table already exists." If you upgraded through v0.1.4, manually delete the duplicated create_ai_usage_records_table and create_ai_usage_budget_alerts_table migrations that have not yet run. Pin the version, publish and migrate on a throwaway branch first, and add the publish step to the upgrade runbook. Expect further churn at 0.1.x; keep an abstraction boundary around usage writes so a swap stays cheap.
What we are asking for: approval to pilot the package for internal AI usage and budget reporting, with the explicit understanding that it is a v0.x dependency, that migration publishing is a reviewed operational step, and that billing integration remains out of scope until the package reaches a stable release.
How can I help you explore Laravel packages today?