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

Anthropic Token Usage Bundle Laravel Package

tourze/anthropic-token-usage-bundle

A Symfony bundle for tracking Anthropic API token usage. Monitor consumption, understand cost patterns, and surface usage insights with simple configuration, making it easier to manage AI budgets, optimize prompts, and integrate token accounting into Tourze projects.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy for AI cost telemetry. This package addresses a narrow but recurring need: capturing Anthropic API token consumption (input/output tokens per request) so a product can attribute, display, or bill against it. The buy case is real if your team has no instrumentation layer yet; the build case strengthens the moment you need tenant-level invoicing, custom pricing tiers, or reconciliation against Anthropic's own usage exports.
  • Feature: usage dashboards and spend caps. Token usage records are the prerequisite for per-user, per-workspace, or per-API-key quotas and soft/hard limits. If a paid tier is gated on message volume or token budget, this is the data plane behind it.
  • Feature: margin visibility on AI-powered tiers. Without per-request token accounting you cannot compute gross margin per plan. This informs whether an "unlimited" tier is viable or must be re-scoped to credits.
  • Roadmap sequencing input. A working token-metering path lets you sequence monetization (credits, overage, seat + usage hybrid) after instrumentation rather than before it. It also de-risks later pricing experiments, since historical usage data exists to model them.
  • Internal cost governance. Even absent customer-facing billing, the same data supports internal budget alerts and vendor-spend review — useful for finance and platform-ops stakeholders.
  • Not a decision input for: prompt quality, model routing/fallback strategy, or provider abstraction. This is a metering concern, not an orchestration one.

On the 1.0.2 release: the published notes are an empty changelog diff link (v1.0.1...v1.0.2) with no described changes. Treat this as a maintenance-level patch. There is no evidence of new capability, breaking change, or deprecation, so nothing in the assessment pivots on it — but it also means the release carries no affirmative signal about project health.

When to Consider This Package

Adopt or prototype when:

  • You are running Anthropic models in production and have no per-request token accounting today; the fastest path to a usage number is often an existing collector rather than a bespoke migration plus backfill.
  • Your metering needs are coarse — totals per user/organization/day are enough for dashboards, quotas, or internal reporting.
  • You are comfortable with an early-stage dependency. A 1.0.x version line with a vendor that publishes many small bundles implies a fast-moving, low-ceremony API surface. Pin versions, wrap the integration behind your own interface, and assume you may need to fork or replace it.
  • The cost of being wrong is low: if you swap the collector in six months, you lose a thin adapter, not a system of record.

Look elsewhere or build in-house when:

  • You need auditable, invoice-grade billing. Money movement demands idempotent writes, immutable ledgers, currency/tax handling, and reconciliation against the provider's billing API — none of which a token-usage bundle is positioned to guarantee.
  • You need streaming and tool-use token accounting done precisely, including cache-read/cache-write token classes and thinking tokens. Confirm the package distinguishes these; if not, your margin math will be wrong in exactly the cases that matter.
  • You need provider neutrality. If Claude is one of several models, a single-provider bundle becomes a second metering path to maintain. Prefer a gateway or an internal abstraction that normalizes usage events.
  • Your compliance posture requires provenance: SLAs, security review, active maintainer responsiveness, and a documented release process. An unexplained patch release is a mild yellow flag against that bar.
  • The package duplicates something you already own — many LLM gateways and observability tools already emit token counters; adding a collector creates a second source of truth.

How to Pitch It (Stakeholders)

For executives — one paragraph. We can now measure what each AI request actually costs in Anthropic tokens, which is the missing input for pricing, packaging, and margin decisions on the AI features. The integration is small and low-risk, it does not touch the customer-facing path, and the release we are reviewing is a maintenance patch with no breaking changes. The recommendation is a short, time-boxed spike behind an internal interface — not a committed vendor dependency — so we get the usage data we need to price the product without betting the roadmap on an immature library. Expected cost: a few engineering days. Expected value: the ability to answer "what does this feature cost per customer," which we currently cannot.

For engineering. It is a thin metering adapter, version-pinned at 1.0.x. Wrap it — do not call it directly from controllers or jobs — so we retain the option to replace or fork it. Two things to verify during the spike: (1) does it capture the full token taxonomy (input, output, cache read/write, tool use), and (2) what is the write path and failure mode if the sink is unavailable. If either answer is weak, we fall back to emitting our own usage events from the gateway layer, and the spike still pays for itself by defining the schema.

Decision requested. Approve a time-boxed evaluation, not adoption. Success criteria: correct token counts on a representative sample of real traffic, a documented replacement boundary, and a go/no-go on whether this becomes the metering path or just the prototype for one.

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.
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin