Open API
REST API for creating image / video generation tasks. Authenticate with a sk- key from your account page.
Manage API KeysAuthentication
All requests require a bearer token. Generate one from your account page.
Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxAvailable Models
The model_id values below are the only ones accepted by the open API.
| model_id | Capability | Output |
|---|---|---|
seedance-2 | Seedance 2.0 (text / image to video) | video_url |
gpt-image-2 | ChatGPT Image 2 (text / image to image) | image_url |
nano-banana-2 | Nano Banana 2 (text / image to image) | image_url |
Create Task
Submit a generation request. The response returns a task_id you can poll.
POST
/api/v1/tasks/createRequest Body
{
"model_id": "gpt-image-2",
"prompt": "a serene zen garden at sunrise, ultra detailed",
"image_urls": [],
"aspect_ratio": "16:9"
}cURL Example
curl -X POST https://your-site.com/api/v1/tasks/create \
-H "Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model_id": "gpt-image-2",
"prompt": "a serene zen garden at sunrise",
"aspect_ratio": "16:9"
}'Response
{
"code": 200,
"msg": "提交成功,等待生成",
"data": {
"task_id": "abcdef123456",
"request_id": "kie_xxxxxxxxxxxx",
"credits": 15
}
}Credits are deducted on submit. Failed tasks are auto-refunded.
Query Task
Poll the task by id until task_status reaches 3 (success) or 4 (failed).
GET
/api/v1/tasks/{task_id}cURL Example
curl https://your-site.com/api/v1/tasks/abcdef123456 \
-H "Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"Response
{
"code": 200,
"msg": "ok",
"data": {
"task_id": "abcdef123456",
"task_status": 3,
"task_type": "image",
"model_id": "gpt-image-2",
"image_url": "https://your-cdn.com/...",
"video_url": null,
"audio_url": null,
"credits": 15,
"created_at": 1730000000
}
}task_status: 1 queued, 2 running, 3 success, 4 failed.
Errors
code: 200— Successcode: 0— Business failure (see msg field for details)HTTP 401— Invalid or missing API key