Skip to content

What is billed while warm

View Markdown

You pay for worker time, by the second, at the worker’s rate. A call does not add a charge of its own. A Function shows the worker’s rate before you run anything, in status.estimate.rateUSDPerHour and in f.estimate(...).

State Billed?
A worker starting: placing, pulling its image, running enter hooks Yes, from the moment it is placed.
A worker running at least one call Yes.
An idle worker inside min_workers Yes, always. This is warm capacity.
An idle worker above min_workers, inside scaledown_window Yes, until the window ends.
A worker that was released No.
A Function with no workers No.

So a Function with min_workers=0 costs nothing while nothing is calling it, and each burst costs its workers’ time plus their scaledown_window. A Function with min_workers=1 costs one worker’s rate every hour, and its calls never wait for a start.

Every worker is billed under one Function and shows up as two lines of usage: the time the worker spent running calls and the time it spent waiting (warm_idle_seconds). Both appear under the Function in your usage records, so the cost of keeping workers warm is never mixed into the calls themselves.

Each call’s status.costUSD is the worker time attributed to that call: the worker’s rate divided by target_concurrency, for the whole seconds the call spent on a worker, at least one. A worker that runs four calls at once shows each of them a quarter of the rate. Call costs show where the busy time went. The bill is the workers’.

A Function does not take a spend cap yet: setting max_cost is refused when you deploy, so no cap can be set and silently ignored. Your credit balance is the limit on what its workers spend, and an idle min_workers worker bills until you stop the Function.

When your balance cannot cover another renewal, the workers drain inside the reserve and the Function scales to zero. New calls queue and show Funded=False on the Function. Add credit and the Function starts workers again for the calls that waited. Nothing the calls were doing is lost: a call whose worker drained finishes first, and one that could not finish goes back to the queue.