gometap/larai-tracker

A standalone dashboard to track AI token usage and API costs for Laravel applications.

Maintainers

Package info

github.com/Gometap/larai-tracker

Language:Blade

pkg:composer/gometap/larai-tracker

Statistics

Installs: 73

Dependents: 0

Suggesters: 0

Stars: 6

Open Issues: 1

v1.0.5 2026-03-17 14:31 UTC

README

Larai Tracker Logo

Larai Tracker ๐Ÿš€

Latest Version on Packagist Total Downloads Tests

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

Dark Preview Light Preview

Logs

Logs Preview

Features

  • ๐Ÿ•ต๏ธ Invisible Tracking: Automatically logs AI responses via Laravel's ResponseReceived event.
  • ๐Ÿ“Š 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):

  1. Database: Change it directly from the Security section in the dashboard settings.
  2. Environment: Set LARAI_TRACKER_PASSWORD in your .env file.
  3. 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.