Show HN: Marginal – See which customers and features drive your AI API costs
Marginal is a cost observability platform that tracks every LLM call's cost and enables slicing spend by custom dimensions like customer, feature, and model It provides TypeScript and Python SDKs (zero-dependency, buffered, fire-and-forget) plus a simple HTTP API for integration Costs are computed server-side using a daily-synced price catalog, eliminating token math from the user's codebase The dashboard automatically generates charts for every dimension (model, provider, registered fields) wit
Analysis
TL;DR
- Marginal is a cost observability platform that tracks every LLM call's cost and enables slicing spend by custom dimensions like customer, feature, and model
- It provides TypeScript and Python SDKs (zero-dependency, buffered, fire-and-forget) plus a simple HTTP API for integration
- Costs are computed server-side using a daily-synced price catalog, eliminating token math from the user's codebase
- The dashboard automatically generates charts for every dimension (model, provider, registered fields) without manual setup
- It surfaces debugging information including accepted/rejected counts, stripped keys, and unpriced models to help teams investigate spend spikes
Why It Matters
AI infrastructure costs are a growing concern as LLM usage scales, yet most teams lack granular visibility into where their spend is going. Marginal addresses a real pain point: the inability to answer "why was the bill that high?" with actionable, dimension-based breakdowns. For AI practitioners shipping production LLM features, cost observability is becoming as critical as performance and latency monitoring.
Technical Details
- SDKs: TypeScript (
npm install marginal-sdk) and Python (pip install marginal-sdk) with zero dependencies; events buffer locally and flush in batches asynchronously, ensuringtrack()never throws or blocks the request path - HTTP API: Single JSON POST endpoint for language-agnostic integration; coding agents can self-serve via
marginalhq.com/llms.txt - Pricing engine: Server-side cost computation against a daily-synced model price catalog with per-project overrides; prices are frozen at ingest time
- Dimensional slicing: Users register custom fields (customer, feature, etc.) and can group/filter spend by any registered dimension; unregistered keys are stripped and reported back
- Logging & debugging: Every API request is logged with outcome details — accepted counts, rejected events with reasons, stripped keys, and unpriced model flags
Industry Insight
- Cost observability is emerging as a distinct category in the AI engineering toolchain, alongside tracing and monitoring — expect more specialized tools to fill this gap as LLM spend becomes a board-level concern
- The "one call integration" pattern (fire-and-forget, non-blocking) reflects the broader trend of making AI infrastructure tooling invisible to application code paths, reducing adoption friction
- The ability to slice spend by business dimensions (customer, feature) rather than just technical ones (model, provider) signals a shift toward treating AI costs as a product metric, not just an engineering metric
Disclaimer: The above content is generated by AI and is for reference only.