跳转到主要内容
POST
/
api
/
v1
/
jobs
/
createTask
使用 seedream/4.5-text-to-image 生成图像
curl --request POST \
  --url https://api.kie.ai/api/v1/jobs/createTask \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "seedream/4.5-text-to-image",
  "callBackUrl": "https://your-domain.com/api/callback",
  "input": {
    "prompt": "A full-process cafe design tool for entrepreneurs and designers. It covers core needs including store layout, functional zoning, decoration style, equipment selection, and customer group adaptation, supporting integrated planning of \"commercial attributes + aesthetic design.\" Suitable as a promotional image for a cafe design SaaS product, with a 16:9 aspect ratio.",
    "aspect_ratio": "1:1",
    "quality": "basic"
  }
}
'
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "task_seedream_1765166238716"
  }
}

查询任务状态

提交任务后,可通过统一查询端点查看进度并获取结果:

获取任务详情

了解如何查询任务状态并获取生成结果
生产环境中,建议使用 callBackUrl 参数在生成完成时接收自动通知,而非轮询状态端点。

相关资源

Authorizations

Authorization
string
header
required

所有 API 都需要通过 Bearer Token 进行身份验证。

获取 API Key:

  1. 访问 API Key 管理页面 获取您的 API Key

使用方法: 添加到请求头: Authorization: Bearer YOUR_API_KEY

注意:

  • 请妥善保管您的 API Key,不要与他人共享
  • 如果您怀疑 API Key 已泄露,请立即在管理页面重置

Body

application/json
model
enum<string>
default:seedream/4.5-text-to-image
required

用于生成的模型名称。必填字段。

  • 此端点必须使用 seedream/4.5-text-to-image
可用选项:
seedream/4.5-text-to-image
Example:

"seedream/4.5-text-to-image"

callBackUrl
string<uri>

接收生成任务完成更新的 URL。可选但建议在生产环境中使用。

  • 当生成完成时,系统将向此 URL POST 任务状态和结果
  • 回调包含生成的内容 URL 和任务信息
  • 您的回调端点应接受包含结果的 JSON 负载的 POST 请求
  • 或者,使用获取任务详情端点轮询任务状态
Example:

"https://your-domain.com/api/callback"

input
object

生成任务的输入参数

Response

请求成功

code
enum<integer>

响应状态码

  • 200: 成功 - 请求已成功处理
  • 401: 未授权 - 身份验证凭据缺失或无效
  • 402: 积分不足 - 账户没有足够的积分执行操作
  • 404: 未找到 - 请求的资源或端点不存在
  • 422: 验证错误 - 请求参数未通过验证检查
  • 429: 速率限制 - 已超过此资源的请求限制
  • 455: 服务不可用 - 系统正在维护中
  • 500: 服务器错误 - 处理请求时发生意外错误
  • 501: 生成失败 - 内容生成任务失败
  • 505: 功能已禁用 - 请求的功能当前已禁用
可用选项:
200,
401,
402,
404,
422,
429,
455,
500,
501,
505
msg
string

响应消息,失败时为错误描述

Example:

"success"

data
object