跳至主要內容

Sprite Lite

用途​

根據一張上傳的圖片生成精靈動畫。此功能與網頁應用程式「生成精靈」頁面(Sprite Lite & Plus)的 Lite 分頁相同。使用 frame 選擇幀數,與網頁頁面滑桿上顯示的值完全相同。

代幣消耗: 5(25 幀)、7(36)、9(49)、11(64)、13(81)

方法與路徑​

POST /public/v1/sprite/lite

認證​

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

必要標頭:

Authorization: Bearer {your_api_key}

請求欄位​

請以 multipart/form-data 傳送請求。

欄位名稱類型必填預設值說明
imagefile是精靈的基礎圖片(PNG 或 JPEG)
textstring是描述動作的提示詞。會移除前後空白,且文字不得為空
frameinteger是幀數。允許的值:25、36、49、64、81
is_pixelboolean否false像素風。如果附加圖片本身是像素風,請開啟此選項
is_prompt_enhancementboolean否true提示詞優化。根據你輸入的內容,將提示詞優化為更適合生成精靈的形式

依 frame 的代幣

frame代幣
255
367
499
6411
8113

回應​

成功回應 (200 OK):

{
"job_id": "uuid-string"
}
欄位類型說明
job_idstring已建立作業的唯一識別碼。請使用取得作業狀態查詢結果

錯誤 / 驗證規則​

情況HTTP 狀態錯誤訊息
圖片不是有效的 PNG 或 JPEG 檔案400"Invalid image file"
frame 值不允許400"frame should be one of 25, 36, 49, 64, 81"
text 為空400"text must not be empty"
無效的 API 金鑰401"Invalid API key"
欄位遺漏422Validation error

非同步作業行為​

此端點會建立非同步作業。它會立即回傳 job_id,實際的精靈生成會在背景進行。

輪詢方法:

  1. 儲存回應中收到的 job_id
  2. 輪詢 GET /public/v1/job/{job_id} 確認狀態
  3. 當狀態變為 Succeed 時,於 image_urls 查看結果(精靈圖表與 GIF)

狀態流程: Pending → Succeed 或 Failed

請求範例​

cURL (像素風):

curl -X POST "https://api.aetherforgeai.com/public/v1/sprite/lite" \
-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/lite" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "image=@/path/to/character.png" \
-F "text=running animation cycle" \
-F "frame=36" \
-F "is_prompt_enhancement=false"