This guide reflects the current developer-preview contract: GPT Image 2 text-to-image through the certified KIE-compatible and APIMart-compatible routes. It does not promise unreleased models or arbitrary provider forwarding.
Authenticate safely
Keep the Yir API key on the server and send it only as a Bearer credential.
Track one logical request
Persist the idempotency key and task ID before polling.
Handle uncertain outcomes
Retry queries without turning a timeout into a second generation request.
Submission contract
1
Create an idempotency key
Generate one opaque value for one logical generation request. Reuse it only when retrying the identical request.
2
Submit through one compatible surface
Choose the KIE-compatible or APIMart-compatible shape your application already understands. Do not send an upstream provider credential.
3
Persist the returned task ID
Store the task ID with your local request record before starting background polling.
4
Poll to a terminal state
Use a bounded interval and an overall application deadline. Continue querying the same task after transient transport failures.
Required headers
string
required
A Yir credential in the form
Bearer $YIR_API_KEY.string
required
A caller-generated opaque identifier for the logical request. The same value with different request data is rejected.
Submit from your backend
string
required
Stable APIMart-compatible task identifier to persist and query.
Choose a compatible surface
- KIE-compatible
- APIMart-compatible
Submit with
POST /kie/api/v1/jobs/createTask, read data.taskId, and query GET /kie/api/v1/jobs/recordInfo?taskId=....Polling and recovery
How fast should I poll?
How fast should I poll?
Start conservatively, add jitter, and enforce an overall deadline in your application. A polling timeout is not proof that generation failed.
Should I submit a replacement when a task is slow?
Should I submit a replacement when a task is slow?
No. Query the existing task ID. A second submit represents a second logical request unless it is an idempotent retry of identical data.
What may I include in support evidence?
What may I include in support evidence?
Include the Yir task ID, source path, approximate UTC time, HTTP status, public error code, and a safe key prefix. Never include the complete key, prompt, source media, or raw provider response.
Your integration is ready for a controlled test when it persists both identifiers, reuses the idempotency key for submit retries, polls the same task ID, and never exposes the Yir API key to browser code.