PHPackages                             aaix/laravel-ai-costs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. aaix/laravel-ai-costs

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

aaix/laravel-ai-costs
=====================

Cost tracking for Laravel AI agents. Calculates API costs from usage metadata across providers.

v1.0.1(1mo ago)174MITPHPPHP ^8.2CI passing

Since Apr 13Pushed 1mo agoCompare

[ Source](https://github.com/jonaaix/laravel-ai-costs)[ Packagist](https://packagist.org/packages/aaix/laravel-ai-costs)[ RSS](/packages/aaix-laravel-ai-costs/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

 [ ![Laravel AI Costs Logo](https://camo.githubusercontent.com/d8106c95cba1f65fa4d0171e65507c8fb438b7590d33735a98d89a413eb8c001/68747470733a2f2f6a6f6e616169782e6769746875622e696f2f6c61726176656c2d61692d636f7374732f6c6f676f2e77656270) ](https://github.com/aaix/laravel-ai-costs)

Laravel AI Costs
================

[](#laravel-ai-costs)

Cost tracking for [Laravel AI](https://laravel.com/docs/ai-sdk) agents. Calculates API costs from usage metadata across providers.

 [![Latest Version on Packagist](https://camo.githubusercontent.com/0179fef9163a552bb3466c0d4563b470420964472800b7ebfaa513dbf24de814/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616169782f6c61726176656c2d61692d636f7374732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aaix/laravel-ai-costs) [![Total Downloads](https://camo.githubusercontent.com/8b34fc536d81648ddcef4df54f307318fa5a6ad6c768795badae98734cd28c80/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616169782f6c61726176656c2d61692d636f7374732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aaix/laravel-ai-costs) [![License](https://camo.githubusercontent.com/9a7a95b78749638758f179e6d048a3cfc0e1bc221415eac5968cc005846cf404/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616169782f6c61726176656c2d61692d636f7374732e7376673f7374796c653d666c61742d737175617265)](https://github.com/aaix/laravel-ai-costs/blob/main/LICENSE)

---

Zero-config cost calculation for [Laravel AI](https://laravel.com/docs/ai-sdk) responses. Pricing for **2,600+ models** is resolved from the [LiteLLM](https://github.com/BerriAI/litellm) database (cached daily); local overrides take precedence.

```
composer require aaix/laravel-ai-costs
```

```
use Aaix\LaravelAiCosts\Concerns\TracksAiCost;

class MyAgent implements \Laravel\Ai\Contracts\Agent
{
    use TracksAiCost; // replaces Promptable
}

$agent = MyAgent::make();
$agent->prompt('...');

$agent->lastCost()->totalCostUsd; // 0.000345
$agent->totalCostUsd();           // sum across all prompts on this instance
```

Documentation
-------------

[](#documentation)

Full guide and API reference: **[aaix.github.io/laravel-ai-costs](https://aaix.github.io/laravel-ai-costs/)**

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance92

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~18 days

Total

2

Last Release

39d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8d8ec042829e0d4060243b6c1067768dd31773ace52982c6ac4a4fbef207cbfd?d=identicon)[aaix](/maintainers/aaix)

---

Top Contributors

[![jonaaix](https://avatars.githubusercontent.com/u/15804690?v=4)](https://github.com/jonaaix "jonaaix (7 commits)")

### Embed Badge

![Health badge](/badges/aaix-laravel-ai-costs/health.svg)

```
[![Health](https://phpackages.com/badges/aaix-laravel-ai-costs/health.svg)](https://phpackages.com/packages/aaix-laravel-ai-costs)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[spatie/laravel-export

Create a static site bundle from a Laravel app

670139.5k6](/packages/spatie-laravel-export)[zidbih/laravel-deadlock

Make temporary Laravel workarounds expire and fail CI when ignored.

954.0k](/packages/zidbih-laravel-deadlock)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
