JIUFENG API

Query tasks

Poll task status and fetch result images with a task_id.

GET /v1/tasks/{task_id}

Query a task with the task_id you got on submission. The response uses the platform envelope { code, data }.

curl https://api.jiufeng.ai/v1/tasks/task_01M0CGM9MRSMD6R6PPNQWXQZ77 \
  -H "Authorization: Bearer sk-jf-live-YOUR_KEY"

Status values

data.status has exactly four public values:

statusMeaningTerminal
pendingSubmitted / queuedNo
processingGeneratingNo
completedSucceededYes
failedFailedYes

The real status values are pending / processing / completed / failed. Do not branch on legacy values like queued / success.

Response fields (data)

FieldTypeDescription
idstringTask id (the same task_id returned on submission)
statusstringpending / processing / completed / failed
progressstringProgress, e.g. 100%
createdintegerSubmission time (Unix seconds)
estimated_timeintegerEstimated duration (seconds)
completedintegerCompletion time (Unix seconds; terminal states only)
actual_timeintegerActual duration (seconds; terminal states only)
credits_costintegerCredits consumed
resultobjectPresent on success (see below)
errorobjectPresent on failure (see below)

result (success)

FieldTypeDescription
urlstring[]Result image URLs (platform domain token-img.jiufeng.ai)
expires_atintegerExpiry (Unix seconds; 24 hours after completion)
image_idsstring[]Platform ids of the result images

error (failure): { message, type, param, code }.

Success example

{
  "code": 200,
  "data": {
    "id": "task_01M0CGM9MRSMD6R6PPNQWXQZ77",
    "status": "completed",
    "progress": "100%",
    "created": 1785076811,
    "completed": 1785076816,
    "actual_time": 5,
    "credits_cost": 12,
    "result": {
      "url": ["https://token-img.jiufeng.ai/f/image/xxx_0.png"],
      "expires_at": 1785163216,
      "image_ids": ["img_01M0..."]
    }
  }
}

Failure example

{
  "code": 200,
  "data": {
    "id": "task_01M0CGM9MRSMD6R6PPNQWXQZ77",
    "status": "failed",
    "error": {
      "message": "content policy violation",
      "type": "invalid_request_error",
      "param": "prompt",
      "code": "content_policy"
    }
  }
}

Polling tips

  • Exponential backoff: start around 1s and stretch to a few seconds between calls; don't busy-loop.
  • Result image URLs expire 24 hours after completion — download or re-host them to your own storage promptly.
  • To skip polling entirely, use Webhook callbacks.

Batch query POST /v1/tasks/batch

Query many tasks at once (simplified: each task returns only id and status, no result). Send task_ids (an array of task_id, default limit 500). Beyond the four standard states, batch may also return invalid_id / expired / not_found for the corresponding id.

curl https://api.jiufeng.ai/v1/tasks/batch \
  -H "Authorization: Bearer sk-jf-live-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "task_ids": ["task_01M0...", "task_02N1..."] }'
{
  "code": 200,
  "data": [
    { "id": "task_01M0...", "status": "completed" },
    { "id": "task_02N1...", "status": "processing" }
  ]
}

To fetch result images, call GET /v1/tasks/{task_id} on each completed task.

On this page

Query tasks · Jiufeng Open API