跳至主要內容

製作精靈圖 V2

目的

根據上傳的圖片生成精靈動畫。您可以建立像素藝術風格或一般風格的精靈圖表。

方法與路徑

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

驗證

請參閱驗證頁面。需要 Bearer Token。

必要標頭:

Authorization: Bearer {your_api_key}

請求欄位

欄位名稱類型必填說明
start_frame_imagefile作為起始影格基礎的圖片檔案
end_frame_imagefile作為結束影格基礎的可選圖片檔案
textstring用於精靈生成的文字提示
frameinteger要生成的影格數。必須為以下之一:49, 81, 121
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 49, 81, 121"
驗證失敗401無效的 API Key

允許的影格數值:

  • 49, 81, 121

非同步工作行為

此端點會建立非同步工作。它會立即回傳 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/v2" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "start_frame_image=@/path/to/character.png" \
-F "text=walking animation" \
-F "frame=49" \
-F "is_pixel=true"

cURL(一般風格):

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

cURL(一般風格 + 結束影格):

curl -X POST "https://api.aetherforgeai.com/public/v1/sprite/make-sprite/v2" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "start_frame_image=@/path/to/character_start.png" \
-F "end_frame_image=@/path/to/character_end.png" \
-F "text=running animation cycle" \
-F "frame=81" \
-F "is_pixel=false"