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
- 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.
- 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.
- 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.
