Per-employee platform fee with workflow credits
Opsflow sells an AI service management platform: a help desk, workflow automation and access provisioning that IT buys first and that spreads into HR, legal and finance. Each customer pays a platform fee of $12 per employee per month, billed a year in advance, and buys prepaid credits at $0.15 each. Every workflow run burns credits at a rate set by how many billable steps the run took. This page follows Opsflow’s largest customer, Northwind Traders, from catalog setup to a month of usage.
This example uses:
- Credit currencies, for Opsflow credits
- Products and prices, for the platform fee, the credit bundle and the burn rate
- Meters, to turn step events into one measured run
- Customers, customer units and customer aliases, for one customer with a prod and a dev org
- Orders and amendments, for the annual contract and changes during it
- Events, for each workflow step
- Credit balances, credit transactions and usage summaries, for what Opsflow shows its customers
The calls below show only the request body. Every request also sends the request headers: Authorization, the Paid-Version, and a Paid-Beta opt-in for each beta the endpoint is in (each endpoint page names its beta; this example uses products=v1, prices=v1, meters=v1, credits=v1, customers=v1, customer_units=v1, customer_aliases=v1, orders=v1, events=v1 and usage_summaries=v1). Writes also send an Idempotency-Key, so a retry is safe (see Idempotency).
Pricing
Credits are granted when the order activates and last 12 months, plus 3 months of rollover. A run burns credits by its billable steps:
Prices in usd are in cents: unit amounts as decimal strings ("1200" is $12.00), flat amounts as integers. A price denominated in a credit currency is priced in that unit, here credits.
Setup
These calls run once, when Opsflow sets up its catalog.
Create a credit currency for credits. The conversion is what one credit costs once a customer’s balance runs out: 15 cents, the list price.
Create a product for the platform:
The workflow run meter
A run is every step event that shares a run_id. It closes when Opsflow sends the workflow_run.completed signal, or after 7 days without one. Each step carries billable_steps: 1 for a step that does real work, 0 for polls and glue. The closed run’s quantity is the sum, so the run is priced on its billable steps only. Ingestion steps carry no workflow_id, so the filter leaves them out.
Create a meter that measures workflows:
Prices
Create a price for each charge. The platform fee is a recurring monthly price per employee:
The credit bundle is a yearly price per credit that grants one credit for each unit of the order line’s quantity when the order activates. Credits expire after 12 months, and unused credits roll over for 3 more:
The burn rate is a usage price on the run meter, denominated in credits. With tierScope: "event", each closed run is banded on its own billable steps, and a volume tier with a flat amount charges the whole run once. The first tier makes a run with no billable steps free.
The three prices come back as prc_platform, prc_credits and prc_burn; the rest of the page uses those IDs.
Signing Northwind Traders
Northwind Traders has a prod and a dev Opsflow org, each sending its own org ID, and departments that share one credit pool. Opsflow models it as one customer, a unit per org, a unit per department under prod, and an alias for each org ID.
Create the customer units. A unit with no parent is the root:
Then one unit per environment under the root:
The dev unit is the same with "externalId": "dev". Departments go under prod the same way ("parent": "prod", "kind": "department", with it, hr, legal, finance and so on as external IDs), so burn can be split by team.
Create an alias for each org ID Opsflow sends, routed to its environment:
And org_northwind_dev routed to dev the same way.
The order
Create an order for the annual contract. The billing cycle is 12 months, so the monthly platform fee is invoiced once a year, in advance. Northwind Traders has 3,000 employees and buys 3,120,000 credits, about 70% of its forecast use:
Then activate it with POST /v1/orders/ord_123/activate, which takes no body. Activation grants 3,120,000 credits and issues the annual invoice:
Sending usage
Opsflow sends an event for every step, under the org ID it already uses. The alias resolves org_northwind_prod to the prod unit, and customerUnit names the department when Opsflow knows it. That works because it sits under prod; naming dev there would be rejected.
When the run finishes, Opsflow sends the signal that closes it:
At volume, Opsflow sends steps through the batch endpoint, up to 1,000 events a request.
Take an access request that logged 1,507 steps, 19 of them billable. The run closes with a quantity of 19 steps, lands in the 11 to 100 band, and spends 10 credits. The spend’s ledger entry points at the run’s derived event, so every run has its own credit receipt.
A month of usage
Assume Northwind Traders runs 140,000 workflows in a month:
- Balance after the month: 3,120,000 − 371,000 = 2,749,000 credits, 88.1% available. Nothing is invoiced: the runs draw on the prepaid grant.
- Running low: at this rate the balance is 894,000 after month 6 and 523,000 after month 7, so a 20% alert (624,000 credits) fires during month 7, and the grant runs out during month 9.
What Opsflow shows its customers
Credit balances give the live balance, and credit transactions give the burn ledger, one spend per run with the derived event it came from:
Usage summaries split burn by team and month:
Changes during the term
Topping up credits
Opsflow sells 70% of forecast upfront and tops up when a customer runs low. A top-up is a one-time price that grants credits, created once:
After month 7, Northwind Traders has 523,000 credits left and needs 5 × 371,000 = 1,855,000 to finish the term. A top-up of 1,400,000 credits leaves 523,000 + 1,400,000 − 1,855,000 = 68,000 to spare. Preview the amendment that adds it as a line, invoiced straight away:
Then create the amendment with the same changes and the previewToken the preview returned. It invoices 1,400,000 × $0.15 = $210,000.00 once and grants the credits. To do this automatically at a threshold, use a credit auto top-up.
A custom burn rate for one customer
To give Northwind Traders its own burn bands mid-term, create a second burn price the same way as prc_burn with the new tiers, then swap it onto the order’s burn line:
Create it with the returned previewToken, as above. Runs that close before the amendment spend at the old rate, and runs that close after it at the new one.