Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Ai Pricing Laravel Package

jkudish/laravel-ai-pricing

A Laravel package for calculating and tracking AI model costs. Define pricing for providers like OpenAI and Anthropic in config, estimate token-based expenses per request, and keep cost logic centralized so you can bill users, monitor spend, or compare models.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Unit economics for AI features. The package pins model pricing to a versioned snapshot (v19 here) and exposes a qualified basis identity — e.g. openrouter:deepseek/deepseek-v4.1-flash-1017-standard-max — so a per-request cost number can be attached to a specific, auditable price definition rather than a live, drifting catalog. That is the input to gross-margin math, credit/pack pricing, and free-tier limits.
  • Model selection and migration calls. Because the snapshot records a canonical model (deepseek/deepseek-v4.1-flash-20261017) alongside its OpenRouter binding, PMs can compare a candidate model against incumbents on a like-for-like cost basis before committing a roadmap slot to a migration.
  • Budget guardrails and spend forecasting. Rate components (input, output, cached input) are broken out, so quota design, per-tenant caps, and alerting thresholds can be modeled rather than guessed.
  • Conservative quoting for contracts and enterprise commitments. Rates are the maximum across the 13 default-routed endpoints, including every quantization and time-of-day override. That is a worst-case basis — the right default for committed spend and fixed-price quotes, deliberately not a best-case headline.
  • Reproducibility of historical quotes. Snapshot versioning plus a retrieval date supports "why did we bill/quote this at that rate" questions after the live catalog has moved.
  • Explicit opt-in posture for edge traffic. The two DeepInfra flex/priority endpoints are excluded from the catalog, so any product surface that depends on those tiers needs a separate decision — a useful forcing function rather than an accident.
  • Change management as a product concern. v0.4.2 makes the generic openrouter:deepseek/deepseek-v4.1-flash-1017 identity fallback-blocked: it can no longer silently resolve to a cheaper live catalog or a vendor headline price. Downstream products must either quote the qualified -standard-max basis (where its conditions hold) or explicitly configure the generic identity. This is exactly the kind of change that should route through a PM-visible release note, not just an engineering ticket.

When to Consider This Package

Consider adoption when:

  • You ship customer-facing AI features on Laravel/PHP and need defensible per-request cost accounting rather than a spreadsheet of vendor list prices.
  • Your pricing, credits, or margin reporting must be reproducible — i.e., you need to explain yesterday's number after the upstream catalog changed.
  • You route through an aggregator (OpenRouter here) where the same model has many endpoints, quantizations, and time-of-day overrides, and you want a documented rule for which of those you bill against.
  • You want the conservative number by default: worst-case-over-endpoints is the correct bias for caps, commitments, and margin floors.
  • You are willing to accept a periodic re-review obligation — the release itself flags "re-review on endpoint churn," which is an honest statement of the maintenance cost.

Look elsewhere, or scope carefully, when:

  • You need full cost coverage. Batch, opt-in service tiers, cache writes, and server tools are explicitly not covered. If your product depends on batch discounts or tiered service levels, this snapshot will overstate or misattribute cost on those paths — a real under-billing risk if you invert the numbers into customer invoices.
  • You need best-case/tightest price. Max-over-endpoints is intentionally pessimistic; latency- or cost-optimized routing that usually lands on a cheaper endpoint will look worse here than reality.
  • You depend on implicit fallback resolution. Any code relying on the generic identity to resolve to a live catalog price is a breaking change as of v0.4.2. Migrate to the qualified basis or configure the generic identity explicitly before upgrading.
  • You need multi-vendor breadth today. Coverage is per-bound-basis and per-snapshot; a multi-provider strategy that includes Portkey headline pricing is explicitly out of scope for this basis.
  • You want a managed pricing-data service. This is a package you operate, with a snapshot refresh cadence you own.

How to Pitch It (Stakeholders)

For executives (one paragraph). We are adopting a small Laravel package that turns "what does an AI request cost us?" into a versioned, auditable number instead of a vendor marketing figure. It pins model pricing to a dated snapshot, quotes against a named basis so the figure is reproducible, and deliberately uses the highest rate across routing endpoints — meaning our margin and budget models will be conservative, not flattering. The trade-off is bounded and known: batch pricing, opt-in service tiers, cache writes, and server tools are not covered, and the snapshot must be re-reviewed when the upstream endpoint list changes. The latest release is a pricing snapshot plus one governance change that blocks silent price fallback — a safety improvement, but it needs a short migration before we upgrade.

For engineering (one paragraph). Integrate against the qualified basis identity (openrouter:deepseek/deepseek-v4.1-flash-1017-standard-max) for anything that meters, quotes, or caps spend; treat the generic identity as requiring explicit configuration. v0.4.2 is a behavioral change, not just a data refresh: the generic identity is fallback-blocked and the -standard-max basis is itself fallback-blocked and not an alias, so no silent resolution will occur. Budget for a migration pass, an assertion that cost lookups fail loudly rather than defaulting, and a recurring re-review trigger tied to endpoint churn. Do not derive customer-facing invoices for batch or tiered traffic from this snapshot until coverage is confirmed.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource