Skip to main content
Store task_id with the model, your own job ID, the submit time, and a business deadline. The task endpoint cannot reconstruct application context that the client did not save.

A bounded Python worker

The deadline limits both normal polling and rate-limit waits. Also bound network retries around each GET and persist state transitions before acknowledging work to another service. Gemini and GPT Image deliberately keep different result shapes. Do not run a single result.data[].mime_type parser across both families. progress is a status hint, not an ETA, and clients do not need to observe every intermediate state.

Inspect the task schema

Review provider-native results, structured errors, and expiry.

Review task submission

Add an idempotency key and persist the returned task ID.

Handle retry decisions

Retry only the failures that are safe within your deadline.
Last modified on September 3, 2026