Skip to content

Why did chat return a 202 generation job instead of choices?

The chat route returns a normal completion only when content and usage are confirmed. If the outcome cannot be confirmed, it can return a durable generation job with HTTP 202 instead. Save that job ID and status. Do not assume choices is merely missing from a successful answer or immediately send a fresh paid completion.

BUILD NON-STREAMING TEXT WORKFLOWSAISwapLab team · Editorial methodPublished 2 min read
Open API documentationExplore 67 Image SkillsPrivate keys · Explicit credit approval
Article workflow: Inspect status and object shape; Represent uncertainty visibly; Reconcile the existing work.
Workflow diagram: Inspect status and object shape → Represent uncertainty visibly → Reconcile the existing work. Read the article for evidence and limits.

Your parser needs two intentional branches

Image and video clients already expect jobs, but a generic chat widget may assume every 2xx response contains choices[0].message.content. That assumption loses uncertainty information. The returned job is evidence that the task was tracked; it is not a guarantee that polling can recover an upstream answer when no provider identifier exists.

What to do next

  1. 01

    Inspect status and object shape

    Before reading choices, check whether the response is a chat completion or a generation record. Persist the latter with the original task and idempotency identifier.

  2. 02

    Represent uncertainty visibly

    Show the user that the outcome is not confirmed. Keep the task in their history and avoid converting a parser exception into another automatic generation request.

  3. 03

    Reconcile the existing work

    Use the documented status path and safe support details when needed. Compare confirmed usage and returns before claiming the request was free, refunded or completed.

A concrete example

Illustrative failure: a chat UI treats a 202 job as an empty answer and retries with a new UUID. That can create duplicate spending. A correct parser retains the first durable task and follows its uncertainty path.

Before you call it ready

  • Both completion and job shapes are handled.
  • The original identifier survives.
  • No new request is triggered by a missing choices field alone.

When to stop or choose another method

If your UI cannot display pending or uncertain text work, add that support before offering the route. A synchronous-looking interface must not erase a real uncertain outcome.

Sources

One task. A recoverable workflow.

Check the contract, approve the quote and retain the job.

Open API documentation