Example
You sell compute minutes. A normal minute costs1 credit. But some machines cost you more to run, so you want to charge more for them:You keep one feature,
- A
largemachine costs16 creditsper minute- A
largemachine in theeuregion costs20 creditsper minute- A
spotmachine gets a 70% discount (× 0.3)compute_minutes, and one credit balance. You send the machine details as properties on each event, and Autumn picks the right rate.
Setting up
- CLI
- Dashboard
Add Preview with
dimensions and multipliers to a row of the credit system’s creditSchema. Each one has a name and a match object:autumn.config.ts
atmn push, then apply with atmn push --yes.Sending properties
Passproperties on track and check. Use the underlying feature (compute_minutes), not the credit system, as with any credit system.
Tracking usage
This event is alarge machine in eu, on spot. The rate is 20 credits, the multiplier makes it 6 credits, and 10 minutes cost 60 credits.
Checking access
check uses the same properties. Autumn converts required_balance at the rate the properties choose. Here, 10 minutes on a large machine need 160 credits, not 10.
If you lock a balance with
check, the properties are saved with the lock. balances.finalize then prices the final usage with those same properties.How a rate is chosen
For each event, Autumn picks one rate:- A dimension matches when every key in its
matchis in the event’s properties, with the same value. - If more than one dimension matches, the one with the most keys wins.
{ size: "large", region: "eu" }beats{ size: "large" }. - If they have the same number of keys, the higher
prioritywins. - If no dimension matches, the row’s own rate applies. This is also true when you send no properties.
Values are compared as text, so
{ size: 1 } and { size: "1" } match the same dimension. Properties with a null or object value never match.priority to one of them to fix it.
Multipliers
A multiplier changes the chosen rate. Unlike dimensions, every matching multiplier applies, not just one. The final rate is:factormultiplies the rate.0.3means 30% of the rate.2means double.addadds a fixed number of credits to the rate. It can be negative.
ExampleA rate can never go below zero. If your multipliers could make any rate negative, the save fails.
An event has{ size: "large", region: "eu", lifecycle: "spot" }andvalue: 10.
- The dimension
size_large_region_eusets the rate to 20 credits.- The multiplier
lifecycle_spot(× 0.3) changes it to 6 credits.- 10 minutes × 6 credits = 60 credits.
The dashboard only edits
factor. To use add, set it with the CLI or the API.Graduated dimensions
A dimension can have graduated tiers instead of a singlecreditCost. Each dimension counts its own usage, so it moves through its own tiers. Usage on other dimensions does not move it forward.
autumn.config.ts
Rate card fields
Each dimension has these fields:
Each multiplier has these fields:
A multiplier needs at least one of
factor or add.
Dimension and multiplier names can be up to 64 characters and cannot contain
::. The name appears on invoices (see below), so choose a name your customers will understand.Invoices with monetary credits
When your credits are money (eg, one credit is $1), you usually want the invoice to show what the customer spent them on. Autumn does this when the plan item for the credit system has:- a usage-based price (pay per use), and
- a price of exactly one currency unit per credit (eg,
$1per credit, or$100per 100 credits), and - no pooling across entities.
autumn.config.ts
- one line for each feature and dimension that used credits. The line shows the feature name, the dimension name, the units used, and the cost.
- one “Credits applied” line that takes off the credits included in the plan.
ExampleThe invoice looks like this:
A customer on Pro ($20 per month, $100 of credits included) uses this in one month:
- 40 minutes with no properties: 40 × 1 = 40 credits
- 10 minutes on
{ size: "large" }: 10 × 16 = 160 credits- 10 minutes on
{ size: "large", region: "eu", lifecycle: "spot" }: 10 × 20 × 0.3 = 60 credits
The customer used $260 of credits. $100 was included, so they pay $160 for usage plus the $20 plan price.
When a balance belongs to an entity, the entity’s name is added to the end of each line, eg
Compute minutes — size_large, 10 units (Workspace A).
The plan item’s price decides this, and there is no switch to turn it on. Any other price shape (a different price per credit, prepaid credits, included-only, or pooled balances) bills usage above the included amount as one normal overage line, with no breakdown by dimension.
Custom rate cards per plan
A plan can use its own rate card for a credit system. SetfeatureOverride on the plan item:
autumn.config.ts
Limits
- Dimensions only work on credit systems (
type: "credit_system"). AI credit systems use markups instead. - Properties change the price only through a credit system. A metered feature with its own balance ignores them.
invoices.createwithusageuses properties to price each entry, but the invoice has one total line, not one line per dimension.