What units cost: the bill with worked numbers
The numbers on this page use an example plan at EUR 7.20 per month that includes one unit. Your plan's real price is on its page, and the quote endpoint returns your exact figures before you commit to anything.
The rule
- The plan's monthly price covers the units included in the plan (normally one). It is paid up front, like any subscription.
- Every unit above the included ones is an extra unit. It is billed for the hours it actually runs, at the plan's monthly price divided by 720, with no surcharge.
- Each time an extra unit starts, it is billed for at least 5 minutes.
- Extra units are added up per calendar month (UTC) and invoiced after the month ends.
This is the same for a fixed policy and an autoscaled one. There is no separate multiplied price for "3 units".
The rate
Code
720 is 30 days of 24 hours. A whole 30-day month of one extra unit costs exactly the plan price.
Worked examples
A. One unit, nothing else. You pay EUR 7.20. No extra units, no metering.
B. Fixed at 3 units for a whole 30-day month. One unit is included, two are extra:
Code
C. Autoscaled 1 to 4, a quiet month with two busy days. On one day it ran 2 extra units for 6 hours; on another, 1 extra unit for 3 hours:
Code
D. A very short start. An extra unit that runs 90 seconds is billed 5 minutes:
Code
This minimum is why a policy that flaps up and down is more expensive than one that holds steady, and why the cooldown settings exist.
E. A public port. Raw ports are billed by the hour they are held, capped at one port-month. At an example price of EUR 1.00 per port-month, a port held 72 hours costs 72 / 720 x 1.00 = EUR 0.10, and a port held all month costs EUR 1.00. HTTPS endpoints are free. Ports are billed in arrears together with the extra units.
Units of their own size
A unit your code creates can be smaller than the plan. The rules:
- The included unit is prepaid at the plan's size. A smaller included unit earns no credit.
- An extra unit is billed per hour at its own size: the plan's price with the unit's vCPU and memory in place of the plan's, divided by 720.
- The 5-minute minimum per start is the same.
- A unit of the plan's size costs what it always did.
Say the base charge at a unit's size comes to EUR 3.60 per month. Then each hour it runs costs 3.60 / 720 = EUR 0.005, and a 90-second start is billed 5 minutes, 5 / 60 x 0.005. Your real figure is the plan's price at the size you chose.
The unit's resources and own_size show which size is billed.
The worst case, before you save
POST .../units/policy/quote takes the same body as the policy update and returns what it could cost at most, without saving it. For autoscaled between 1 and 4 units on the plan above:
Code
If you also set spend_cap_cents to 1500, monthly_cents is 1500 and cap_binds is true. The worst case is rarely reached; it is the number that cannot be exceeded.
The spend cap
spend_cap_cents limits how much extra units may cost in a month. At or over it, scaling refuses to grow, and records why. It never stops a running unit.
Organizations without a credit limit hold a wallet reservation for the cap while scaling is on, so the end-of-month invoice can always be paid. If your available balance cannot cover it, turning scaling on is refused with the amount you need. A running Workload is never stopped for this.
What you have spent this month
GET .../units/cost answers two things for the current calendar month (UTC): what the service has cost so far, and an estimate for the whole month. Every figure comes from the platform, from your subscription's own price, in whole cents of its currency and before tax. Reading it needs what reading the units list needs; through a service share it also needs the share's billing permission.
Code
The example is trimmed: estimate has the same shape as so_far, with its lines and extra_units filled in.
plan_monthly_centsis the plan, paid up front with the subscription at the plan's size, before discounts. It isnullfor a free plan. It is not on the usage invoice.so_faris the month up toas_of. Itslinesare the lines the usage invoice would carry if the month ended now: extra unit-hours (each start billed at least five minutes) and public ports. A line that rounds to nothing is not billed and not listed.total_centsis the plan plusmetered_cents.extra_unitssplits the unit-hours by unit size;resources: nullis the plan's size. The invoice puts every size on one line, rounded once, so the groups can differ from that line by a cent or so.estimateis the whole month underprojection.rule,trailing_24h: extra units keep running until the month ends at the rate they ran over the last 24 hours (window_starttoas_of, shorter on the first day of the month), each start at its five-minute minimum and its own size, and the public ports open now stay open. Nothing else changes. It is an estimate: a quiet day makes it low, and a busy one makes it high.
Reading your bill
The units chart (GET .../units/count) is drawn from the same records the invoice is built from: how many units ran, how many were billed as extra, and why the count changed. If a number on the invoice surprises you, the chart for the same month explains it.
A unit that is scaled away stops billing at that moment.
