Overview
Unit Economics is a premium feature, available on the Enterprise plan.
Analyze customer and product costs based on meters to maximize revenue and efficiency. Our unit economics feature can measure cloud, vendor, and operational costs by meters to analyze margins and drive budgeting.
In this guide, we will use OpenAI GPT-4 as an example to show how to break down your LLM cost by customers.
You can read more about our unit economics on our blog.
Creating our meter
OpenAI charges for GPT-4 based on the number of input and output tokens, so we
will create a meter to track that. We will call this meter tokens_total
and
define two groups bys model
and type
:
- model refers to the LLM model like
gpt-4
- type differentiates the
input
oroutput
tokens
Create meter in OpenMeter Cloud:
Create meterDefining our resources
Resources is an entity that has cost and usage associated with it. For example, a group of servers, APIs, or vendors. Let's define our OpenAI GPT-4 resources.
As OpenAI has different pricing for input and output tokens, we will define two
resources relying on the same tokens
meter we created above.
Visit https://openmeter.cloud/resources to define your resources via the user interface.
1. OpenAI GPT4 Input
Our resource to track the cost of GPT-4 input tokens will look like this:
Note that we are using the meterGroupBy
to filter the meter only to count
input tokens.
2. OpenAI GPT4 Output
Our resource to track the cost of GPT-4 output tokens will look like this:
Note that we are using the meterGroupBy
to filter the meter only to count
output tokens.
Ingesting cost
Now that we have our meters and resources defined, we can start ingesting cost data. OpenMeter has three ways to ingest cost data:
- Ingesting already materialized bills with specific periods like cloud bills, vendor costs, etc.
- Defining recurring costs like monthly SaaS subscriptions
- Defining unit cost, driven by meters
The most accurate way to ingest cost is to ingest already materialized bills. However, if you don't have access to the bills, you can use the recurring or unit cost approaches.
Visit https://openmeter.cloud/resources/costs to define your costs via the user interface.
Ingesting OpenAI GPT-4 cost
As of writing this guide, OpenAI charges $0.00003 per GPT-4 input token and $0.00006 per output token. We will use the unit cost approach to ingest the cost of GPT-4 for both input and output tokens.
1. OpenAI GPT4 Input
Note how we left the chargePeriodEnd
empty to indicate that this cost has no
end date.
1. OpenAI GPT4 Output
Unit Economics
Finally, we can use our unit economics to break down our costs by customers and products for any given period.
Visit https://openmeter.cloud/resources to analyze your cost via the user interface.
The API response looks as: