193 lines
5.4 KiB
Markdown
193 lines
5.4 KiB
Markdown
Seedream 4.5 is Bytedance’s refined image model for 4K generation, precise editing, and consistent multi-image output.
|
||
|
||
POST
|
||
/api/v1/jobs/createTask
|
||
Create Task
|
||
Create a new generation task
|
||
|
||
Request Parameters
|
||
The API accepts a JSON payload with the following structure:
|
||
|
||
Request Body Structure
|
||
{
|
||
"model": "string",
|
||
"callBackUrl": "string (optional)",
|
||
"input": {
|
||
// Input parameters based on form configuration
|
||
}
|
||
}
|
||
Root Level Parameters
|
||
model
|
||
Required
|
||
string
|
||
The model name to use for generation
|
||
|
||
Example:
|
||
|
||
"seedream/4.5-edit"
|
||
callBackUrl
|
||
Optional
|
||
string
|
||
Callback URL for task completion notifications. Optional parameter. If provided, the system will send POST requests to this URL when the task completes (success or failure). If not provided, no callback notifications will be sent.
|
||
|
||
Example:
|
||
|
||
"https://your-domain.com/api/callback"
|
||
Input Object Parameters
|
||
The input object contains the following parameters based on the form configuration:
|
||
|
||
input.prompt
|
||
Required
|
||
string
|
||
A text description of the image you want to generate
|
||
|
||
Max length: 3000 characters
|
||
Example:
|
||
|
||
"Keep the model's pose and the flowing shape of the liquid dress unchanged. Change the clothing material from silver metal to completely transparent clear water (or glass). Through the liquid water, the model's skin details are visible. Lighting changes from reflection to refraction."
|
||
input.image_urls
|
||
Required
|
||
array(URL)
|
||
Upload an image file to use as input for the API
|
||
|
||
File URL after upload, not file content; Accepted types: image/jpeg, image/png, image/webp; Max size: 10.0MB
|
||
Example:
|
||
|
||
["https://static.aiquickdraw.com/tools/example/1764851484363_ScV1s2aq.webp"]
|
||
input.aspect_ratio
|
||
Required
|
||
string
|
||
Width-height ratio of the image, determining its visual form.
|
||
|
||
Available options:
|
||
|
||
1:1
|
||
-
|
||
1:1
|
||
4:3
|
||
-
|
||
4:3
|
||
3:4
|
||
-
|
||
3:4
|
||
16:9
|
||
-
|
||
16:9
|
||
9:16
|
||
-
|
||
9:16
|
||
2:3
|
||
-
|
||
2:3
|
||
3:2
|
||
-
|
||
3:2
|
||
21:9
|
||
-
|
||
21:9
|
||
Example:
|
||
|
||
"1:1"
|
||
input.quality
|
||
Required
|
||
string
|
||
Basic outputs 2K images, while High outputs 4K images.
|
||
|
||
Available options:
|
||
|
||
basic
|
||
-
|
||
Basic
|
||
high
|
||
-
|
||
High
|
||
Example:
|
||
|
||
"basic"
|
||
Request Example
|
||
|
||
cURL
|
||
|
||
JavaScript
|
||
|
||
Python
|
||
import requests
|
||
import json
|
||
|
||
url = "https://api.kie.ai/api/v1/jobs/createTask"
|
||
headers = {
|
||
"Content-Type": "application/json",
|
||
"Authorization": "Bearer YOUR_API_KEY"
|
||
}
|
||
|
||
payload = {
|
||
"model": "seedream/4.5-edit",
|
||
"callBackUrl": "https://your-domain.com/api/callback",
|
||
"input": {
|
||
"prompt": "Keep the model's pose and the flowing shape of the liquid dress unchanged. Change the clothing material from silver metal to completely transparent clear water (or glass). Through the liquid water, the model's skin details are visible. Lighting changes from reflection to refraction.",
|
||
"image_urls": [
|
||
"https://static.aiquickdraw.com/tools/example/1764851484363_ScV1s2aq.webp"
|
||
],
|
||
"aspect_ratio": "1:1",
|
||
"quality": "basic"
|
||
}
|
||
}
|
||
|
||
response = requests.post(url, headers=headers, data=json.dumps(payload))
|
||
result = response.json()
|
||
print(result)
|
||
Response Example
|
||
{
|
||
"code": 200,
|
||
"message": "success",
|
||
"data": {
|
||
"taskId": "task_12345678"
|
||
}
|
||
}
|
||
Response Fields
|
||
code
|
||
Status code, 200 for success, others for failure
|
||
message
|
||
Response message, error description when failed
|
||
data.taskId
|
||
Task ID for querying task status
|
||
Callback Notifications
|
||
When you provide the callBackUrl parameter when creating a task, the system will send POST requests to the specified URL upon task completion (success or failure).
|
||
|
||
Success Callback Example
|
||
{
|
||
"code": 200,
|
||
"data": {
|
||
"completeTime": 1755599644000,
|
||
"consumeCredits": 100,
|
||
"costTime": 8,
|
||
"createTime": 1755599634000,
|
||
"model": "seedream/4.5-edit",
|
||
"param": "{\"callBackUrl\":\"https://your-domain.com/api/callback\",\"model\":\"seedream/4.5-edit\",\"input\":{\"prompt\":\"Keep the model's pose and the flowing shape of the liquid dress unchanged. Change the clothing material from silver metal to completely transparent clear water (or glass). Through the liquid water, the model's skin details are visible. Lighting changes from reflection to refraction.\",\"image_urls\":[\"https://static.aiquickdraw.com/tools/example/1764851484363_ScV1s2aq.webp\"],\"aspect_ratio\":\"1:1\",\"quality\":\"basic\"}}",
|
||
"remainedCredits": 2510330,
|
||
"resultJson": "{\"resultUrls\":[\"https://example.com/generated-image.jpg\"]}",
|
||
"state": "success",
|
||
"taskId": "e989621f54392584b05867f87b160672",
|
||
"updateTime": 1755599644000
|
||
},
|
||
"msg": "Playground task completed successfully."
|
||
}
|
||
Failure Callback Example
|
||
{
|
||
"code": 501,
|
||
"data": {
|
||
"completeTime": 1755597081000,
|
||
"consumeCredits": 0,
|
||
"costTime": 0,
|
||
"createTime": 1755596341000,
|
||
"failCode": "500",
|
||
"failMsg": "Internal server error",
|
||
"model": "seedream/4.5-edit",
|
||
"param": "{\"callBackUrl\":\"https://your-domain.com/api/callback\",\"model\":\"seedream/4.5-edit\",\"input\":{\"prompt\":\"Keep the model's pose and the flowing shape of the liquid dress unchanged. Change the clothing material from silver metal to completely transparent clear water (or glass). Through the liquid water, the model's skin details are visible. Lighting changes from reflection to refraction.\",\"image_urls\":[\"https://static.aiquickdraw.com/tools/example/1764851484363_ScV1s2aq.webp\"],\"aspect_ratio\":\"1:1\",\"quality\":\"basic\"}}",
|
||
"remainedCredits": 2510430,
|
||
"state": "fail",
|
||
"taskId": "bd3a37c523149e4adf45a3ddb5faf1a8",
|
||
"updateTime": 1755597097000
|
||
},
|
||
"msg": "Playground task failed."
|
||
} |