Modal cold start billing, stage by stage through one request

By Christophe Paka · Facts checked on 7 November 2026

You call your model after a quiet hour. Nothing answers for a while, because a container has to start and load. Then you wonder what that wait costs you.

Short answer: partly. Guess wrong, and you either pay for warm containers you do not need, or you get surprised by a slow model load on the bill.

Modal cold start billing follows one rule, and the figure below draws it. It follows one request through seven stages, with the bill drawn under the timeline.

Seven stages of a request: call, schedule, boot, initialize, run, idle, zero. A bracket marks stages 2 to 4 as the cold start, and a bar under the timeline shows per second billing from boot through idle only.
Figure 2.2 The bracket marks the whole cold start (stages 2 to 4), which a warm container skips; billing runs from boot (stage 3) to the last idle second.
Use this diagram on your site

Free to share in your blog post, docs, course or slides, as long as the credit link stays. Paste the code below where the figure should go.

How to read this figure

  1. Start at Call and Schedule. At stage 1, an input arrives and joins the Function's queue. At stage 2, Modal picks a machine with the hardware you asked for. Both stages are waiting, not running, so they bill nothing.

  2. See where the meter starts. At stage 3, a container boots from your Image in about 1 second. The green bar under the timeline starts here. From boot on, every second bills.

  3. Read the Initialize stage. At stage 4, your imports run, plus any setup such as loading model files onto the GPU. The figure calls these the enter hooks: a method marked @modal.enter() runs once when the container starts, before any request. So a slow model load bills too.

  4. Read the bracket on top. The bracket over stages 2 to 4 is the cold start: the wait your user feels when no ready container exists. Only part of it bills. Stage 2, waiting for a machine, sits outside the green bar and is free. Stages 3 and 4, boot and load, sit inside it and bill. A warm container skips all three.

  5. Find the end of the bill. At stage 6, the container waits for more work. That wait is the scaledown window, 60 seconds by default, and it bills. At stage 7 the pool is gone and the cost is zero again. The four segments of a cold start shows how to shrink each part.

Key takeaways

  • Count the cost of a request from boot to the last idle second, never before.
  • Raise scaledown_window only when cold starts hurt more than the extra idle seconds cost.
  • Load your model once in an enter hook, so warm requests skip the load.

Worked example: one cold start and one idle window, priced

Take an L40S GPU, which Modal lists at $0.000542 per second. Price the two parts of a request that readers worry about.

  1. Stages 1 and 2: the input waits in the queue for a machine. That costs nothing.
  2. Stages 3 and 4: the container boots and loads the model. A 20 second load is 20 x $0.000542, about one cent; a 5 minute load is 300 x $0.000542, about $0.16.
  3. Stage 6 with a longer window: scaledown_window=300 keeps the container for 5 minutes. That adds at most 300 x $0.000542, about $0.16, after each burst.
  4. Stage 7: nothing runs, and the bill stops.

Result: On this card, even a slow cold start costs cents. The real cost is time: in the book's Chapter 9, a large model waits over a minute before its first answer. Only a warm container answers fast every time, and warmth bills idle seconds.

Questions readers ask

Do you pay for a cold start on Modal?

Partly. Modal bills from boot through the last idle second, so boot, model loading, work and idle time all bill. The queue before boot does not. If the GPU type you asked for is busy, your input waits in the queue, unbilled.

How long does a Modal container stay warm after a request?

60 seconds by default. That wait is the scaledown window, and you can set it from 2 seconds to 20 minutes, for example scaledown_window=300 for 5 minutes. A longer window means fewer cold starts and more idle seconds on the bill.

How do I avoid cold starts on Modal?

Keep containers warm with min_containers, buffer_containers or a longer scaledown window. Each one bills idle seconds: a container kept warm all day bills like a rented card. For setup heavy code, a memory snapshot restores a ready container instead. The book's Chapter 9 measures each lever.

What happens if one input runs too long?

Each input may run for at most 5 minutes by default. Past that it fails, and its seconds still bill. You can raise the limit with the timeout setting, up to 24 hours.

Sources: Cold start performance (Modal docs); Functions guide (Modal docs).

This figure is from Modal Made Crystal Clear, chapter 2.

The chapter builds the idea step by step, with recipes you can follow, a Try it to check yourself, and every source.

Get the book

All diagrams