> ## 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.

# Meter-Only Mode & Disable Billing

> Track API usage without billing customers using meter-only mode or the disable_billing flag

Lava supports two ways to route requests through the gateway without charging a customer's subscription. Use **meter-only mode** to attribute requests to a specific meter for cost tracking and analytics, or **disable billing** to preserve full customer context while skipping the subscription charge.

<Info>
  **Prerequisites:** You need a Lava merchant account with a configured [meter](/monetize/meters) and the [Node.js SDK](/sdk/nodejs) installed. For disable billing, you also need an existing [customer](/monetize/checkout).
</Info>

## When to Use Each Mode

| Mode                | Token params                                     | Customer charged? | Customer tracked? | Use case                                    |
| ------------------- | ------------------------------------------------ | ----------------- | ----------------- | ------------------------------------------- |
| **Meter-only**      | `meter_slug` only                                | No                | No                | Internal tools, cost attribution, analytics |
| **Disable billing** | `customer_id` + `meter_slug` + `disable_billing` | No                | Yes               | Free trials, testing, promotional requests  |

In both modes, the provider cost is incurred by you as the merchant (as with all gateway requests). The difference from normal customer billing is that no charges are applied to the customer's subscription. Usage is still tracked and visible in your dashboard.

## Meter-Only Mode

Pass only a `meter_slug` when generating a forward token -- no `customer_id`. Lava attributes the request to the specified meter for cost tracking and analytics, without any customer context.

<Tabs>
  <Tab title="SDK gateway()">
    ```typescript theme={null}
    import { Lava } from '@lavapayments/nodejs';

    const lava = new Lava();

    const data = await lava.gateway('https://api.openai.com/v1/chat/completions', {
      body: {
        model: 'gpt-4o-mini',
        messages: [{ role: 'user', content: 'Hello!' }],
      },
      meter_slug: 'my-meter',
    });
    ```
  </Tab>

  <Tab title="SDK generateForwardToken()">
    ```typescript theme={null}
    import { Lava } from '@lavapayments/nodejs';

    const lava = new Lava();

    const forwardToken = lava.generateForwardToken({
      meter_slug: 'my-meter',
    });

    const response = await fetch(lava.providers.openai + '/chat/completions', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${forwardToken}`,
      },
      body: JSON.stringify({
        model: 'gpt-4o-mini',
        messages: [{ role: 'user', content: 'Hello!' }],
      }),
    });

    const data = await response.json();
    ```
  </Tab>

  <Tab title="Manual token">
    ```typescript theme={null}
    const forwardToken = btoa(JSON.stringify({
      secret_key: process.env.LAVA_SECRET_KEY,
      meter_slug: 'my-meter',
    }));
    ```
  </Tab>
</Tabs>

### How It Works

1. Lava validates your secret key and resolves the meter.
2. The request is forwarded to the AI provider.
3. Usage (tokens, cost) is recorded and attributed to the meter.

No customer context is involved — meter-only requests don't require a checkout, customer, or subscription. This makes it ideal for internal usage where you want per-meter cost tracking without customer setup.

## Disable Billing

Pass `customer_id`, `meter_slug`, and `disable_billing: true` to route a request with full customer context without charging their subscription. The customer's identity is preserved in usage records, but no credits are deducted from their plan.

<Tabs>
  <Tab title="SDK gateway()">
    ```typescript theme={null}
    import { Lava } from '@lavapayments/nodejs';

    const lava = new Lava();

    const data = await lava.gateway('https://api.openai.com/v1/chat/completions', {
      body: {
        model: 'gpt-4o-mini',
        messages: [{ role: 'user', content: 'Hello!' }],
      },
      customer_id: 'conn_abc123',
      meter_slug: 'my-meter',
      disable_billing: true,
    });
    ```
  </Tab>

  <Tab title="SDK generateForwardToken()">
    ```typescript theme={null}
    import { Lava } from '@lavapayments/nodejs';

    const lava = new Lava();

    const forwardToken = lava.generateForwardToken({
      customer_id: 'conn_abc123',
      meter_slug: 'my-meter',
      disable_billing: true,
    });

    const response = await fetch(lava.providers.openai + '/chat/completions', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${forwardToken}`,
      },
      body: JSON.stringify({
        model: 'gpt-4o-mini',
        messages: [{ role: 'user', content: 'Hello!' }],
      }),
    });

    const data = await response.json();
    ```
  </Tab>

  <Tab title="Manual token">
    ```typescript theme={null}
    const forwardToken = btoa(JSON.stringify({
      secret_key: process.env.LAVA_SECRET_KEY,
      customer_id: 'conn_abc123',
      meter_slug: 'my-meter',
      disable_billing: true,
    }));
    ```
  </Tab>
</Tabs>

### How It Works

1. Lava validates your secret key, resolves the customer and meter.
2. The customer's subscription balance is **not** checked or deducted.
3. The request is forwarded to the AI provider.
4. Usage is recorded and attributed to the customer.

<Note>
  Subscription entitlements are still enforced when billing is disabled. The meter must be on the customer's active plan -- `disable_billing` only skips the charge, not authorization.
</Note>

### Common Use Cases

* **Free trials** -- let new customers use your service before they subscribe.
* **Testing integrations** -- verify a customer's setup end-to-end without deducting their credits.
* **Promotional requests** -- absorb the cost of specific requests without affecting the customer's plan.
* **Debugging** -- reproduce a customer's issue with their full auth context intact.

## Comparing All Request Modes

For reference, here is how meter-only and disable billing fit alongside Lava's other request modes:

| Mode               | Token params                                     | Customer charged? | Customer tracked? |
| ------------------ | ------------------------------------------------ | ----------------- | ----------------- |
| Gateway (simplest) | none                                             | No                | No                |
| Meter-only         | `meter_slug`                                     | No                | No                |
| Customer billing   | `customer_id` + `meter_slug`                     | Yes               | Yes               |
| Billing disabled   | `customer_id` + `meter_slug` + `disable_billing` | No                | Yes               |

## Next Steps

<CardGroup cols={2}>
  <Card title="Node.js SDK" icon="node-js" href="/sdk/nodejs">
    Full SDK reference including all forward token options
  </Card>

  <Card title="Meters" icon="gauge" href="/monetize/meters">
    Configure pricing and metering for your API
  </Card>

  <Card title="Checkout" icon="credit-card" href="/monetize/checkout">
    Set up customer checkout to start billing
  </Card>

  <Card title="Usage Analytics" icon="chart-line" href="/cookbook/usage-analytics">
    Query and visualize usage data from metered requests
  </Card>
</CardGroup>
