1. Go to this page and download the library: Download backtik-ch/laravel-ai-usage library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$log = AiUsageLog::find(1);
echo $log->estimated_cost; // e.g. 0.003450
use BacktikCh\LaravelAiUsage\Filament\AiUsagePlugin;
public function panel(Panel $panel): Panel
{
return $panel
// ...
->plugin(AiUsagePlugin::make());
}
use BacktikCh\LaravelAiUsage\Filament\Widgets\AiUsageSummaryWidget;
protected function getHeaderWidgets(): array
{
return [AiUsageSummaryWidget::class];
}