Documentation Index
Fetch the complete documentation index at: https://narev.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.

What’s Narev?
Narev is the billing and cost-tracking platform for AI products. Instead of building custom data pipelines to meter LLM usage, drop in the Narev SDK to capture raw tokens and use Narev Cloud to sync invoice-ready data directly to Stripe, Lago, or Polar.sh.Usage-based billing
Implement true usage-based billing and charge users for exactly what they consume.
Profitability analytics
Gain deep visibility into your unit economics: cost per user, cost per paying user, cost per request.
Problems Narev solves
Billing AI features accurately
Billing AI features accurately
The problem: Model prices change constantly, and providers calculate costs differently across input, output, and cached tokens.The solution: Narev Cloud syncs live pricing, while the Narev SDK maps raw token usage to normalized dollar amounts you can confidently invoice.
Connecting your app to your billing platform
Connecting your app to your billing platform
The problem: Moving usage data from an LLM call into Stripe, Lago, or Polar.sh requires custom data pipelines that turn token counts into dollar amounts, manual reconciliation, and brittle webhooks.The solution: The open-source Narev SDK provides middleware that automatically pushes billable events from your framework directly to your billing provider.
Bypassing AI gateways
Bypassing AI gateways
The problem: AI gateways make it easier to connect to providers and estimate your costs, but introduce extra latency, another point of failure, and charge an additional fee layer.The solution: Narev gives you the primitives to run your own metering pipeline. You own the data, remove the middleman, and keep full control of your profit margins.
Optimizing AI unit economics
Optimizing AI unit economics
The problem: Without precise cost tracking, you can’t tell if a specific customer or prompt change is destroying your profit margins.The solution: Narev attributes exact Cost of Goods Sold (COGS) to specific users via Customer Tagging, letting you optimize based on real dollar impact.
Core features
Focus on building your product while we handle the complexity of AI monetization and cost management.Prebuilt UI components
Add billing and usage dashboards directly to your app in minutes with drop-in React components.
Managed usage-based billing
Let us handle the heavy lifting of syncing metered usage data directly to Stripe and Polar.sh.
Margin improvement tools
Evaluate prompts across models with built-in benchmarking to optimize unit economics and protect profits.
Quick start guide
Start with usage-based billing so you can measure usage and bill customers correctly from day one.Get your API keys
Create a free Narev Cloud account to get your
NAREV_API_KEY. You will also need credentials for your billing provider (like a Polar access token or Stripe secret key) to sync usage.Install the packages
Install the core billing package along with your preferred billing provider and Next.js UI components.
Add the backend middleware
Use the
wrapLanguageModel function from the Vercel AI SDK to attach the billing middleware to your model. This automatically tracks token usage and sends it to your billing provider.- Next.js
backend.ts
Use the model in your API route
Pass the wrapped model into Vercel’s
streamText. Use providerOptions to pass the user’s ID so the billing destination knows who to charge.- Next.js
app/api/chat/route.ts
Add the Pre-build billing components
Embed the prebuilt React components in your Next.js frontend to show users their real-time usage and provide a native checkout experience for buying credits.
- Next.js
components/usage-dashboard.tsx
Why choose Narev?
- Individual Developers
- Small Teams
- Growing Businesses
Launch with usage billing from day one
Instrument requests with the Narev SDK so you can meter and bill without building custom pipelines.
Integrate with your existing stack
Connect Narev Cloud to Stripe, Lago, or Polar.sh and keep your current billing workflow.
Improve model efficiency quickly
Benchmark your real prompts, then route traffic to lower-cost model variants with quality safeguards.
See true AI unit economics
Track AI spend and COGS with normalized usage data so you can price features with confidence.
Open source
We build in the open. Our core billing primitives are open-source and free to self-host, giving you the flexibility to choose the right deployment model for your workload.narevai/ai-billing
Open-source middleware to easily add usage-based billing to your AI applications.
narevai/narev
Self-hosted finops platform for tracking and mapping your infrastructure costs.
Ready to start?
Create Account
Free sign-up, no credit card requiredGet started in under 2 minutes
Quickstart Guide
Start billing AI usageConnect a Vercel AI SDK app to Narev Cloud
Read the Guides
Framework-specific tutorialsStep-by-step integration guides
Join Our Community
Get help from the Narev teamActive community and support

