gometap/larai-tracker
最新稳定版本:v1.1.0
Composer 安装命令:
composer require gometap/larai-tracker
包简介
A standalone dashboard to track AI token usage and API costs for Laravel applications.
README 文档
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.
统计信息
- 总下载量: 150
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2026-02-18