Narev AI Documentation

website·Indexed 32 days ago

https://www.narev.ai/docs

Narev provides real-time LLM pricing data and tools for AI FinOps. The platform offers a REST API and SDK to track usage, calculate request costs, compare model pricing across providers, and implement usage-based billing. Documentation includes a practical framework for AI cost optimization, guides for integrating with tools like Langfuse and Polar, and a LiteLLM-compatible pricing map.

Tokens
23K
Snippets
85
Records
162
Agent score
61%

What's inside Narev

  1. Overview of Narev AI for AI cost optimization

    Narev AI is a self-hosted data infrastructure platform designed to help developers optimize AI spend and performance. It provides a real-time feedback loop to determine the best model for specific tasks (e.g., balancing latency, quality, and cost) and identifies which use cases drive the majority of AI expenditures. Because AI usage data is sensitive, the platform is self-hosted by design to protect competitive advantages and token patterns.
    # Access NarevAI on GitHub
    https://github.com/narevai/narev
  2. Overview of AI Billing middleware for Vercel AI SDK

    The AI Billing middleware is designed for the Vercel AI SDK to automatically send usage events directly to supported billing platforms, including Stripe, Polar, OpenMeter, and Lago.
  3. Overview of Narev LLM Pricing Services

    Narev provides a real-time, maintained catalog of LLM pricing. It is designed for developers who need to deploy AI gateways, bill users per token/request, or build AI cost observability platforms. It solves the problem of stale static price tables by providing live data that can be used for cost calculation and billing integration.
  4. Implement usage-based billing with narevai/ai-billing

    The @ai-billing suite provides middleware and integrations to simplify usage-based billing for AI applications. It automates the capture of token usage across various providers, resolves real-time model pricing, and routes structured billing events to payment platforms. It currently provides integration for the Vercel AI SDK.
  5. Integrate Narev Cloud usage metering and AI billing in Node.js

    Narev Cloud allows you to add usage metering and AI billing to Node.js servers that are running the Vercel AI SDK. The integration follows a billing-platform-agnostic pattern, making it compatible with multiple billing providers including Stripe, Polar, Lago, and OpenMeter.
  6. Track infrastructure costs with Narev Self-Hosted

    Narev Self-Hosted (narevai/narev) is an open-source container designed for teams requiring raw visibility into infrastructure costs (COGS) without a full billing engine. It allows users to track AI spend and map infrastructure layer costs using the FOCUS format.
  7. Integrate Narev Cloud LLM usage with OpenMeter

    Narev Cloud allows you to send LLM usage events to OpenMeter as CloudEvents. This integration enables the synchronization of customers and the tracking of AI consumption, allowing you to implement billing strategies based on subscriptions and metered pricing.
  8. Choose a Polar metering strategy for LLM usage

    Polar supports two strategies for billing LLM usage via Narev. The recommended approach is 'Nanos', which bills based on the resolved dollar cost per generation and does not require manual price synchronization. The 'Itemized' approach bills raw token counts (input, output, reasoning, cache, request) and requires pushing per-token rates into Polar metered_unit prices.
  9. Understand Lago metering strategy for LLMs

    Lago integrations with Narev use nanos metering exclusively. A single billable metric aggregates cost_nanos from each event. Narev resolves the dollar cost at request time, meaning token rates are not copied into Lago plans. You must create a billable metric in the Lago Dashboard (e.g., with code llm_usage) to track this usage.
  10. Access Narev Cloud REST API pricing and model endpoints

    Narev Cloud provides a set of REST API endpoints to retrieve information about LLM providers, available models, and their associated pricing. These endpoints allow developers to programmatically search for model costs and calculate the cost of specific traces.

    Pricing & Reference Endpoints

    MethodPathDescription
    POST/v1/traces/costCalculate cost for a specific trace
    GET/v1/reference/providersList all available providers
    GET/v1/reference/modelsList all available models
    GET/v1/pricesList model pricing for a specific provider
    GET/v1/prices/searchSearch for pricing based on a specific model
  11. Understand the Narev usage-based billing lifecycle

    The usage-based billing flow transforms AI model usage into customer charges through the following stages:

    1. Capture: An authenticated customer makes a model call. The inference provider returns usage data, which the Narev SDK captures via middleware.
    2. Attribution: Customer Tagging connects the generation to the specific user or tenant. This identity must be sourced from trusted app state to prevent users from assigning usage to others.
    3. Resolution: The integration resolves the usage into either a normalized cost amount (cost-based meter) or a quantity (itemized meter) for the billing destination.
    4. Aggregation: The billing provider aggregates events based on the customer's contract, product, and subscription. A bill is only created if the event matches the meter and the customer has the relevant product/subscription.