跳轉到主要內容
POST
/
kling
/
v1
/
videos
/
multi-elements
/
init-selection
curl --request POST \
  --url https://api.cometapi.com/kling/v1/videos/multi-elements/init-selection \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "video_id": "784912347344945152",
  "task_id": "784912347277836288"
}
'
{
  "code": 123,
  "message": "<string>",
  "data": {
    "session_id": "<string>"
  }
}
使用此端點可開啟影片編輯工作階段,並取得後續所有多模態編輯步驟所需的 session_id

選擇一種輸入方式

  • Kling 產生的影片:傳送 video_id 以及其父層 task_id
  • 外部或已託管的影片:傳送 video_url
  • 請勿同時傳送兩種輸入方式

工作流程中的角色

1

初始化工作階段

提交來源片段並儲存回傳的 session_id
2

標記選取點

接著使用 Add Video Selection 來定義你想編輯的區域。
3

提交最終編輯任務

選取設定完成後,繼續前往 Create Task
如需完整的參數參考,請參閱 Kling API 文件

授權

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

主體

application/json
video_id
string
預設值:784912347344945152
必填

The video ID generated by Kling; choose either this or video_url, they cannot be passed simultaneously. Select the video to be edited from historical works using the video ID. Only supports video works generated within the last 30 days; only supports videos with a duration of ≥2 seconds and ≤5.5 seconds, or ≥7 seconds and ≤10.5 seconds. Related to the video_url parameter, they cannot both be empty or both have values.

task_id
string
預設值:784912347277836288
必填

When passing video_id, the task_id from when the video was generated must also be passed.

video_url
string
預設值:https://v15-kling.klingai.com/bs2/upload-ylab-stunt-sgp/se/stream_lake_m2v_img2video_multi_id_v16_std/aa12ae6e-450d-4f36-b2d0-74376b313268_raw_video.mp4?x-kcdn-pid=112372

The URL to get the video. When uploading, pass the video download link. When editing a selection, pass the video URL returned by the interface.

Only supports MP4 and MOV formats. Only supports videos with a duration of ≥2 seconds and ≤5.5 seconds, or ≥7 seconds and ≤10.5 seconds. The width and height dimensions of the video must be between 720px (inclusive) and 2160px (inclusive). Only supports uploading videos at 24, 30, or 60 fps. Related to the video_id parameter, they cannot both be empty or both have values.

回應

200 - application/json

Session initialized.

code
integer
必填
message
string
必填
data
object
必填