Pricing structure
For OpenAI, pricing depends on the language model used. Here are several price points they offer: “Prices are per 1,000 tokens. You can think of tokens as pieces of words, where 1,000 tokens is about 750 words (learn more here).”Model | Input | Output |
---|---|---|
8K context | $0.03 / 1,000 tokens | $0.06 / 1,000 tokens |
32K context | $0.06 / 1,000 tokens | $0.12 / 1,000 tokens |
Get started
1
Set up Lago
2
Create a billable metric
Create a single billable metric to track token usage across different models and input/output types.Refer to the API reference and guide on filters to learn more.
- Add a unique
code
for your billable metric - Set
aggregation_type
tosum_agg
- Set
field_name
totokens
- Set
recurring
tofalse
- Set
filters
to distinguish between models and token types
3
Create a plan
Create a plan to price packages of tokens used with OpenAI’s specific pricing tiers.Refer to the API reference and guide on charges with filters to learn more.
- Add a unique
code
for your plan - Under
charges
, configure pricing tiers for different models and token types
4
Create a customer
5
Create a subscription
Create a subscription for the customer with the plan’s Refer to the API reference to create a subscription.
code
.6
Ingest usage via events
Send usage events to Lago to track usage.Refer to the API reference to create an event.
- Reference your billable metric with
code
- Reference the customer’s subscription with
external_subscription_id
- Include usage and filters data in
properties
7
Monitor current usage
Track real-time customer usage for the current billing period.Refer to the API reference to get the current usage.