跳轉到主要內容

簡介

Kling 是 Ace Data Cloud 提供的 AI 視頻服務,快手可靈視頻生成模型。透過 Ace Data Cloud 統一 API,你可以使用 cURL 快速調用 Kling,實現文生視頻、圖生視頻、視頻續寫、多種時長、多種比例等功能。

前置條件

  • 擁有 Ace Data Cloud 帳號並獲取 API Token
  • 安裝了 cURL 的終端環境

基礎用法

調用 Kling API 的主端點為:
POST https://api.acedata.cloud/kling/videos
本示例使用 kling-v2-5-turbo 模型。 可用模型包括:kling-v1kling-v1-6kling-v2-masterkling-v2-1-masterkling-v2-5-turbokling-video-o1 完整 cURL 命令示例:
curl -X POST https://api.acedata.cloud/kling/videos \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action": "text2video", "prompt": "A white cat walking in the snow", "model": "kling-v2-5-turbo", "duration": 5, "aspect_ratio": "16:9"}'
請將 YOUR_API_TOKEN 替換為你在 Ace Data Cloud 平台獲取的實際 Token。

回應示例

成功調用後返回 JSON 格式資料,例如:
{
  "status": "success",
  "data": {
    ...
  }
}

使用 jq 處理回應

推薦使用 jq 工具格式化輸出:
curl -s -X POST https://api.acedata.cloud/kling/videos \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"action": "text2video", "prompt": "A white cat walking in the snow", "model": "kling-v2-5-turbo", "duration": 5, "aspect_ratio": "16:9"}' | jq .

錯誤處理

常見錯誤碼:
狀態碼說明
401認證失敗,請檢查 API Token
403餘額不足或無權訪問
429請求頻率超限
500伺服器內部錯誤

下一步