reaatech/otel-cost-exporter
These packages convert GenAI semantic convention spans into real-time USD cost metrics, exporting them via Prometheus, OTLP, or JSON. You would adopt them to track LLM spend per model and provider without manually maintaining pricing tables for OpenAI, Anthropic, Google, AWS Bedrock, and Azure. The packages compose as a layered pipeline—core types, pricing tables, a calculator with LRU caching, and an exporter that can run either as an in-process Node.js SpanProcessor or as a standalone OTLP collector.
Packages
5 packages
@reaatech/otel-cost-exporter
An OpenTelemetry span processor that reads GenAI semantic convention spans, calculates real-time USD costs using bundled pricing tables for major LLM providers, and exports the cost metrics via Prometheus, OTLP, or JSON.
- status
- published
- published
- 19 days ago
@reaatech/otel-cost-exporter-calculator
A cost calculator that converts raw token counts from GenAI semantic convention spans into per-model cost breakdowns in USD, with model name normalization, provider detection, and LRU pricing caching. It provides a `CostCalculator` class (or `createCostCalculator` factory) that accepts a pricing provider, cache, normalizer, and optional default price, and returns a `CostResult` with input, output, and total costs.
- status
- published
- published
- 19 days ago
@reaatech/otel-cost-exporter-cli
A CLI that starts an OTLP collector service, validates pricing tables, generates cost reports from span data, and inspects configuration, providing commands like `serve`, `report`, `config`, and `validate`.
- status
- published
- published
- 19 days ago
@reaatech/otel-cost-exporter-core
Shared domain types, Zod schemas, GenAI semantic convention constants, and a Pino-based logger factory for the `@reaatech/otel-cost-exporter-*` ecosystem. Exports TypeScript types (`CostSpan`, `PriceEntry`, `CostBreakdown`), their Zod validation schemas, and utility functions like `parseIntervalMs()` and `createLogger()`.
- status
- published
- published
- 19 days ago
@reaatech/otel-cost-exporter-pricing
A pricing table loader and lookup utility that bundles pre-validated YAML pricing data for OpenAI, Anthropic, Google, AWS Bedrock, and Azure, providing `loadPricingData()` and `createPricingTable()` functions for exact and wildcard model price lookups with custom override support.
- status
- published
- published
- 19 days ago
Comments
Sign in with GitHub to comment and vote.
Loading comments…
