Skip to content

Get image task

Poll the status and result of async GPT Image / Gemini image tasks (`Prefer: respond-async`).

GET/v1/images/tasks

Create image or Edit image with Prefer: respond-async returns 202 and a task_id immediately; then query it with this endpoint. The task ID can only go in the task_id query parameter, not in the path.

The status goes through pending / processing / retrying; the terminal states are completed and failed. When done, read result_content: one line per image, ![image](/assets-runtime/…), as a relative path; prepend https://api.hop-base.com to access it. The URL opens without a key, so do not share it publicly; download it to your own storage soon after completion and do not treat it as long-term storage.

Only problems found during generation (such as a Gemini reference image failing to download or the model refusing) make the task fail; in that case only an error string is returned, with no error code. Submission only checks that the balance is above 0 and reserves nothing; after a terminal state, usage shows the actual charge, visible only to the key that created the task.

Kling and Midjourney images do not use this endpoint; use Get video task.

Headers

Authorization:requiredstring

Bearer sk-…: an API key created in the console under API keys; its group must include the requested model

Query parameters

task_id:requiredstring

The task_id returned at submission

Length≥ 1 chars

Returns

200Task object (including failed tasks)

task_id:requiredstring

Task ID

status:requiredstring

pending / processing / retrying are in progress; completed / failed are terminal

Valuespendingprocessingretryingcompletedfailed

result_content:optionalstring

Result when done: Markdown, one line per image, ![image](/assets-runtime/…). The URL is a relative path; prepend https://api.hop-base.com to access it. It opens without a key, so do not share it publicly, and download it soon

error:optionalstring

Failure reason (an English string, no error code); present only when failed

usage:optionalobject

Present once the task is completed or failed; visible only to the key that created the task

Errors

401Missing, invalid or expired API key (missing_api_key / invalid_api_key / api_key_expired)

Related