APIKO
影片系列

Wan 3.0 Text-to-Video API

  • 僅透過 prompt 產生影片,不接受任何媒體輸入。
  • 需要首尾幀控制請用Wan 3.0 圖生影片;需要參考素材請用Wan 3.0 參考生影片。
  • 可產生 2–30 秒影片,解析度 480p、720p 或 1080p。
  • 標準版與 Prime 的請求參數、預設值和輸入限制完全一致,僅模型 ID 與價格不同(見Wan 3.0 Prime 文生影片)。
  • 非同步處理:POST /v1/videos 回傳任務 ID,輪詢 GET /v1/videos/{id} 或 GET /v1/tasks/{id} 直到任務完成。
  • 結果連結由 APIKO 簽名,保留 24 小時;需要保存的請及時下載。
  • 計費說明
    • 計費時長 = 輸出影片時長(duration)。
    • 按所選 resolution 的單價逐秒計費,價格見模型頁。
    • 任務失敗全額退款。
POST
/
v1
/
videos
TASK_ID=$(curl https://api.apiko.app/v1/videos \
  -H "Authorization: Bearer $APIKO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "wan3.0-text-to-video",
  "duration": 5,
  "resolution": "720p",
  "aspect_ratio": "16:9",
  "prompt": "A paper boat drifting across a calm lake at sunrise, slow cinematic camera move."
}' | python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')

while :; do
  TASK=$(curl -s https://api.apiko.app/v1/videos/$TASK_ID \
    -H "Authorization: Bearer $APIKO_API_KEY")
  printf '%s\n' "$TASK"
  printf '%s' "$TASK" | grep -qE '"status": *"(completed|failed)"|"error": *\{' && break
  sleep 5
done
{
  "id": "task_abc123",
  "object": "video",
  "model": "wan3.0-text-to-video",
  "status": "completed",
  "progress": 100,
  "video_url": "https://api.apiko.app/v1/tasks/task_abc123/artifacts/video/content?access=…"
}

鑑權

Authorization
string必填
所有請求都使用 Bearer 鑑權:Authorization: Bearer <API_KEY>。
在主控台 → API Keys 建立 Key。
Routes
string
  • POST /v1/videos — 建立影片任務
  • GET /v1/videos/{id} — 查詢任務並讀取 video_url
  • GET /v1/tasks/{id} — 以通用任務格式查詢同一任務

請求體

application/json
model
string預設:wan3.0-text-to-video必填
使用此公開模型 ID,原樣填寫。
可用選項: wan3.0-text-to-video
範例:"wan3.0-text-to-video"
prompt
string必填
影片描述。
支援中英文,最多 20,000 個字元;超出時在扣費前回傳 HTTP 400。
最小長度: 1
最大長度: 20000
範例:"A paper boat drifting across a calm lake at sunrise"
aspect_ratio
enum<string>
影片輸出的寬高比。
adaptive 由模型根據輸入素材與提示詞自動選擇寬高比;16:9 橫向,9:16 直向,1:1 方形。
可用選項: adaptive, 16:9, 9:16, 1:1
範例:"adaptive"
resolution
enum<string>預設:720p
影片輸出解析度,取值比對時不區分大小寫。
  • 480p 價格最低,720p 為預設值,1080p 最清晰。
  • 各解析度單價不同,見模型頁。
可用選項: 480p, 720p, 1080p
範例:"720p"
duration
integer預設:5
  • 輸出影片時長(秒),2 到 30 之間的任意整數。
  • 也接受 OpenAI 影片介面的 seconds(字串,如 "10")作為別名,二者只傳其一。
範圍: 2 ≤ x ≤ 30
範例:5
callback_url
string<uri>
可選,任務結束時接收通知的公網 HTTPS 位址。
  • 任務完成後,APIKO 會 POST 與 GET /v1/tasks/{id} 相同的 JSON,並帶請求頭 X-Apiko-Task-Id,最多重試 3 次。
  • 回調不帶簽名:請重新查詢任務確認結果。
範例:"https://your-domain.com/webhooks/apiko-task"

響應

200 - application/json

請求被接受時扣費;以 failed 結束的任務全額退款。

id
string
影片任務 ID。使用 GET /v1/videos/{id} 或 GET /v1/tasks/{id} 查詢。
範例:"task_abc123"
status
enum<string>
任務狀態。每 5~10 秒輪詢一次,直到變為 completed 或 failed。
可用選項: queued, in_progress, completed, failed
progress
integer
進度範圍為 0 到 100。
video_url
string<uri>
任務為 completed 時,GET /v1/videos/{id} 返回 APIKO 簽名連結,保留 24 小時。GET /v1/tasks/{id} 會在 data[0].url 返回同一連結。

錯誤

application/json

錯誤格式為 { "error": { "message", "type", "param", "code" } };大多數 message 末尾帶請求 id,聯繫支持時請提供。

400
error
請求無效。請修正請求後再試;該請求不會扣費。
  • 本頁未列出的欄位,例如 seed is not supported。
  • 取值超出列出的選項或範圍,例如 duration must be an integer from …。
  • 缺少或為空的 prompt(prompt is required)。
  • 參考 URL 不是公開 HTTPS 位址(… must be a public HTTPS URL)。
401
error
API Key 缺失或無效(Invalid token)。
403
error
餘額不足(code: "insufficient_user_quota")。請前往主控台 → Billing 充值。
404
error
GET /v1/videos/{id} 或 GET /v1/tasks/{id} 查詢不存在或屬於其他使用者的任務(Task not found)。
503
error
模型存在,但此刻沒有可用線路:No available channel for model …(code: "model_not_found")。請稍後以退避方式重試,或換一個模型。model 缺失或拼寫錯誤時回傳 404,訊息相同;這種情況請檢查模型 ID,不要重試。