---
title: Billing for LLM tokens
slug: billing-for-llm-tokens
docTags: 
createdAt: 2026-03-07T00:39:39.950Z
---

This guide shows how to bill customers for an AI chatbot product using:

- **API calls (per request)**
- **LLM tokens (input + output, priced differently by model)**

This is a real-world billing pattern used by most AI products.

By the end, you will have:

- Multiple meters (API calls + tokens)
- A pricing plan with **multiple rate types**
- Dimensional pricing (model + token type)
- A customer receiving a fully broken-down invoice

## The Scenario

You are building an **AI chatbot SaaS**.

Your pricing model:

- $0.01 per API request
- Token usage billed based on:
  - **Model** (Model A vs Model B)
  - **Token type** (input vs output)

This reflects how real AI systems are priced.

## What You’ll Build

You will implement:

:::BlockQuote
API Request → Flat charge &#x20;
LLM Tokens → Dimensional pricing (model + type) &#x20;
→ Combined into a single invoice
:::

## Step 1: Create Meters

You need **two meters**.

### 1A. API Calls Meter (Simple)

### Navigate

- Go to **Meters**
- Click **Create Meter**

### Configure

- **Label**: API Calls
- **API Name**: auto-generated
- **Meter Type**: Count

No dimensions required.

Note:
You *can* add dimensions (endpoint, region, etc.) for analytics or cost tracking, but they are not needed for billing here.

Click **Create**.

### 1B. LLM Tokens Meter (Dimensional)

### Navigate

- Go to **Meters**
- Click **Create Meter**

### Configure

- **Label**: LLM Tokens
- **Meter Type**: Count

### Add Dimensions

Add:

- model
- type (input, output)

These are **required** for realistic AI pricing.

Click **Create**.

## Step 2: Create a Pricing Plan

### Navigate

- Go to **Pricing**
- Click **Create Pricing Plan**

### Configure

- **Name**: Chatbot Usage Plan
- **Billing Period**: Monthly

Click **Continue**.

## Step 3: Add Rates

You will add **two rates** to the same plan.

### 3A. API Calls Rate (Per Unit)

- Click **Add Rate**
- Select **Usage-Based**

Configure:

- **Meter**: API Calls
- **Rate Model**: Per Unit
- **Price**: 0.01

This means:

- Every API request = $0.01

### 3B. LLM Tokens Rate (Dimensional)

- Click **Add Rate** again
- Select **Usage-Based**

Configure:

- **Meter**: LLM Tokens
- **Rate Model**: Dimensions
- **Tier Model**: Per Unit

### Define Pricing Matrix

You will define rates based on:

- model
- type

Example:

| **model** | **type** | **price per token** |
| --------- | -------- | ------------------- |
| model\_a  | input    | 0.00001             |
| model\_a  | output   | 0.00002             |
| model\_b  | input    | 0.000005            |
| model\_b  | output   | 0.00001             |

Each row is a separate pricing rule.

### Important

- You are pricing **each combination independently**
- This is how real AI pricing works

Click **Save**.

## Step 4: Create a Customer

### Navigate

- Go to **Customers**
- Click **Create Customer**

### Configure

- **Customer Name**: Test Customer
- **Customer ID**: test\_customer

Click **Save**.

## Step 5: Assign Pricing Plan

- Open the customer
- In **Pricing Plans**, click **Assign Plan**

Configure:

- **Plan**: Chatbot Usage Plan
- **Start Date**: Now

Click **Assign Plan**.

## Step 6: Send Usage

Now you simulate real usage.

### Navigate

- Go to **Meters**
- Open **LLM Tokens**
- Click **Event Upload**

### Example Event (Tokens)

:::BlockQuote
\[
&#x20; \{
&#x20;   "meterApiName": "llm\_tokens",
&#x20;   "meterValue": 1000,
&#x20;   "dimensions": \{
&#x20;     "model": "model\_a",
&#x20;     "type": "input"
&#x20;   }
&#x20; }
]
:::

Send multiple events for different combinations:

- model\_a + input
- model\_a + output
- model\_b + input

### API Calls Event

Send another event using the API Calls meter:

:::BlockQuote
\[
&#x20; \{
&#x20;   "meterApiName": "api\_calls",
&#x20;   "meterValue": 10
&#x20; }
]
:::

## Step 7: View the Invoice

### Navigate

- Go to **Customers**
- Open your customer

### What You’ll See

Your invoice will include:

- API call charges
- Token usage charges

By default, token charges are broken down by:

- Model
- Token type

Example:

:::BlockQuote
Model A - Input Tokens → $X &#x20;
Model A - Output Tokens → $Y &#x20;
Model B - Input Tokens → $Z &#x20;
API Calls → $W &#x20;
Total → $T
:::

### Important Note

You **do not have to expose this level of detail** to your customers.

- This breakdown is the default
- You can simplify how invoices are presented

### If You Don’t See Data

- Refresh the page
- Amberflo does not auto-refresh

If still empty:

- Confirm events were sent
- Confirm dimensions match pricing
- Confirm plan is assigned

## What You Just Built

You implemented a real AI billing system:

- Multiple meters
- Mixed pricing models
- Dimensional pricing
- Unified invoice

## Why This Matters

This pattern lets you:

- Price different models differently
- Charge input vs output tokens separately
- Combine request-based and usage-based billing

This is how modern AI products monetize.

## Next Steps

- Add **tiered pricing** for tokens
- Introduce **discounts or credits**
- Connect to **cost tracking** for margin visibility

For internal cost attribution, see:
[Workloads](docId\:XToRHVsoI2AOK1BZPwfDU)

