Dimensional Pricing
Dimensional Pricing allows pricing to adapt based on custom attributes (billable dimensions) of a usage event; such as speed, quality, or model type.
Instead of creating separate prices for each dimension value, you define a single price and assign values for each variation of your billable dimensions. This reduces your setup and maintenance effort and ensures pricing consistency across dimensions.
In the following example we charge a different price based on the speed of the video generation task. This field is included in the usage events sent to Credyt.
Here we charge $1.00/minute for "fast" workloads and $0.40/minute for "regular" speed workloads.
{
"name": "Glitch Video Advanced",
"code": "glitch_video_adv",
"prices": [
{
"name": "Video Generation Compute",
"type": "usage_based",
"billing_model": {
"type": "real_time"
},
"usage_calculation": {
"event_type": "video_generated",
"usage_type": "volume",
"volume_field": "minutes",
"source_reference_field": "video_id",
"billable_dimensions": ["speed"]
},
"pricing": [
{
"asset": "USD",
"values": [
{
"name": "Video Generation Minutes (Fast)",
"dimensions": {
"speed": "fast"
},
"values": [
{
"volume_rate": 1
}
]
},
{
"name": "Video Generation Minutes (Regular)",
"dimensions": {
"speed": "regular"
},
"values": [
{
"volume_rate": 0.4
}
]
}
]
}
]
}
],
"publish": true
}
Response
{
"id": "prp_4e28n8kk41931f5yt5em49ecw7",
"code": "glitch_video_adv",
"version": 1,
"status": "published",
"is_default": true
}
When sending usage for a customer subscribed to the above product, the price will be matched based on the event_type and billing dimensions included in the data object of the incoming usage event.
In the following example, the price for "Video Generation Minutes (Fast)" would be matched since data.speed = "fast".
{
"customer_id": "cust_4td6grpw680sgewcaz5p89pf40",
"events": [
{
"id": "ba15987a-7b68-4a9d-b2e6-eadeff29e657",
"event_type": "video_generated",
"occurred_at": "2025-11-04T21:53:21.392Z",
"subject": "video_defc8524",
"description": "Video Generated",
"data": {
"minutes": 10,
"speed": "fast"
}
}
]
}