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

# How Lava Monetize Works

> Understand Lava's usage-based billing system: plans, meters, checkout, and customers

Lava Monetize lets you charge customers for AI usage with prepaid credits, subscriptions, and usage-based pricing. This page explains how the pieces fit together — see the linked pages for implementation details.

<Tip>
  **New to Lava?** Start with the [Charge Your First Customer](/get-started/quickstart-charge) quickstart for a step-by-step tutorial. This page explains how monetization fits together conceptually.
</Tip>

## Overview

Lava Monetize currently operates on a prepaid credit system. Customers subscribe to a plan, receive usage credits, and each request draws down their balance based on meter pricing.

```mermaid theme={null}
graph LR
    A[Checkout] --> C[Usage Event]
    C --> D["Meter (pricing)"]
    D --> E[Plan Credits]
    E --> F[Auto Top-up Bundle]
```

### What happens on every request

1. **Identify:** Lava resolves the `customer_id` (who to bill) and `meter_slug` (which pricing to apply)
2. **Price:** The [meter](/monetize/meters) calculates a fee based on its rate structure and the request's usage (tokens, characters, seconds, or request count)
3. **Charge:** The meter fee is deducted from the customer's [plan](/monetize/plans) cycle credits
4. **Handle depleted credits:** When credits run out, the request is blocked. If [auto top-up](/monetize/plans#auto-top-up) is configured, Lava automatically purchases the configured credit bundle so the next request can succeed

Ready to integrate? Follow the [Quickstart: Charge a Customer](/get-started/quickstart-charge) to get a complete monetization flow working in your code.

***

## Key concepts

### [Plans](/monetize/plans)

A **plan** governs a customer's access and billing. Plans specify the recurring charge (e.g. \$25/month), how much of that becomes usage credits, which meters are active, and whether unused credits roll over.

When a customer's credits run out, requests are blocked until credits are replenished. You can configure **auto top-up** with a [credit bundle](/monetize/plans#credit-bundles) so Lava automatically purchases more credits when the balance is depleted.

<Info>
  In the SDK and API, plan templates are called **plans** (`plan_id`).
</Info>

### [Meters](/monetize/meters)

A **meter** represents a billable dimension of usage (e.g. image generations, documents processed). You choose the unit (tokens, characters, seconds, or requests) and the fee model (fixed rate, percentage markup, or tiered pricing). Each meter has a **meter slug** you include in forward tokens or post-request calls to apply that pricing.

Meters attach to plans. A single plan can link multiple meters (e.g. one for chat and one for image generation), all drawing from the same credit balance. A meter can also be shared across multiple plans.

### [Checkout & Customers](/monetize/checkout)

**Checkout** is the hosted payment flow you embed in your app. It handles phone verification, payment setup, and subscription creation. When a customer completes checkout, Lava creates a **customer** — the billing relationship between that customer and your merchant account. The customer's ID (`customer_id`) is what you pass in every request to bill that customer. Store it in your database alongside your internal user ID.

A customer completes checkout **once** to subscribe — after that, you use the `customer_id` for all billing. Checkout is needed again only to switch plans or purchase credit bundles.

***

## Reporting usage to Lava

There are two ways to get usage into Lava: routing requests through the AI Gateway (recommended), or reporting usage after the fact via the API.

|                         | Gateway                                                                                                         | Post-request reporting                                                                                       |
| ----------------------- | --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| **How it works**        | Route AI requests through Lava's [AI Gateway](/gateway/how-lava-gateway-works). Usage is tracked automatically. | Report usage to Lava via [`POST /v1/requests`](/api-reference/requests/create-request) after each operation. |
| **Best for**            | AI APIs (OpenAI, Claude, Gemini, etc.)                                                                          | Any billable operation — API calls, compute, storage, or AI with your own keys                               |
| **Setup**               | Swap your base URL to Lava's proxy                                                                              | Add a reporting call after each operation                                                                    |
| **Balance enforcement** | Pre-request — blocks if insufficient credits                                                                    | Post-request only — request already ran                                                                      |
| **Products**            | Gateway + Monetize                                                                                              | Monetize only                                                                                                |

We recommend the Gateway path for AI usage. It's faster to set up and gives you automatic token counting, cost tracking, and pre-request balance enforcement.

[Compare in detail →](/monetize/gateway-vs-post-request)

***

## Next steps

<CardGroup cols={2}>
  <Card title="Quickstart: Charge a Customer" icon="bolt" href="/get-started/quickstart-charge">
    Get a complete monetization flow working in your code
  </Card>

  <Card title="Plans" icon="calendar" href="/monetize/plans">
    Set up recurring billing with credits, rollovers, and auto top-ups
  </Card>

  <Card title="Meters" icon="gauge" href="/monetize/meters">
    Configure pricing with fixed fees, percentage markups, and tiered pricing
  </Card>

  <Card title="Checkout" icon="credit-card" href="/monetize/checkout">
    Embed checkout for subscriptions and credit bundles
  </Card>
</CardGroup>
