3/41
Part 1 of 7 · The batch APILearn and do

A batch API trades speed for half the price

Start with what a batch API promises its customers, because the design follows from that promise.

Work that can wait gets a 24-hour window

One batch's window
the first hourmost of it is done
hours 1 to 24slack, for interactive peaks, retries and a bad deploy
hour 24what's left expires

Interactive inference answers while someone waits, so every second in a queue is a second of latency.

Batch inference takes requests that can wait for hours:

  • an eval over 50,000 prompts
  • a classification pass over a support backlog
  • summaries of a document archive

The customer sends them together in one file and collects the results later.

The contract is a window, not a latency. Most batches finish in under an hour, and the promise is 24. Everything in between is slack. The scheduler can spend it on interactive peaks, on retries and on bad deploys.

In the editor, write plan(jobs). Each job is a name, the hours until its result is needed, and its cost at standard prices. Return the jobs that can wait the whole 24-hour window, and the total bill when those jobs pay half.