Quickstart
Quickstart
This path gets an existing Laravel app from zero to a metered AI ledger.
- Require the package
composer require padosoft/laravel-ai-finops - Publish configuration and migrations
php artisan vendor:publish --tag=ai-finops-config php artisan vendor:publish --tag=ai-finops-migrations - Run migrations
php artisan migrate - Make a
laravel/aicall
Existing calls are captured by the package listener when metering is enabled. - Inspect usage
php artisan ai-finops:report --days=1
Budget
Trace
use Padosoft\LaravelAiFinOps\Models\Budget;
Budget::create([
'name' => 'Monthly AI cap',
'scope_type' => 'global',
'limit_amount' => 500,
'currency' => 'USD',
'period' => 'monthly',
'soft_limit_pct' => 80,
'hard' => true,
]);
app(\Padosoft\LaravelAiFinOps\Support\TraceContext::class)->within(
[
'trace_id' => (string) $runId,
'agent_step' => 'summarize',
'tenant_id' => (string) $tenantId,
],
fn () => $agent->respond($prompt),
);
Pre-flight estimates
Reactive hard-budget enforcement blocks once the stored spend is already at or above the hard limit. Use POST /api/ai-finops/diagnostics/estimate when you need to check whether the next planned call would exceed a cap.