Download the PHP package mohammed94/ai-ledger without Composer
On this page you can find all versions of the php package mohammed94/ai-ledger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mohammed94/ai-ledger
More information about mohammed94/ai-ledger
Files in mohammed94/ai-ledger
Package ai-ledger
Short Description Cost & observability ledger for AI/LLM calls in Laravel — track tokens, dollar cost, latency and budgets across Prism, the official Laravel AI SDK, OpenAI and Anthropic.
License MIT
Homepage https://github.com/mohammed1981994/ai-ledger
Informations about the package ai-ledger
AI Ledger
The cost & observability meter for every AI/LLM call in your Laravel app — tokens, dollar cost, latency and budgets, across Prism, the official Laravel AI SDK, OpenAI and Anthropic.
Most teams ship AI features blind: nobody knows which feature — or which user — is burning the OpenAI bill until it arrives. AI Ledger is the meter for your app's AI usage. One call records a trace; you get spend reports, per-user / per-feature attribution, and budget guards that can stop a request before it blows the budget.
Why it exists: Prism, the most popular Laravel AI package, ships no built-in observability. AI Ledger fills that gap and stays provider-agnostic.
Features
- 💵 Dollar cost per call from a configurable pricing table (OpenAI, Anthropic, Gemini, …)
- 🔌 Provider-agnostic — works with Prism, the Laravel AI SDK, the OpenAI/Anthropic SDKs, or anything, through one
record()call - 🏷️ Attribution by user, tenant and feature tag — answer "who is spending my AI budget?"
- 📊 Spend reports — today, this month, by model, by user, by tag
- 🛡️ Budget guards — know when you're over budget and block calls before they cost money
- 🔒 PII-safe — prompt/response content is not stored unless you opt in
Installation
Usage
Record a call (any provider)
Record straight from a provider response
recordUsage() understands the usage payloads returned by Prism, the Laravel AI SDK and the OpenAI/Anthropic SDKs — no manual token counting:
Spend reports
Budget guards
Set ceilings in config (or via AI_LEDGER_BUDGET_MONTHLY), then gate expensive calls:
Configuration
The published config/ai-ledger.php holds the pricing table, budgets, store driver and PII switch:
Roadmap
- [ ] Filament dashboard plugin (charts: spend over time, by model, by user)
- [ ] Auto-capture via Prism events (zero call-site changes)
- [ ] Slack / mail alerts on budget thresholds (80% / 100%)
- [ ] Prompt-caching savings tracking
Testing
License
The MIT License (MIT). See LICENSE.
All versions of ai-ledger with dependencies
illuminate/contracts Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0