aaix / laravel-ai-costs
Cost tracking for Laravel AI agents. Calculates API costs from usage metadata across providers.
v1.0.1
2026-05-01 22:31 UTC
Requires
- php: ^8.2
- illuminate/http: >=11.0
- illuminate/support: >=11.0
- laravel/ai: ^0
This package is auto-updated.
Last update: 2026-05-01 22:48:51 UTC
README
Laravel AI Costs
Cost tracking for Laravel AI agents. Calculates API costs from usage metadata across providers.
Zero-config cost calculation for Laravel AI responses. Pricing for 2,600+ models is resolved from the LiteLLM database (cached daily); local overrides take precedence.
composer require aaix/laravel-ai-costs
use Aaix\LaravelAiCosts\Concerns\TracksAiCost; class MyAgent implements \Laravel\Ai\Contracts\Agent { use TracksAiCost; // replaces Promptable } $agent = MyAgent::make(); $agent->prompt('...'); $agent->lastCost()->totalCostUsd; // 0.000345 $agent->totalCostUsd(); // sum across all prompts on this instance
Documentation
Full guide and API reference: aaix.github.io/laravel-ai-costs