Your tests can make 66,000 paid LLM calls a month before your first user
You wrote tests for your LLM feature, and they call the real model, because that feels like the honest way to test it. Say there are 100 of them, one call each, and the suite runs 30 times a working day: locally while you work, and again on every push. That's 66,000 paid calls a month. On GPT-5.6 a

You wrote tests for your LLM feature, and they call the real model, because that feels like the honest way to test it. Say there are 100 of them, one call each, and the suite runs 30 times a working day: locally while you work, and again on every push. That's 66,000 paid calls a month. On GPT-5.6 at list price it comes to $290, before a single user has signed up.
Model APIs bill per token, a chunk of text about three-quarters of an English word. Input tokens are what you send and output tokens are what the model writes back; output costs more. Prices are quoted per million tokens, and the ones vendors publish themselves are called list prices.
A test that calls the model is billed exactly like a user's request. The API can't tell them apart, and the 500th run of the same question is a new request. A vendor's prompt cache, a discount on input it has seen recently, can make the question cheaper, but the answer is written, and billed, again. So the monthly cost of your tests is calls per run × runs per day × working days × the price of one call. CI, the server that runs your tests on every push, grows the middle number without asking. A test watcher that reruns the suite on every file save grows it again.
My numbers are assumptions, not measurements: 100 model calls per run, 1,000 input and 200 output tokens each, 30 runs a working day, 22 working days a month. Put in your own.
List prices come from the catalog of the LLM gateway I work on, read on 25 October 2026. The last column is what's left if the model is called live only once a night, which is where the next section ends up.
On the two smallest models the test bill is noise. On the models people pick for quality it's a real line in the budget, and it grows with every push instead of every user. Running the tests on a cheaper model than production lowers the price, but then you're testing a model you don't ship. The fix that keeps your production model is to stop paying for answers you already have.
The idea is called record and replay: the first time a test sends a request, save the model's answer to a file, and every later run with the same request reads the file instead of calling the API. Libraries like vcrpy do this for HTTP requests in general. For one function, eleven lines of standard-library Python are enough:
import hashlib, json, pathlib def recorded ( call, folder = " llm_cassettes " ): def wrapper ( ** request ): key = hashlib. sha256 ( json. dumps ( request, sort_keys = True ). encode ()). hexdigest () path = pathlib. Path ( folder ) / f " { key [: 16 ] }.json " if path. exists (): # replay: no API call, no bill return json. loads ( path. read_text ()) reply = call ( ** request ) # record: one paid call path. parent. mkdir ( exist_ok = True ) path. write_text ( json. dumps ( reply )) return reply return wrapper paid = [] ask = recorded ( lambda ** r: paid. append ( r ) or { " label ": " positive " }) for _ in range ( 3 ): # three test runs ask ( model = " gpt-5.6 ", messages = [{ " role ": " user ", " content ": " Great phone! " }]) print ( f " 3 test runs, paid API calls: { len ( paid ) } " ) Enter fullscreen mode Exit fullscreen mode The lambda stands in for the real API call, so the snippet runs as is and prints 3 test runs, paid API calls: 1.
Run it again and it prints 0: the answer is already on disk. With the OpenAI SDK, the function you wrap is lambda **r: client.chat.completions.create(**r).model_dump().
Commit the folder, so CI replays the same answers. Change a prompt and its request no longer matches the saved one, so only that test pays again. Once a night, point folder at an empty directory and let every call reach the API: that's the 3,000-call column, under 5% of the calls. As a side effect, replayed runs can't fail because the API is slow, down or refusing requests at a busy hour.
Replay tests your code, not the model. If the vendor changes how a model behaves, or you switch models, the saved answers won't notice until the nightly live run. A saved answer is also one sample: the model may word it differently next time, so live tests should check structure, like valid JSON with the right keys, rather than exact text. And the files hold whatever your test inputs held, so keep real customer data out of them.
A lower price per token is no substitute. The gateway I mentioned sells gpt-5.6 at $1.70 / $10.20 against the list $2 / $12, which takes the every-run bill from $290.40 to $246.84. Replay takes it to $13.20, at list price.
Your tests are your first heavy user. Multiply calls per run by runs per month before you wire a live model into CI, then record each answer once and pay for live calls only when you mean to.