Products and Pricing
The product catalog is a central concept in Credyt. It defines the products your platform offers and informs how the billing engine processes and charges for usage. Each product includes a pricing configuration, which determines how usage is measured and charged.
A product has a unique code and an associated rate plan specifying pricing, metering, and billing units. Products are versioned automatically so you roll out changes to pricing safely without impacting existing customers.
Create a Product
The Create a Product endpoint lets your platform define new products and their default pricing configuration (rate plan). A product represents what your customers consume, for example, a service, action, or unit of resource, and how they are billed for it.
Each product requires a:
- Customer-facing name
- A unique code used to identifying it creating Customer Subscriptions
- One or more prices
You can define multiple prices to cater for all the billable aspects of your products. Each price has a usage calculation that determined how matching usage events should be measured and processed.
Example
{
"name": "Glitch Video",
"code": "glitch_video_std",
"prices": [
{
"name": "Video Promotion",
"type": "usage_based",
"billing_model": {
"type": "real_time"
},
"usage_calculation": {
"event_type": "video_promoted",
"usage_type": "unit",
"source_reference_field": "video_id"
},
"pricing": [
{
"asset": "USD",
"values": [
{
"unit_price": 0.5
}
]
}
]
}
],
"publish": true
}
Response
{
"id": "prp_4e28n8kk41931f5yt5em49ecw7",
"code": "glitch_video_std",
"version": 1,
"status": "published",
"is_default": true
}
Usage Calculation
The usage calculation configuration determines how Credyt interprets incoming usage events. It supports several calculation modes providing flexibility for different pricing models:
unit– charges per occurrence of the event (e.g., per chat, per verification, per API call).volume– charges based on the volume or quantity consumed, included in the event payload (e.g., tokens, minutes, megabytes).unit_and_volume– combines both approaches
In addition to a usage event subject, the usage calculation configuration can specify a source_reference_field, the name of a field in your event payload that helps correlate the generated usage fee with the customer activity, for example video_generation_id.
How usage events are billed
Product usage is billed by matching the event_type of incoming events to a price's usage_calculation configuration. If no matching configuration exists, the usage will be recorded, but not billed for. This ensures that each event is billed according to the correct pricing logic and allows multiple event types to coexist within a single product or across different products.
Pricing Example
| Product | Event Type | Usage Mode | Source Reference Field | Description |
|---|---|---|---|---|
| Glitch Video | video_promoted | unit | video_id | Charges per promoted video |
| Glitch Video | video_minutes | volume | video_id | Charges based on total minutes processed |
| Glitch Text | message_completed | unit_and_volume | chat_id | Charges per chat + tokens used in chat |
In this example:
- A usage event with
event_type: video_promotedwill trigger the first unit-based price - A usage event with
event_type: video_minuteswill trigger the second price and bill based on the volume of minutes - A usage event with
event_type: message_completedwill trigger the third price, combining both approaches (unit + volume)
Pricing
The pricing configuration of a price defines the actual rates your customers pay for usage.
Each product price can have pricing defined in multiple currencies or custom assets, for example, a fiat currency like USD or a custom asset like as TOK (tokens) or MIN (minutes). The asset value defines:
- unit price — the base rate per unit of usage (for unit-based models).
- volume rate — the rate per aggregated volume unit (for volume-based models).
- min_amount / max_amount — optional limits that cap or floor how much can be charged per event.
This flexible structure allows you to model a wide range of usage-based pricing approaches, from simple per-event fees to complex, volume-based charging logic.
Publishing and Versioning
By default, products are created in draft mode, allowing you to review or update the configuration before publishing. You can also validate the configuration by simulating usage, which lets you run events through the billing engine and view the generated fees without registering them in the system.
When you need to update the pricing of an existing product, use the Update Product endpoint. Credyt automatically creates a new draft version of the product with your updated pricing details. You can choose to publish the version immediately (note that published versions are non-editable) or keep it in draft, test it by sending usage events, and then publish it — and make it the default version — using the Update a Product Version endpoint.
Once published, a product becomes version-locked, ensuring billing consistency for customers already subscribed to it. Any future pricing or logic changes are introduced as new product versions, preserving historical accuracy.
You can also archive a product or a product version. Deleting a product makes it unavailable for new subscriptions. If the product has already been used, it will be archived to preserve history; however, any new usage events for this product will not be accepted. Archiving a product version makes it unavailable for new subscriptions, but it remains active for customers already subscribed to it, and usage events will continue to be accepted.