Skip to main content

Dimensional Pricing

API Reference

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.

You can use * as the value to specify fallback pricing for your product.

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. A fallback of $0.40/minute is specified if an unknown speed is sent through.

POST https://api.credyt.ai/products
{
"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": "unit_and_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
}
]
},
{
"name": "Video Generation Minutes (Default)",
"dimensions": {
"speed": "*"
},
"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".

POST https://api.credyt.ai/events
{
"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"
}
}
]
}