Skip to main content
Before continuing, create a Yir API key and export it as YIR_API_KEY. Generate one idempotency key for this logical request:
Reuse that value when retrying the same logical request. Generate a new value for a new task. Reusing one key with different request data is rejected.

KIE-compatible flow

Submit one GPT Image 2 text-to-image task:
Read the task ID from data.taskId, then query it:
The KIE-compatible terminal states are success and fail. While the task is active, the state is waiting or generating.

APIMart-compatible flow

Generate a new idempotency key because this is a new logical task:
Submit the task:
Read the task ID from data[0].task_id, then query it:
The APIMart-compatible terminal states are completed and failed. While the task is active, the status is pending or processing.

Production polling

Poll with a bounded interval and an overall deadline. Treat a transport timeout or an active status as unknown or still running—not as a confirmed generation failure. Keep querying the same task ID instead of submitting a replacement unless your application has made that retry decision explicitly.