跳到內文
Cheapest Imagen
API 參考

查詢任務

非同步請求的狀態:先是 `in_progress`,結束後是帶圖片的 `succeeded` 或帶錯誤的 `failed`。任務在圖片保存期內(72 小時)都能查。建議每隔幾秒查一次;查詢任務不佔「進行中的請求」名額。同時等多個任務時,請用 `GET /images/tasks?ids=` 一次查完。

GET
/images/tasks/{id}

非同步請求的狀態:先是 in_progress,結束後是帶圖片的 succeeded 或帶錯誤的 failed。任務在圖片保存期內(72 小時)都能查。建議每隔幾秒查一次;查詢任務不佔「進行中的請求」名額。同時等多個任務時,請用 GET /images/tasks?ids= 一次查完。

Authorization

apiKey
headerAuthorizationBearer <token>

你的 API 金鑰,放在請求標頭裡:Authorization: Bearer <金鑰>。

Path Parameters

id*string

任務編號:202 回傳裡的 id,也就是那次請求的 x-request-id。

Match^req_[0-9a-f]{24}$

Response Body

任務。

application/json
  1. response
id*string

任務編號:202 回傳裡的 id,也就是那次請求的 x-request-id。

object*"image.task"
Value in"image.task"
status*string

請求結束前是 in_progress,之後是 succeeded 或 failed。

Value in"in_progress""succeeded""failed"
created*integer

請求被接受的時間,Unix 時間戳(秒)。

finished*|

結束時間;進行中時為 null。

model*string
result?

succeeded 時出現:和同步呼叫回傳的內容相同。

error?

failed 時出現:和同步呼叫回傳的錯誤相同。失敗的任務不扣費,Nano Banana 穩定通道被內容檢查拒絕的除外。

Example Request
curl -X GET 'https://api.cheapestimagen.com/v1/images/tasks/string'
Example Response
{  "id": "string",  "object": "image.task",  "status": "in_progress",  "created": 0,  "finished": 0,  "model": "string",  "result": {    "created": 0,    "data": [      {        "b64_json": "string",        "url": "http://example.com"      }    ]  },  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}