# 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[​](#create-a-product "Direct link to Create a Product") [API Reference](https://docs.credyt.ai/api/products-create.md) 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](https://docs.credyt.ai/features/customers.md) * 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[​](#example "Direct link to Example") * REST API * TypeScript SDK * Python SDK POST https\://api.credyt.ai/products ```json { "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** ```json { "id": "prp_4e28n8kk41931f5yt5em49ecw7", "code": "glitch_video_std", "version": 1, "status": "published", "is_default": true } ``` ```typescript await client.products.create({ name: "Glitch Video", code: "glitch_video_std", prices: [ { name: "Video Promotion", type: "usage_based", billingModel: { type: "real_time", }, usageCalculation: { eventType: "video_promoted", usageType: "unit", sourceReferenceField: "video_id", }, pricing: [ { asset: "USD", values: [ { unitPrice: 0.5, }, ], }, ], }, ], publish: true, }); ``` [View full sample on GitHub](https://github.com/credyt/sdk-ts/blob/main/samples/productsCreateSample.ts#L227) **SDK response object** ```typescript const response = { id: "prp_4e28n8kk41931f5yt5em49ecw7", code: "glitch_video_std", version: 1, status: "published", isDefault: true, }; ``` ```python response = client.products.create( body={ "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, }, ) ``` [View full sample on GitHub](https://github.com/credyt/sdk-python/blob/main/samples/products_create_usage_based_price.py#L20) **SDK response object** ```python response = { "id": "prp_4e28n8kk41931f5yt5em49ecw7", "code": "glitch_video_std", "version": 1, "status": "published", "is_default": True, } ``` ## Usage Calculation[​](#usage-calculation "Direct link to 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`](https://docs.credyt.ai/api/events-send-usage.md), 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[​](#how-usage-events-are-billed "Direct link to 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[​](#pricing-example "Direct link to 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_promoted` will trigger the first unit-based price * A usage event with `event_type: video_minutes` will trigger the second price and bill based on the volume of minutes * A usage event with `event_type: message_completed` will trigger the third price, combining both approaches (unit + volume) ## Pricing[​](#pricing "Direct link to 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](https://docs.credyt.ai/features/assets.md), 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[​](#publishing-and-versioning "Direct link to Publishing and Versioning") [API Reference](https://docs.credyt.ai/api/products-create-version.md) 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](https://docs.credyt.ai/api/products-simulate-usage.md), 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.