Skip to main content
Apidly

Optional cookies only if you accept. Cookie policy

Per-second vs hourly billing, worked out

Worked examples of per-second vs hourly GPU billing, including idle serverless workers, model loading and stopped servers.

Published December 3, 20267 min read

A price quoted per hour does not tell you what a job costs. The billing rule does: whether time is rounded up to the hour, what counts as running time, and what keeps charging when you are not looking. This post works through the arithmetic for three common patterns, using the rules Apidly applies. The prices are invented to keep the sums easy; your real prices are shown in the deploy wizard before you start anything.

Assume a GPU plan that costs $1.20 per hour for compute and $0.01 per hour for its disk.

The rule, stated once

On Apidly every plan has an hourly price, and the charge for a period is:

price per hour x seconds / 3600

Compute is charged for each second a server is in the running state, and the charges are booked to your prepaid balance about every minute. Disk storage is charged for each second the server exists after it is ready, including while it is stopped, until you destroy it. Time spent finding a machine and pulling the image is not charged as compute. If a server fails to start, you are not charged for it.

Under an hourly rule, the same period would be rounded up to whole hours, so a 5-minute task costs a full hour. The difference matters most for short and spiky work.

Example 1: a short job

You run a batch job that takes 25 minutes, then stop the server.

Rule Compute charged Cost
Per second 1,500 s 1.20 x 1,500 / 3,600 = $0.50
Rounded up to the hour 3,600 s $1.20

The per-second charge is 42 percent of the hourly one. Run the job ten times a day and the gap is $5.00 against $12.00 in compute.

The same example shows what per-second billing does not do. It does not make idle time free. If you start the job, go to lunch and come back 90 minutes later, you pay for the 90 minutes. The saving comes from stopping when you are done, not from the rounding alone.

Example 2: stopped is not the same as gone

You stop the server at the end of the day and come back in three days.

  • Compute while stopped: $0.
  • Disk while stopped: 72 hours x $0.01 = $0.72.

A stopped server keeps its disk (and anything you installed or downloaded on it), so the disk keeps charging until you destroy the server. If the disk holds nothing you cannot recreate, destroy it. If it holds a downloaded model, compare the disk price for the idle period with the cost of downloading again. The break-even depends on the model size and the disk price, both of which you can read before you decide.

Example 3: a serverless endpoint

A serverless endpoint is where per-second billing matters most, and where the rules are easiest to misread. There is no price per request. Every worker is an ordinary server, billed at its hourly price by the second, from the moment it is running until it is released. Four consequences:

  1. Loading the model is billed. The worker's start script downloads and loads the weights while the server is already running, so that time counts. Finding a machine and downloading the container image before that does not.
  2. Idle time is billed. A worker with nothing to do keeps charging until the scaler releases it. The scaler checks once a minute, so with an idle timeout of 60 seconds a worker is released between one and two minutes after its last request.
  3. Scale to zero costs nothing at rest. With a minimum of zero workers, nothing is billed once the idle timeout has released the last worker. The price is a cold start on the next request.
  4. A start-up charge may apply. Where it is shown on the configure step, each worker start also adds a fixed number of seconds of compute at the worker's hourly price. Check the pricing page for whether it applies to your plan; the examples below leave it out.

Now put numbers on it. Suppose your traffic arrives in 6 bursts a day. Each burst makes a worker start, which spends 3 minutes loading the model, then 2 minutes serving. The idle timeout is 60 seconds.

  • Billed time per burst: 3 + 2 minutes, plus 1 to 2 minutes of idle before release, so 6 to 7 minutes, or 360 to 420 seconds.
  • Cost per burst: $1.20 x 360 / 3,600 = $0.12, up to $1.20 x 420 / 3,600 = $0.14.
  • Per day: $0.72 to $0.84.

Compare the alternatives for the same traffic:

Setup Compute per day
Scale to zero, 60 s idle timeout $0.72 to $0.84
Scale to zero, 600 s idle timeout (the "always one warm" preset uses this timeout with a minimum of one) about $1.80 to $1.92
One worker always running (minimum 1) 24 x $1.20 = $28.80
Each burst rounded up to a full hour 6 x $1.20 = $7.20

The 600-second row is 3 + 2 minutes of work plus 10 to 11 minutes idle, so 15 to 16 minutes at $0.02 per minute, or $0.30 to $0.32 per burst, times 6.

A longer idle timeout is not a mistake; it buys something. If the next burst arrives within the timeout, the worker is still there and nobody waits for a cold start. Set the timeout by asking how often the gap between requests is shorter than the cold start: if bursts are frequent, a longer timeout can actually cost less than starting and loading repeatedly, because loading time is billed on every start.

You can compare the two directly. A worker kept warm for a gap of g minutes costs $0.02 x g. Releasing it and loading again costs $0.02 x 3 minutes of load, which is $0.06 here, and adds the wait for the user. For any gap shorter than 3 minutes in this example, keeping the worker is cheaper as well as faster.

What a warm pool changes

Instead of releasing a worker, the endpoint can stop it into a warm pool. A stopped worker is billed for its disk only, not its GPU, and starts again faster because the image and the model are already on its disk. If the endpoint keeps a model cache, the cache is part of the disk and is billed at the plan's normal storage price per GB, for every worker that exists, running or stopped. With a made-up disk price of $0.0007 per GB per hour, a 50 GB cache costs $0.035 per hour per worker, $0.84 a day. That is the price of faster restarts. A stopped warm worker can still fail to start if its machine was taken, in which case it is released and replaced, so the pool shortens most cold starts without guaranteeing any.

Guardrails that cap the bill

Per-second billing is only as safe as your limits. Three controls exist on endpoints:

  • Spending cap per hour: the endpoint never runs more workers than that amount pays for.
  • Monthly cap: at the cap the endpoint pauses and releases its workers. By default it stays paused until you raise the cap or choose to resume at a new month.
  • Maximum workers: a hard limit on parallelism.

Before a new worker starts, your balance must cover at least an hour of it. If the balance reaches zero, you get an email and a grace period, then running servers are stopped while their disks keep charging. Auto top-up avoids that.

A checklist

  1. Estimate the job in seconds, multiply by the hourly price and divide by 3,600. That is the compute.
  2. Add the disk for every second the server exists, stopped or not.
  3. For serverless, count load time and idle time per start, not just the time spent answering.
  4. Choose the idle timeout from your real gap between requests, and check the cost per 1,000 calls on the endpoint's metrics page after a day of traffic.
  5. Set a cap before you hand the endpoint address to anyone.

Per-second billing removes the penalty for short work. It does not remove the cost of forgetting to stop something, and the examples above show where that cost hides.

Try what this guide shows

Try it on a real GPU server

Create a free account and add a balance from $10. Servers are billed by the second, and the review step shows the price per hour before you request one.

Related guides