Generating tests from an OpenAPI spec has not been a technical problem for a while. Models that can read a path item and emit a plausible request have been available for two years. The problem was the bill. Test generation cost enough per run that teams treated it as a one time migration: generate a suite once, commit it, then maintain it by hand forever, because regenerating on every spec change would have shown up as a line item somebody asked about.
GPT-6 Luna, announced on September 22, 2026 at $0.10 per million input tokens and $0.50 per million output, moves the job to the other side of that line. A full pass over a 42 endpoint spec works out to roughly $0.29 without caching and under $0.10 with it. That is cheap enough to stop maintaining a generated suite and simply regenerate it on every merge.
Here is the arithmetic, the request shape, the latency you have to plan around, and the two things the model still gets wrong.
The price that moved
GPT-6 Luna is a new model in the GPT-6 family, not a renamed GPT-5.6 tier. OpenAI says Sol and Luna were trained with similar methods to GPT-6 Astra, and that both are 50% cheaper than GPT-5.6 promotional pricing. That qualifier is OpenAI’s own and it matters: the comparison is against a promotional rate, not a list rate. Full lineage in our AI model price war roundup.
| GPT-6 Luna | |
|---|---|
| API id | gpt-6-luna |
| Input | $0.10 per million tokens |
| Output | $0.50 per million tokens |
| Cached input reads | 90% discount |
| Context window | 1,000,000 tokens |
| Artificial Analysis index | 37 |
For this job the context window matters more than the headline price. One million tokens means the whole spec, your house test conventions and a set of example requests fit in one prompt with room to spare. You are not chunking, and you are not writing retrieval logic to work out which schemas an operation depends on. More on the model in what is GPT-6 Luna.
Shape the job before you price it
Two shapes, very different costs.
The one shot version puts the entire spec in context and asks for the whole suite in one completion. Cheaper on input, worse on output: a completion covering 42 operations thins out badly by the twentieth, where the early endpoints get five cases each and the tail gets a happy path and a shrug. One retry unit for the whole run, too.
The per operation version sends the shared spec context plus one operation, 42 times. Input goes up because the shared context repeats, but output quality holds, each call is independently retryable, and each file diffs cleanly against the last run. Caching claws back most of the extra input cost, which makes this the shape to price.
Budget for one call, using a mid sized spec:
| Part of the call | Tokens |
|---|---|
| System prompt and house test conventions | 4,000 |
| Shared spec context: components, security schemes, servers | 48,000 |
| The single operation under test, plus its examples | 1,500 |
| Generated test file, returned | 3,000 |
The first two rows are byte identical on every call. That 52,000 token prefix is what caching acts on, and putting the invariant material first is the highest leverage decision in the setup.
What one pass costs
With 42 operations at that budget, the run comes to 2,247,000 input tokens and 126,000 output tokens.
At Luna rates that is $0.2247 of input and $0.0630 of output, so $0.2877 for the pass, a shade under seven tenths of a cent per endpoint. The same token profile against the other models that shipped or repriced in the same fortnight:
| Model | Input / output per million | Cost for this run |
|---|---|---|
| GPT-6 Luna | $0.10 / $0.50 | $0.29 |
| GPT-5.6 Luna, list rate | $1 / $6 | $3.00 |
| Grok 4.7 | $2 / $6 | $5.25 |
| GPT-6 Sol | $2 / $10 | $5.75 |
| Claude Opus 5.5 | $4 / $20 | $11.51 |
| Claude Opus 5 | $5 / $25 | $14.39 |
| GPT-6 Astra | $10 / $50 | $28.77 |
Astra is exactly 100 times Luna’s rate on both input and output, so it costs exactly 100 times as much on this job. Claude Opus 5.5 is 40 times.
That spread is the whole decision. At $28.77 a pass you build incremental logic: track which operations changed, hash each path item, regenerate only the diff, then debug that machinery when it drifts out of sync with the spec. At $0.29 you delete the incremental logic. Twenty merges a month is $5.75, less than the CI minutes spent running the tests the model wrote. For scale, OpenAI reports its median researcher spends more than $600 a day on coding agents, with the 90th percentile above $7,000.
Where prompt caching takes it
GPT-6 shipped a real caching release alongside the price change: a 90% discount on cached input reads, higher hit rates by default, a dashboard and a diagnostics tool, explicit breakpoints so you choose where the cached prefix ends, and cache survival across changes to reasoning effort and tool availability. GitHub reported more than 50% fewer prompt tokens needing fresh processing across billions of requests. Details in GPT-6 prompt caching.
Applied to the run above, taking 90% off the $0.10 input rate as $0.01 per million for cached reads:
| Line | Tokens | Cost |
|---|---|---|
| First call, 52,000 token prefix at full rate | 52,000 | $0.0052 |
| Remaining 41 calls reading the cached prefix | 2,132,000 | $0.0213 |
| Per operation content, never cached | 63,000 | $0.0063 |
| Output, unaffected by caching | 126,000 | $0.0630 |
| Total | $0.096 |
About a third of the uncached cost, a hair under a quarter of a cent per endpoint. Two things not to assume. OpenAI states the 90% discount but does not, in our sources, print a dollar cached read rate for Luna, so the $0.01 above is arithmetic, not a published rate. And nothing we have cites a cache lifetime, so fire the 42 calls back to back rather than spreading them across a slow CI queue, and confirm the hit rate in the dashboard.
The request
Nothing exotic. The ordering is what earns its keep:
curl https://api.openai.com/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6-luna",
"reasoning_effort": "high",
"messages": [
{ "role": "system",
"content": "You write API tests. Emit one test file. Assert on status, response schema and error shape. Never assert on a field absent from the supplied schema." },
{ "role": "user",
"content": "Shared spec context:\n<components, securitySchemes, servers>" },
{ "role": "user",
"content": "Operation under test:\nPOST /orders\n<path item and examples>" }
]
}'
The system prompt and shared spec block are byte identical on all 42 calls and come first. The operation varies and comes last. Swap the two and you cache nothing, so the run costs $0.29 instead of $0.096. That is the entire mechanic.
The high effort setting is deliberate. Luna’s published gains over its predecessor are measured at higher effort, and because GPT-6 caching survives an effort change you can dial it per operation without rebuilding the prefix. Save the top settings for endpoints that carry money or auth.
Budget time, not money
Cheap is not fast. Artificial Analysis, a third party, measures the max reasoning variant of Luna at 153.9 output tokens per second with a time to first token of 124.23 seconds. Both figures are theirs rather than OpenAI’s, both apply specifically to the max variant, and AA rescores continuously, so treat them as directional.
Taken at face value, one call at max effort is roughly 124 seconds of waiting plus about 20 seconds to stream 3,000 tokens, call it 144 seconds. Forty two in sequence is about 101 minutes. Eight concurrently is about 13 minutes, an ordinary CI stage.
This cuts the opposite way from most model selection arguments, which is why the pairing works: time to first token is a disaster for an interactive assistant and close to irrelevant for a batch job that writes files. Same tradeoff on the larger sibling in GPT-6 Sol’s time to first token.
What it gets right, and the two things it does not
OpenAI’s published results for Luna are stronger than the price suggests. On DeepSWE 1.1 it reaches 66.6% at max effort, which OpenAI puts on par with Claude Opus 5 and Fable 5 at medium effort while costing 93% less per task than Opus 5 and 96% less than Fable 5. On AutomationBench it beats its predecessor by 5.4 percentage points at 58% lower cost per task. All are OpenAI run on OpenAI harnesses, and none measures test generation from a spec.
Two failure modes matter more here than any benchmark.
The model can only test what the spec says. If your spec documents a 200 and a 400 for POST /orders but the service also returns 409 on a duplicate idempotency key, you get no conflict test and the suite still looks complete. Generation quality is bounded by spec quality, which makes the spec the artifact worth investing in, not the prompt.
Cheap generation fails by looking right. The characteristic error is not a broken test, it is a passing test asserting on a field the response never contains, or a status code the endpoint never emits. Those clear review because they read like tests. Validate every generated assertion against the schema mechanically before it lands, rejecting any that references a field absent from components. That check costs nothing and kills the class outright.
Making the output runnable
Generated test files are worth exactly as much as the harness they run in. Keep the spec as the source of truth, generate against it, then land the cases somewhere they execute on every push.
Apidog covers the back half of that loop. It imports the spec you are generating from, so the shared context in your prompt and the request definitions in your runner come from one document and cannot drift. Generated cases become test scenarios whose assertions validate against the imported schema, turning the check above into a mechanical gate rather than a review chore. Smart mock serves the spec while the backend is still being written, so a generated suite can fail honestly before there is anything real to hit. And the scenarios run in CI, the only place a regenerate on every merge workflow pays off.
Is this worth routing to Luna?
Yes, with a caveat. Cost is no longer a reason to skip it: $0.29 a pass, or under $0.10 cached, is less than the meeting where you debate whether to regenerate. The latency is real but lands in a window where nobody is waiting. And Luna’s published results put it near models costing 40 to 100 times more on agentic coding work.
None of that makes the output trustworthy on arrival. Spend what you saved on a schema validation gate and a human read of the first run, and treat the result as a first draft that covers the documented surface completely and the undocumented surface not at all. Still a better starting position than the hand written suite that stopped tracking the spec four releases ago.



