gometap / larai-tracker
A standalone dashboard to track AI token usage and API costs for Laravel applications.
Requires
- php: ^8.2
- illuminate/support: ^10.0|^11.0|^12.0
Requires (Dev)
- guzzlehttp/guzzle: ^7.0
- orchestra/testbench: ^8.0|^9.0|^10.0
- pestphp/pest: ^2.34|^3.0
- pestphp/pest-plugin-laravel: ^2.3|^3.0
This package is auto-updated.
Last update: 2026-03-17 14:32:55 UTC
README
Larai Tracker ๐
Larai Tracker is a powerful, standalone dashboard for tracking AI token usage and API costs in Laravel applications. It "invisibly" intercepts AI responses via Laravel's native HTTP Client events, meaning it works with OpenAI, Gemini, Azure, and OpenRouter out of the box with zero code changes to your application logic.
Supports Laravel 10, 11, and 12.
Screenshots
Dashboard
Logs
Features
- ๐ต๏ธ Invisible Tracking: Automatically logs AI responses via Laravel's
ResponseReceivedevent. - ๐ Premium Dashboard: Access a high-end AI analytics center at
/larai-tracker. - ๏ฟฝ Singleton Authentication: Secure password-protected dashboard (Config > ENV > DB).
- ๏ฟฝ๐ฐ Cost Calculation: Real-time USD cost estimation for GPT-4o, Gemini Flash, and more.
- ๐ Multi-Provider Support: Seamlessly tracks OpenAI, Azure, Gemini, and OpenRouter.
- โ๏ธ Dynamic Pricing: Sync latest prices or manually override model costs from the UI.
Installation
Install the package via composer:
composer require gometap/larai-tracker
Publish and run the migrations:
php artisan vendor:publish --tag="larai-tracker-migrations"
php artisan migrate
(Optional) Publish the configuration:
php artisan vendor:publish --tag="larai-tracker-config"
Usage
๐ต๏ธ Automatic Tracking
Once installed, the package starts working immediately. Every time your application uses the Laravel Http facade to call an AI provider (OpenAI, Gemini, etc.), Larai Tracker intercepts the response, parses the token usage, and logs it to the database.
๐ Accessing the Dashboard
Navigate to your application's URL at:
https://your-domain.com/larai-tracker
The dashboard features a premium dark-mode interface with:
- Total Investment: Your overall API spent.
- Burn Rate: Today's AI cost.
- Token Metrics: Total computation used.
- Live Stream: A real-time log of the latest AI calls.
Configuration
Authentication (Singleton Auth)
Larai Tracker uses a simple yet secure singleton authentication system. You can set the password in three ways (ordered by priority):
- Database: Change it directly from the Security section in the dashboard settings.
- Environment: Set
LARAI_TRACKER_PASSWORDin your.envfile. - Config: Set it in
config/larai-tracker.php.
If no password is set and you are in a non-local environment, you will be prompted to set up a password upon your first visit.
๐งช Testing
The package includes a comprehensive test suite powered by Pest.
composer test
Contributing
Please see CONTRIBUTING for details.
Credits
License
The Apache License 2.0. Please see License File for more information.