Enterprise gateway proxy metering model token usage across OpenAI, Anthropic, and Gemini with dynamic team budget controls.
- Production Resilience: Engineered with decoupled interfaces, structured exception trees, and strict typings.
- High Concurrency Ready: Built to eliminate latency bottlenecks, memory spikes, and race conditions.
- Enterprise Standards: Zero-dependency core logic with clean service provider adapters.
- Full Observability: Embedded metrics telemetry and structured contextual logging.
graph TD
Client[Incoming Event / API Trigger] --> Gate[Input Validation & Policy Guard]
Gate --> CoreEngine[TokenMeter: Enterprise LLM Cost & Quota Proxy]
CoreEngine --> Adapter[External Storage / Cluster / State Provider]
CoreEngine --> Observer[Telemetry & Audit Logger]
- PHP:
^8.2or later - Composer: Modern Composer v2+
composer require smit-backend/llm-token-cost-telemetryPublish configuration and default assets:
php artisan vendor:publish --tag="llm-token-cost-telemetry-config"Sample configuration excerpt (config/llm-token-cost-telemetry.php):
return [
'enabled' => env('LLM_TOKEN_COST_TELEMETRY_ENABLED', true),
'timeout' => env('LLM_TOKEN_COST_TELEMETRY_TIMEOUT', 30),
'log_channel' => env('LLM_TOKEN_COST_TELEMETRY_LOG', 'stack'),
];Run test suites locally:
composer testIf you discover any security-related issues, please open an issue or email directly via GitHub. Contributions via pull requests are always welcome!
This package is open-sourced software licensed under the MIT License.
Developed and maintained with ❤️ by smit-backend.