跳到主要内容

制作精灵 V1

目的

基于上传的图片生成精灵动画。您可以创建像素艺术风格或普通风格的精灵表。

方法与路径

POST /public/v1/sprite/make-sprite/v1

认证

请参阅认证页面。需要 Bearer Token。

必需请求头:

Authorization: Bearer {your_api_key}

请求字段

字段名类型必填说明
imagefile作为精灵生成基础的图片文件
textstring用于精灵生成的文本提示词
frameinteger要生成的帧数。必须为以下之一:25, 36, 49, 64, 81, 100, 121, 144, 169
is_pixelboolean图片是否为像素艺术风格。truefalse

响应

成功响应(200 OK):

{
"job_id": "uuid-string"
}
字段类型说明
job_idstring已创建任务的唯一标识符。使用 Get Job Status 查询结果

错误 / 校验规则

情况HTTP 状态错误消息
Invalid image file400"Invalid image file"
frame 值不被允许400"frame should be one of 25, 36, 49, 64, 81, 100, 121, 144, 169"
认证失败401无效的 API Key

允许的帧数值:

  • 25, 36, 49, 64, 81, 100, 121, 144, 169

异步任务行为

此端点会创建异步任务。它会立即返回 job_id,实际的精灵生成会在后台进行。

轮询方法:

  1. 保存响应中收到的 job_id
  2. 轮询 GET /public/v1/job/{job_id} 检查状态
  3. 当状态变为 Succeed 时,在 image_urls 中查看结果(GIF 和单独帧图像)

状态流: PendingSucceedFailed

请求示例

cURL(像素艺术风格):

curl -X POST "https://api.aetherforgeai.com/public/v1/sprite/make-sprite/v1" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "image=@/path/to/character.png" \
-F "text=walking animation" \
-F "frame=64" \
-F "is_pixel=true"

cURL(普通风格):

curl -X POST "https://api.aetherforgeai.com/public/v1/sprite/make-sprite/v1" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "image=@/path/to/character.png" \
-F "text=running animation cycle" \
-F "frame=36" \
-F "is_pixel=false"