Bare bones
Call the REST API. List providers, models, and prices.POST token counts and get a dollar cost back. No SDK required.
API reference
GET providers, models, and prices. POST /v1/traces/cost to price a call.Quickstart
Copy-paste REST and MCP examples, then wire billing if you need it.
Billing
Price usage, then send dollar events to Polar, Stripe, Lago, OpenMeter, or another destination.- Any stack: price traces with the Narev API, then push events to your billing provider yourself.
- Vercel AI SDK: wrap
generateText/streamTextwith@ai-billingmiddleware. Cost resolution and destination routing happen in process.
@ai-billing destinations with environment variables, and rely on runtime cost resolution so catalog prices stay current without a sync job.
For Stripe and Polar, you can alternatively run itemized per-model metering (separate meters per token type) and push price updates yourself using the Narev Prices API.
Node.js + Vercel AI SDK
Server middleware pattern for any Node runtime using
@ai-billing.Polar
Destination setup for Polar meters, customer sync, and event names.
Stripe
Destination setup for Stripe Meters, customer sync, and meter event payloads.
Lago
Destination setup for Lago billable metrics, customer sync, and event properties.
OpenMeter
Destination setup for OpenMeter CloudEvents, customer subjects, and meter types.
Warehouse
Land the live price catalog in Snowflake, BigQuery, Redshift, or whatever warehouse you already run. Use the Fivetran connector for a managed sync on a schedule.Fivetran connector
Managed ELT. Sync Narev providers, models, and prices into your warehouse without writing a loader.