Set a Retry Budget for Flex AI Processing Before Standard Fallback
Last reviewed: 2026-08-25
Direct answer
A Flex retry budget should be three separate limits, not a single “retry three times” setting:
- Flex attempt limit: the maximum number of Flex submissions for one logical job.
- Flex time limit: the latest time a result can arrive and still be useful.
- Fallback limit: the amount of standard-tier work you will authorize after Flex is exhausted.
Start with an example policy of three Flex attempts in total (one initial request and two retries), a 90-second Flex deadline for a background task, and one standard fallback attempt. Treat those numbers as a canary baseline, then tune them from observed latency and completion data. A retry budget is a cost-control decision because every additional attempt can delay a deadline, duplicate work, or trigger a higher-priced route.
The economic case is real but conditional. OpenAI’s Flex processing documentation describes Flex as a lower-cost tier for Responses and Chat Completions requests, with slower response times and occasional resource unavailability. It says Flex tokens are priced at Batch API rates. The Batch API documentation describes a 50% cost discount versus synchronous APIs, but your model’s current pricing page remains the authority for an estimate. Do not turn that headline into a permanent promise for every model.
Use this happy path:
- Confirm that the selected model supports Flex and that the workload can wait. Record the model, route, estimated input and output tokens, and the business deadline before submitting.
- Submit with the Flex tier and attach a logical job identifier. Keep the request body stable so a retry is the same unit of work, not an accidental new task.
- On success, record the actual service tier, status, elapsed time, token counts, and whether the result passed validation. Close the retry budget; do not issue a “verification retry” just because capacity is available.
Use this error path:
- If OpenAI returns the documented
429 Resource Unavailablecapacity error, mark the attempt as a capacity failure. OpenAI says requests that fail for this reason are not charged. Apply exponential backoff and consume the next Flex attempt only if the deadline still has room. - If a request times out, do not assume it was free. Mark billing state as unknown, reconcile usage when your provider exposes it, and avoid replaying a long request blindly.
- When the attempt or time limit is reached, make one deliberate choice: use the standard tier because the deadline has priority, or abandon the job and report the miss. That choice should be visible in the log and in the budget forecast.
Here is a sanitized event shape that is sufficient for a cost review without collecting credentials or prompt contents:
{
"job_id": "flex-01",
"request_id": "req-7",
"model": "gpt-5.6",
"requested_tier": "flex",
"attempt": 1,
"outcome": "capacity_unavailable",
"http_status": 429,
"error_code": "resource_unavailable",
"elapsed_ms": 1800,
"input_tokens": 420,
"output_tokens": 0,
"billing_state": "not_charged_per_provider_error",
"fallback": "not_used"
}
Who this is for
This policy is for FinOps owners, platform engineers, and product teams running evaluations, data enrichment, document extraction, report generation, or other background work. It is especially useful when a queue can absorb variable latency and a standard-tier call would consume more of the approved budget.
It is not a default for a chat turn, inline copilot suggestion, real-time voice path, or any workflow that blocks a person. An independent Flex processing guide from the Institute of AI Product Management makes the same distinction: Flex is suited to background work, while user-visible and SLA-sensitive paths need predictable latency. A retry budget cannot repair a workload whose latency requirement is incompatible with Flex.
Key takeaways
- Define attempt, elapsed-time, and fallback ceilings independently. A low attempt count does not protect a user deadline if backoff is too long.
- Classify errors before retrying. OpenAI’s explicit no-charge statement is for
Resource Unavailable; it is not a blanket rule for every timeout, validation error, or rate-limit response. - Price Flex and standard work separately in the ledger. Tag the requested tier and the served tier so a gateway fallback cannot hide a higher-priced completion.
- Use a canary of representative jobs before moving a large queue. Measure p50 and p95 latency, capacity-error rate, timeout rate, successful completion rate, and fallback share.
- Keep route evidence with the job. The existing CometAPI retry-spend evidence guide is a useful companion for organizing those observations.
Sources checked
The policy is grounded in five public sources, each used for a different contract detail:
- OpenAI Flex processing
defines the Flex service tier, its lower-cost/variable-latency tradeoff, supported-model caveat, timeout guidance, and
429 Resource Unavailablebehavior. - OpenAI Batch API supplies the comparison baseline: Batch processing is asynchronous, uses a 24-hour completion window, and is documented as 50% cheaper than synchronous APIs.
- OpenRouter service tiers
documents gateway-specific routing. An explicit
service_tier: "flex"request is restricted to Flex endpoints when they exist; it does not silently fall back to a default endpoint, and a capacity error can surface instead. - Datablist’s Flex Mode guide provides an independent, current operator example covering model checks, previews, timeout handling, row-level retries, and moving urgent rows to standard processing.
- The Institute of AI Product Management’s Flex guide compares Standard, Flex, and Batch mechanics and explains why background queues are a better fit than interactive features.
These sources do not establish one universal retry count or a guaranteed response time. Those values belong in your own policy and should be backed by measurements from your traffic.
Contract details to verify
Before enabling the policy in production, write down the answers to these checks:
| Contract item | What to verify | Budget implication |
|---|---|---|
| Model eligibility | Is this exact model listed as Flex-capable today? | An unsupported model may route at standard pricing or fail before work starts. |
| Price basis | What are the current input and output rates for Flex and standard? | The retry and fallback forecast must use the model-specific rates, not an old percentage. |
| Error semantics | Does the provider identify capacity failure separately from rate limiting and validation errors? | Only the documented capacity error should receive the no-charge treatment. |
| Timeout | What client and queue deadline applies, and can the job still be useful after it? | A retry that passes the API timeout can still miss the business deadline. |
| Served tier | Does the response expose the tier that actually served the request? | Requested-tier logs alone can understate standard fallback spend. |
| Gateway routing | Does an explicit Flex request stay on Flex, or can the gateway select another endpoint? | A hidden route change can invalidate the cost model. |
| Batch alternative | Would a file-based asynchronous job meet the requirement? | Batch may provide the same discount with a different integration and a longer completion contract. |
Flex can also stack with prompt-caching discounts according to the OpenAI guide and the independent Institute guide. If you rely on that combination, log cached and uncached token categories separately; otherwise the apparent retry savings may actually be a prompt-shape change.
Failure modes
Retrying every 429. A generic 429 handler can treat a capacity error, a rate-limit response, and a project-control response as interchangeable. Parse the provider error code first. For OpenAI, only the documented Resource Unavailable case gets the explicit no-charge interpretation. For any other 429, stop or apply the separate rate-limit policy.
Unbounded exponential backoff. Backoff reduces pressure but can consume the whole useful window. Compute the next delay against both the remaining attempt count and the business deadline. If the next delay would leave no time for a standard fallback, skip it and make the documented fallback decision.
Immediate standard fallback. One transient capacity error is not evidence that Flex is uneconomic. A canary policy should allow a small number of retries when the deadline permits. Track the fallback share; if it rises above the approved threshold, pause migration and investigate capacity or model eligibility.
Silent tier changes. OpenRouter’s documentation is a good reminder that tier behavior is provider-specific: explicit Flex routing can surface a capacity error rather than use a default endpoint. Do not infer behavior from a different gateway. Store both requested_tier and served_tier, and alert when they differ.
Replay after an ambiguous timeout. A client timeout does not tell you whether the provider completed the request. Reconcile the provider’s usage or result record before resubmitting. If the operation is not safely repeatable, send it to review rather than creating a second billable completion.
Using Flex on a blocking path. A lower token price is not a saving if a customer abandons the screen, an SLA penalty is triggered, or a downstream worker idles. Move the work to a queue, show progress, or keep it on standard processing.
Logging too much. Cost evidence does not require prompt text, response text, or credentials. Keep the sanitized fields above, hash or omit business payloads, and use [REDACTED] for any secret value that a platform log accidentally receives.
For a second review of the error side of the decision, use the CometAPI error-and-cost signal checklist alongside this retry policy.
FAQ
Is Flex the same as Batch?
No. OpenAI documents Flex as a service tier on normal Responses or Chat Completions requests. Batch is a separate asynchronous file workflow with a stated 24-hour completion window. They can share a price basis, but they have different queue, monitoring, and retry mechanics.
How many Flex retries should I allow?
There is no provider-published universal number. Start with a small, explicit budget—three total attempts is a reasonable canary for a deadline-tolerant job—then adjust from measured capacity failures, successful completions, elapsed time, and fallback share. Set a time ceiling as well; attempts alone are not a latency policy.
Are all failed Flex requests free?
No. OpenAI’s documentation specifically says a 429 Resource Unavailable response is not charged. Keep timeouts, malformed requests, policy errors, and other responses in a separate billing state until your usage record is reconciled.
When should I use Batch instead of Flex?
Use Batch when the job can be submitted as a file and results can arrive within the documented completion window. Use Flex when you need the ordinary request APIs but can tolerate slower, less predictable processing. If a person is waiting, standard processing is usually the safer contract.
Can a gateway automatically fall back to standard pricing?
It depends on the gateway and route setting. OpenRouter says an explicit Flex service tier is restricted to Flex endpoints and does not fall back to a default endpoint when Flex capacity is unavailable. Confirm the behavior of your own gateway and record the served tier rather than assuming it.
Reader next step
Take one representative background workload and create a one-page retry policy today:
- Name the model, workload owner, and business deadline.
- Set total Flex attempts, maximum Flex elapsed time, and the maximum standard fallback share.
- Add the sanitized event fields from this article to your gateway log.
- Run a small canary, then compare completion rate, p95 elapsed time, capacity-error rate, and fallback spend with the forecast.
- Approve a wider rollout only when the measured fallback share and total cost fit the budget.
Then link the evidence to your existing CometAPI retry-spend review workflow and update the route decision whenever model eligibility or pricing changes. The next useful action is not another blanket retry: it is a measured canary with a stop condition.