From 562e9aed2c712b418786255dfc38daf991f684fd Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Sun, 26 Apr 2026 21:17:25 +0100 Subject: [PATCH] vault backup: 2026-04-26 21:17:25 --- 99 Daily/2026-04-26.md | 18 ++ ...ext-Gen AI Video & AI Image Generator 3.md | 0 ...ext-Gen AI Video & AI Image Generator 4.md | 0 ...ext-Gen AI Video & AI Image Generator 5.md | 0 ...ext-Gen AI Video & AI Image Generator 6.md | 0 ...ext-Gen AI Video & AI Image Generator 7.md | 0 ... Next-Gen AI Video & AI Image Generator.md | 0 wiki/_master-index.md | 2 +- wiki/web-agency/_index.md | 5 + wiki/web-agency/kling-lip-sync-api.md | 166 ++++++++++++++++ wiki/web-agency/kling-motion-control-api.md | 183 ++++++++++++++++++ wiki/web-agency/kling-multi-elements-api.md | 173 +++++++++++++++++ wiki/web-agency/kling-video-extension-api.md | 135 +++++++++++++ wiki/web-agency/kling-video-models.md | 116 +++++++++++ 14 files changed, 797 insertions(+), 1 deletion(-) rename raw/{ => _processed}/Kling AI Next-Gen AI Video & AI Image Generator 3.md (100%) rename raw/{ => _processed}/Kling AI Next-Gen AI Video & AI Image Generator 4.md (100%) rename raw/{ => _processed}/Kling AI Next-Gen AI Video & AI Image Generator 5.md (100%) rename raw/{ => _processed}/Kling AI Next-Gen AI Video & AI Image Generator 6.md (100%) rename raw/{ => _processed}/Kling AI Next-Gen AI Video & AI Image Generator 7.md (100%) rename raw/{ => _processed}/Kling AI Next-Gen AI Video & AI Image Generator.md (100%) create mode 100644 wiki/web-agency/kling-lip-sync-api.md create mode 100644 wiki/web-agency/kling-motion-control-api.md create mode 100644 wiki/web-agency/kling-multi-elements-api.md create mode 100644 wiki/web-agency/kling-video-extension-api.md create mode 100644 wiki/web-agency/kling-video-models.md diff --git a/99 Daily/2026-04-26.md b/99 Daily/2026-04-26.md index 784d4cb..93b154f 100644 --- a/99 Daily/2026-04-26.md +++ b/99 Daily/2026-04-26.md @@ -23,3 +23,21 @@ tags: [daily] - 21:09 (1min) | `memory-compiler` - **Asked:** Compile a new Kling image-to-video API article into the wiki knowledge base. - **Done:** Created structured wiki article documenting the image-to-video endpoint with motion brush and voice injection features. +- 21:10 (1min) | `memory-compiler` + - **Asked:** Compile a new article about Kling's multi-image-to-video API into the wiki knowledge base. + - **Done:** Created structured article documenting the POST /v1/videos/multi-image2video endpoint with full parameter and constraint details, updated index counts. +- 21:11 (<1min) | `memory-compiler` + - **Asked:** Compile a new article about Kling Motion Control API into the wiki knowledge base. + - **Done:** Created structured wiki article with full API reference, constraints table, key takeaways, and wikilinks. +- 21:12 (<1min) | `memory-compiler` + - **Asked:** Asked the developer to compile a new article on the Kling Multi-Elements API into the wiki knowledge base. + - **Done:** Compiled the article into the wiki with full workflow documentation and updated the master index article count. +- 21:13 (<1min) | `memory-compiler` + - **Asked:** Update the wiki knowledge base with a new article about the Kling video extension API and increment the web-agency article count. + - **Done:** Created structured wiki article documenting three API endpoints with schemas and constraints, updated article counts in both index files. +- 21:14 (1min) | `memory-compiler` + - **Asked:** Asked | Processed new Kling API reference article and filed it into knowledge base | Compiled Kling lip-sync API documentation into wiki structure with timing rules, audio options, and constraints | Kling API reference | Master Index update, new article creation | wiki/web-agency/kling-lip-sync-api.md, wiki Master Index + - **Done:** — +- 21:15 (<1min) | `memory-compiler` + - **Asked:** Asked | Compile raw Kling video models article into structured wiki with capability matrix and model selection guide + - **Done:** Done | Created wiki/web-agency/kling-video-models.md with 11 model matrix, resolution/FPS tables, feature comparison, and selection guide diff --git a/raw/Kling AI Next-Gen AI Video & AI Image Generator 3.md b/raw/_processed/Kling AI Next-Gen AI Video & AI Image Generator 3.md similarity index 100% rename from raw/Kling AI Next-Gen AI Video & AI Image Generator 3.md rename to raw/_processed/Kling AI Next-Gen AI Video & AI Image Generator 3.md diff --git a/raw/Kling AI Next-Gen AI Video & AI Image Generator 4.md b/raw/_processed/Kling AI Next-Gen AI Video & AI Image Generator 4.md similarity index 100% rename from raw/Kling AI Next-Gen AI Video & AI Image Generator 4.md rename to raw/_processed/Kling AI Next-Gen AI Video & AI Image Generator 4.md diff --git a/raw/Kling AI Next-Gen AI Video & AI Image Generator 5.md b/raw/_processed/Kling AI Next-Gen AI Video & AI Image Generator 5.md similarity index 100% rename from raw/Kling AI Next-Gen AI Video & AI Image Generator 5.md rename to raw/_processed/Kling AI Next-Gen AI Video & AI Image Generator 5.md diff --git a/raw/Kling AI Next-Gen AI Video & AI Image Generator 6.md b/raw/_processed/Kling AI Next-Gen AI Video & AI Image Generator 6.md similarity index 100% rename from raw/Kling AI Next-Gen AI Video & AI Image Generator 6.md rename to raw/_processed/Kling AI Next-Gen AI Video & AI Image Generator 6.md diff --git a/raw/Kling AI Next-Gen AI Video & AI Image Generator 7.md b/raw/_processed/Kling AI Next-Gen AI Video & AI Image Generator 7.md similarity index 100% rename from raw/Kling AI Next-Gen AI Video & AI Image Generator 7.md rename to raw/_processed/Kling AI Next-Gen AI Video & AI Image Generator 7.md diff --git a/raw/Kling AI Next-Gen AI Video & AI Image Generator.md b/raw/_processed/Kling AI Next-Gen AI Video & AI Image Generator.md similarity index 100% rename from raw/Kling AI Next-Gen AI Video & AI Image Generator.md rename to raw/_processed/Kling AI Next-Gen AI Video & AI Image Generator.md diff --git a/wiki/_master-index.md b/wiki/_master-index.md index 24a8f63..1357e95 100644 --- a/wiki/_master-index.md +++ b/wiki/_master-index.md @@ -27,7 +27,7 @@ This 3-hop pattern works for hundreds of articles without vector search. | [[wiki/connections/_index\|connections/]] | Cross-cutting insights linking 2+ concepts | 3 | | [[wiki/qa/_index\|qa/]] | Filed answers to queries (saved with `--file-back`) | 0 | | [[wiki/homelab/_index\|homelab/]] | Self-hosted infra: Proxmox install, IOMMU/PCI passthrough, hypervisor setup, budget builds, Homarr API + Apps + Boards + Certificates + Integrations + Settings + Tasks + AdGuard + Clock + Docker Stats + Docker Integration + Download Client + Firewall + Proxmox Integration + Radarr + Readarr + Sonarr + Bookmarks + Calendar + Icons + App Widget + Weather + GitHub + Nextcloud + qBittorrent + RSS Feed + Speedtest Tracker + System Health Monitoring + System Resources | 35 | -| [[wiki/web-agency/_index\|web-agency/]] | AI-assisted website building & selling: Claude Code, Nanobanana 2, Kling, LaunchPath MCP | 3 | +| [[wiki/web-agency/_index\|web-agency/]] | AI-assisted website building & selling: Claude Code, Nanobanana 2, Kling, LaunchPath MCP | 9 | | [[wiki/dotfiles/_index\|dotfiles/]] | Linux terminal ricing: Kitty, Fish, WezTerm CLI, modern Rust CLI tools, LazyVim, unified themes, Tabby | 21 | | [[wiki/agent-sdk/_index\|agent-sdk/]] | Claude Agent SDK (formerly Claude Code SDK) — build autonomous AI agents in Python and TypeScript | 30 | | [[wiki/llm-models/_index\|llm-models/]] | LLM model catalogs — OpenAI and Claude/Anthropic models, IDs, context, pricing | 2 | diff --git a/wiki/web-agency/_index.md b/wiki/web-agency/_index.md index babfda8..b0e6280 100644 --- a/wiki/web-agency/_index.md +++ b/wiki/web-agency/_index.md @@ -8,3 +8,8 @@ | [[wiki/web-agency/kling-text-to-video-api\|Kling AI Text-to-Video API Reference]] | Full REST API reference: create/query tasks, multi-shot storyboard, camera control, models v1–v3. Videos expire 30 days. | Kling AI docs | 2026-04-26 | | [[wiki/web-agency/kling-image-to-video-api\|Kling AI Image-to-Video API Reference]] | Animate a still image or interpolate between two frames. Motion brush, voice injection, element library, multi-shot from image. | Kling AI docs | 2026-04-26 | | [[wiki/web-agency/kling-multi-image-to-video-api\|Kling AI Multi-Image-to-Video API Reference]] | Composite 2–4 reference images into one video (kling-v1-6 only). Subject+clothing, product-in-scene workflows. Videos expire 30 days. | Kling AI docs | 2026-04-26 | +| [[wiki/web-agency/kling-motion-control-api\|Kling AI Motion Control API Reference]] | Pose/motion transfer: drive a character image using a reference video. Duration matches reference video; image vs video orientation modes. | Kling AI docs | 2026-04-26 | +| [[wiki/web-agency/kling-multi-elements-api\|Kling AI Multi-Elements API Reference]] | Session-based element editing: add, swap, or remove objects in existing videos via RLE segmentation masks. 5 or 10-second output. | Kling AI docs | 2026-04-26 | +| [[wiki/web-agency/kling-video-extension-api\|Kling AI Video Extension API Reference]] | Extend any Kling video by 4–5 s per call up to 3-minute total cap. Model/mode locked to source. Videos expire after 30 days. | Kling AI docs | 2026-04-26 | +| [[wiki/web-agency/kling-lip-sync-api\|Kling AI Advanced Lip-Sync API Reference]] | Two-step face-identify → lip-sync workflow. Audio timing triplet, volume controls, one-person limit. Results expire 30 days. | Kling AI docs | 2026-04-26 | +| [[wiki/web-agency/kling-video-models\|Kling AI Video Models — Capability Matrix]] | Full model lineup (v1–v3-omni, o1): feature support per tier, resolution/FPS table, and model selection guide. | Kling AI docs | 2026-04-26 | diff --git a/wiki/web-agency/kling-lip-sync-api.md b/wiki/web-agency/kling-lip-sync-api.md new file mode 100644 index 0000000..a541569 --- /dev/null +++ b/wiki/web-agency/kling-lip-sync-api.md @@ -0,0 +1,166 @@ +--- +title: "Kling AI Advanced Lip-Sync API Reference" +aliases: [kling-lip-sync, advanced-lip-sync, kling-face-sync] +tags: [kling, api, lip-sync, video, ai-video] +sources: [raw/Kling AI Next-Gen AI Video & AI Image Generator 7.md] +created: 2026-04-26 +updated: 2026-04-26 +--- + +## Overview + +Two-step workflow to overlay audio onto a detected face in a video: **identify face → create lip-sync task**. Session ID links the two calls. Currently supports **one person only**. + +Base URL: `https://api-singapore.klingai.com` + +--- + +## Step 1 — Identify Face + +`POST /v1/videos/identify-face` + +Detects faces in the source video and returns face IDs + time intervals. The `session_id` returned here is required for the next step. + +### Request Body + +| Field | Type | Required | Notes | +|-------|------|----------|-------| +| `video_id` | string | Either/or | Kling-generated video ID (last 30 days, ≤60 s) | +| `video_url` | string | Either/or | `.mp4`/`.mov`, ≤100 MB, 2–60 s, 720p or 1080p, 512–2160 px | + +- `video_id` and `video_url` are mutually exclusive — exactly one must be provided. + +### Response `data` + +```json +{ + "session_id": "id", + "final_unit_deduction": "string", + "face_data": [ + { + "face_id": "string", + "face_image": "url", + "start_time": 0, + "end_time": 5200 + } + ] +} +``` + +- `start_time` / `end_time` — face appearance window in the video (ms) + +--- + +## Step 2 — Create Lip-Sync Task + +`POST /v1/videos/advanced-lip-sync` + +Assigns audio to a specific face and queues the render. + +### Request Body + +| Field | Type | Required | Notes | +|-------|------|----------|-------| +| `session_id` | string | Required | From identify-face response | +| `face_choose` | array | Required | One entry per face (max 1 currently) | +| `external_task_id` | string | Optional | Custom ID; must be unique per user | +| `callback_url` | string | Optional | Webhook for status changes | +| `watermark_info` | object | Optional | `{"enabled": true\|false}` | + +#### `face_choose` entry fields + +| Field | Type | Required | Notes | +|-------|------|----------|-------| +| `face_id` | string | Required | From `face_data` in Step 1 | +| `audio_id` | string | Either/or | ID from Kling TTS API; 2–60 s, last 30 days | +| `sound_file` | string | Either/or | Base64 or URL; `.mp3/.wav/.m4a/.aac`, ≤5 MB, 2–60 s | +| `sound_start_time` | long | Required | Crop start in source audio (ms from 0) | +| `sound_end_time` | long | Required | Crop end in source audio (ms); cropped segment ≥2 s | +| `sound_insert_time` | long | Required | Where in the video to insert audio (ms); must overlap face interval ≥2 s | +| `sound_volume` | float | Optional | `[0, 2]` — injected audio volume | +| `original_audio_volume` | float | Optional | `[0, 2]` — original video audio volume; no effect if video is silent | + +### Response `data` + +```json +{ + "task_id": "string", + "task_status": "submitted|processing|succeed|failed", + "created_at": 1722769557708, + "updated_at": 1722769557708 +} +``` + +--- + +## Step 3 — Query Task + +### Single task + +`GET /v1/videos/advanced-lip-sync/{task_id}` + +### List tasks + +`GET /v1/videos/advanced-lip-sync?pageNum=1&pageSize=30` + +- `pageNum`: 1–1000 +- `pageSize`: 1–500 + +### Result schema + +```json +{ + "task_id": "string", + "task_status": "submitted|processing|succeed|failed", + "task_status_msg": "string", + "task_info": { + "parent_video": { "id": "string", "url": "string", "duration": "string" } + }, + "task_result": { + "videos": [ + { + "id": "string", + "url": "string", + "watermark_url": "string", + "duration": "string" + } + ] + }, + "watermark_info": { "enabled": true }, + "final_unit_deduction": "string", + "created_at": 1722769557708, + "updated_at": 1722769557708 +} +``` + +> **Warning:** Generated videos are deleted after **30 days** — download promptly. + +--- + +## Key Takeaways + +- **Two-step flow:** identify face (get `session_id` + `face_id`) → create lip-sync task +- **One person limit:** `face_choose` array currently supports a single face only +- **Audio source:** either Kling TTS `audio_id` or external `sound_file` (URL or base64) — mutually exclusive +- **Timing triplet:** `sound_start_time` + `sound_end_time` crop the audio; `sound_insert_time` places it in the video — overlap with face interval must be ≥2 s +- **Volume control:** both injected audio and original audio are independently adjustable on a `[0, 2]` scale +- **Video constraints:** source must be 720p/1080p, 2–60 s, ≤100 MB, `.mp4`/`.mov` +- **Results expire:** 30-day TTL on all generated video URLs +- **Callbacks supported:** set `callback_url` to avoid polling + +--- + +## Related Articles + +- [[wiki/web-agency/kling-text-to-video-api|Kling Text-to-Video API]] — generate source videos to feed into lip-sync +- [[wiki/web-agency/kling-image-to-video-api|Kling Image-to-Video API]] — animate a portrait image before syncing lips +- [[wiki/web-agency/kling-video-extension-api|Kling Video Extension API]] — extend the output after lip-sync +- [[wiki/web-agency/kling-multi-elements-api|Kling Multi-Elements API]] — session-based editing pattern (same session concept) +- [[wiki/web-agency/claude-code-nanobanana-website-workflow|Web Agency Workflow]] — where Kling fits in the £3–10K site pipeline + +--- + +## Sources + +- Raw: `raw/Kling AI Next-Gen AI Video & AI Image Generator 7.md` +- Kling AI API docs — Advanced Lip-Sync section diff --git a/wiki/web-agency/kling-motion-control-api.md b/wiki/web-agency/kling-motion-control-api.md new file mode 100644 index 0000000..a2e436e --- /dev/null +++ b/wiki/web-agency/kling-motion-control-api.md @@ -0,0 +1,183 @@ +--- +title: "Kling AI Motion Control API Reference" +aliases: [kling-motion-control, motion-control-api] +tags: [kling, video-generation, api, motion-control, pose-transfer] +sources: [raw/Kling AI Next-Gen AI Video & AI Image Generator 4.md] +created: 2026-04-26 +updated: 2026-04-26 +--- + +## Overview + +Motion Control (`/v1/videos/motion-control`) drives a character in a **reference image** using the motion captured from a **reference video** — essentially pose/motion transfer. The generated video length matches the reference video duration. + +Supported models: `kling-v2-6`, `kling-v3` + +Base URL: `https://api-singapore.klingai.com` + +--- + +## Create Task + +**POST** `/v1/videos/motion-control` + +### Required Fields + +| Field | Type | Notes | +|-------|------|-------| +| `model_name` | enum | `kling-v2-6` or `kling-v3` | +| `image_url` | string | Reference character image (Base64 raw or URL) | +| `video_url` | string | Reference motion video (mp4/mov) | +| `character_orientation` | enum | `image` or `video` | +| `mode` | enum | `std` (cost-effective) or `pro` (high quality) | + +### Optional Fields + +| Field | Type | Notes | +|-------|------|-------| +| `prompt` | string | Max 2500 chars; add scene elements, camera hints | +| `keep_original_sound` | enum | `yes` / `no` | +| `element_list` | array | One element ID from element library | +| `watermark_info` | object | `{ "enabled": boolean }` | +| `callback_url` | string | Webhook for status change notifications | +| `external_task_id` | string | Your own task ID (unique per account) | + +### Minimal Example + +```bash +curl --request POST \ + --url https://api-singapore.klingai.com/v1/videos/motion-control \ + --header 'Authorization: Bearer ' \ + --header 'Content-Type: application/json; charset=utf-8' \ + --data-raw '{ + "model_name": "kling-v2-6", + "image_url": "https://example.com/character.png", + "video_url": "https://example.com/dance.mp4", + "character_orientation": "image", + "mode": "pro", + "keep_original_sound": "yes" + }' +``` + +### Response + +```json +{ + "code": 0, + "request_id": "string", + "data": { + "task_id": "string", + "task_status": "submitted", + "created_at": 1722769557708, + "updated_at": 1722769557708 + } +} +``` + +Task statuses: `submitted` → `processing` → `succeed` / `failed` + +--- + +## Query Task (Single) + +**GET** `/v1/videos/motion-control/{task_id}` + +- Can query by system `task_id` **or** your `external_task_id` in the path + +```bash +curl --request GET \ + --url https://api-singapore.klingai.com/v1/videos/motion-control/{task_id} \ + --header 'Authorization: Bearer ' +``` + +### Result Shape + +```json +{ + "data": { + "task_id": "string", + "task_status": "succeed", + "task_result": { + "videos": [ + { + "id": "string", + "url": "string", // anti-leech, expires 30 days + "watermark_url": "string", + "duration": "string" // seconds + } + ] + }, + "final_unit_deduction": "string" + } +} +``` + +--- + +## Query Task (List) + +**GET** `/v1/videos/motion-control?pageNum=1&pageSize=30` + +- `pageNum`: 1–1000 +- `pageSize`: 1–500 + +Returns same per-task structure as single query, wrapped in a data array. + +--- + +## Constraints & Tips + +### Image Requirements (`image_url`) +- Formats: `.jpg` / `.jpeg` / `.png` +- Size: ≤ 10 MB; dimensions: 300 px – 65536 px; aspect ratio: 1:2.5 – 2.5:1 +- Character should be full-body or clear upper body, no occlusion +- **Base64**: submit raw string only — no `data:image/png;base64,` prefix + +### Video Requirements (`video_url`) +- Formats: `.mp4` / `.mov`; size: ≤ 100 MB; dimensions: 340 px – 3850 px +- Duration: min 3 s; max depends on `character_orientation`: + - `image` → max **10 s** + - `video` → max **30 s** +- Single continuous shot — no cuts, no camera movement +- Single person preferred; 2+ people → largest on-screen person is used +- Output length = reference video duration (may be shorter for fast/complex actions; credits not refunded) + +### `character_orientation` Modes +| Value | Orientation follows | Max video duration | +|-------|--------------------|--------------------| +| `image` | Character pose in the reference image | 10 s | +| `video` | Character pose in the reference video | 30 s | + +### Generation Modes +| Value | Description | +|-------|-------------| +| `std` | Standard — cost-effective | +| `pro` | Professional — higher quality | + +--- + +## Key Takeaways + +- Motion Control = **pose/motion transfer**: character from image moves like the actor in the reference video +- Output duration matches reference video; minimum extractable motion is 3 s +- Videos **expire after 30 days** — download and store immediately +- Use `character_orientation: "image"` for short clips (≤10 s), `"video"` for up to 30 s +- Base64 images must be raw — no `data:` prefix or the request will fail +- Single-person, full-body, stable reference videos yield the best results +- Errors surface in `task_status_msg` when status is `failed` + +--- + +## Related + +- [[wiki/web-agency/kling-text-to-video-api|Kling Text-to-Video API]] — generate video from prompt only +- [[wiki/web-agency/kling-image-to-video-api|Kling Image-to-Video API]] — animate a still or interpolate two frames +- [[wiki/web-agency/kling-multi-image-to-video-api|Kling Multi-Image-to-Video API]] — composite 2–4 reference images +- [[wiki/web-agency/claude-code-nanobanana-website-workflow|Claude Code + Nanobanana 2 Workflow]] — end-to-end agency workflow using Kling + +--- + +## Sources + +- Raw article: `raw/Kling AI Next-Gen AI Video & AI Image Generator 4.md` +- Origin: https://kling.ai/document-api/apiReference/model/motionControl diff --git a/wiki/web-agency/kling-multi-elements-api.md b/wiki/web-agency/kling-multi-elements-api.md new file mode 100644 index 0000000..f40b090 --- /dev/null +++ b/wiki/web-agency/kling-multi-elements-api.md @@ -0,0 +1,173 @@ +--- +title: "Kling AI Multi-Elements API Reference" +aliases: [kling-multi-elements, kling-video-element-editing, kling-add-swap-remove] +tags: [kling, api, video-editing, multi-elements, ai-video] +sources: ["raw/Kling AI Next-Gen AI Video & AI Image Generator 5.md"] +created: 2026-04-26 +updated: 2026-04-26 +--- + +## Overview + +The Multi-Elements API lets you **add**, **swap**, or **remove** specific objects within an existing video using AI segmentation. You mark elements by clicking coordinates, then submit an editing task. + +Base URL: `https://api-singapore.klingai.com` + +Supported model: `kling-v1-6` only. + +--- + +## Workflow (5 Steps) + +1. **Init** — `POST /v1/videos/multi-elements/init-selection` — parse video, get `session_id` +2. **Add selection** — `POST /v1/videos/multi-elements/add-selection` — click a point on a frame to mark an object +3. **Preview** — `POST /v1/videos/multi-elements/preview-selection` — see masked overlay before committing +4. **Create task** — `POST /v1/videos/multi-elements` — choose `edit_mode` + prompt + optional reference images +5. **Query** — `GET /v1/videos/multi-elements/{task_id}` — poll until `succeed` + +Optional cleanup steps: `delete-selection` (remove specific points) or `clear-selection` (wipe all). + +--- + +## Step 1 — Init Selection + +`POST /v1/videos/multi-elements/init-selection` + +| Field | Type | Notes | +|-------|------|-------| +| `video_id` | string (optional) | Kling-generated video, last 30 days only | +| `video_url` | string (optional) | Public `.mp4` / `.mov` URL | + +**Video constraints:** +- Duration: 2–5 s or 7–10 s +- Resolution: 720–2160 px (both dimensions) +- Frame rate: 24, 30, or 60 fps + +**Response fields:** +- `session_id` — valid for **24 hours**, used in all subsequent calls +- `fps`, `original_duration`, `total_frame` — required when creating the task +- `normalized_video` — URL of the processed video + +--- + +## Step 2 — Add Selection + +`POST /v1/videos/multi-elements/add-selection` + +| Field | Type | Notes | +|-------|------|-------| +| `session_id` | string | Required | +| `frame_index` | int | Which frame to mark (max 10 frames total) | +| `points` | array | `{x, y}` in `[0,1]` range (top-left = 0,0); up to 10 points per frame | + +**Response:** returns `rle_mask_list` — RLE-encoded segmentation masks + PNG base64 per object. + +### Decoding the RLE Mask (TypeScript) + +```typescript +export type RLEObject = { size: [h: number, w: number]; counts: string } + +export function decode(rleObj: RLEObject): Uint8Array { + // Returns flat Uint8Array (row-major): 1 = masked pixel, 0 = background + // ... see full implementation in source article +} +``` + +### Rendering the Mask Overlay (Canvas) + +```typescript +function drawMask(rleMask: string, height: number, width: number) { + const decodeData = decode({ counts: rleMask, size: [height, width] }) + // Paint pixels with RGBA (116, 255, 82, 163) where decodeData[y*w+x] === 1 +} +``` + +--- + +## Step 3 — Delete / Clear Selection (optional) + +`POST /v1/videos/multi-elements/delete-selection` +- Same body as add-selection; `points` must **exactly match** coordinates used when adding. + +`POST /v1/videos/multi-elements/clear-selection` +- Only requires `session_id` — wipes all marked areas. + +--- + +## Step 4 — Preview Selection (optional) + +`POST /v1/videos/multi-elements/preview-selection` + +Returns: `video` (masked overlay), `video_cover`, `tracking_output` (per-frame mask). + +--- + +## Step 5 — Create Task + +`POST /v1/videos/multi-elements` + +| Field | Type | Notes | +|-------|------|-------| +| `model_name` | enum | `kling-v1-6` | +| `session_id` | string | Required | +| `edit_mode` | enum | `addition` / `swap` / `removal` | +| `image_list` | array | Required for add/swap; omit for removal | +| `prompt` | string | Use `<<>>` / `<<>>` references; max 2500 chars | +| `negative_prompt` | string | Optional, max 2500 chars | +| `mode` | enum | `std` (cost-effective) / `pro` (high-quality) | +| `duration` | enum | `5` or `10` seconds | +| `callback_url` | string | Optional webhook | +| `external_task_id` | string | Optional custom ID | + +### edit_mode Details + +| Mode | image_list | Prompt template | +|------|-----------|-----------------| +| `addition` | 1–2 images (pre-cropped) | `Using the context of <<>>, seamlessly add [x] from <<>>` | +| `swap` | 1 image only | `swap [x] from <<>> for [x] from <<>>` | +| `removal` | not required | `Delete [x] from <<>>` | + +**Image requirements (for add/swap):** +- Formats: `.jpg` / `.jpeg` / `.png` +- Max 10 MB; min 300 px; aspect ratio 1:2.5–2.5:1 +- Base64: raw string only — **no** `data:image/png;base64,` prefix + +--- + +## Step 6 — Query Task + +`GET /v1/videos/multi-elements/{task_id}` +`GET /v1/videos/multi-elements?pageNum=1&pageSize=30` + +Task statuses: `submitted` → `processing` → `succeed` / `failed` + +Result video URL expires after **30 days** — download and store promptly. + +--- + +## Key Takeaways + +- Session-based workflow: init once → mark objects → edit → query. Session lives 24 h. +- Three edit modes: **add** (needs 1–2 ref images), **swap** (1 ref image), **remove** (no images needed). +- Object selection uses normalized `[0,1]` click coordinates on specific frame indices — up to 10 frames, 10 points each. +- Response masks are RLE-encoded; decode to `Uint8Array` for canvas rendering. +- Only `kling-v1-6` supports multi-elements; duration must be 5 s or 10 s matching source video length bracket. +- Generated videos auto-delete after 30 days; use `callback_url` for async workflows. +- Base64 images must be raw (no data-URI prefix). + +--- + +## Related + +- [[wiki/web-agency/kling-text-to-video-api|Kling Text-to-Video API]] — generate new videos from prompts +- [[wiki/web-agency/kling-image-to-video-api|Kling Image-to-Video API]] — animate still images +- [[wiki/web-agency/kling-multi-image-to-video-api|Kling Multi-Image-to-Video API]] — composite 2–4 reference images +- [[wiki/web-agency/kling-motion-control-api|Kling Motion Control API]] — pose/motion transfer +- [[wiki/web-agency/claude-code-nanobanana-website-workflow|Claude Code + Nanobanana 2 Workflow]] — end-to-end agency workflow using Kling + +--- + +## Sources + +- Raw: `raw/Kling AI Next-Gen AI Video & AI Image Generator 5.md` +- Origin: Kling AI API docs — `/v1/videos/multi-elements` diff --git a/wiki/web-agency/kling-video-extension-api.md b/wiki/web-agency/kling-video-extension-api.md new file mode 100644 index 0000000..e97c46c --- /dev/null +++ b/wiki/web-agency/kling-video-extension-api.md @@ -0,0 +1,135 @@ +--- +title: "Kling AI Video Extension API Reference" +aliases: [kling-video-extend, kling-extend-api] +tags: [kling, api, video, extension, ai-video] +sources: [raw/Kling AI Next-Gen AI Video & AI Image Generator 6.md] +created: 2026-04-26 +updated: 2026-04-26 +--- + +## Overview + +The Video Extension API appends additional footage to an existing Kling-generated video. Each extension adds 4–5 seconds; a video can be extended repeatedly up to a **3-minute total cap**. + +- Base URL (Singapore): `https://api-singapore.klingai.com` +- Auth: `Authorization: Bearer ` + +--- + +## Create Extension Task + +`POST /v1/videos/video-extend` + +```bash +curl --request POST \ + --url https://api-singapore.klingai.com/v1/videos/video-extend \ + --header 'Authorization: Bearer ' \ + --header 'Content-Type: application/json' \ + --data '{ + "prompt": "A puppy appears", + "video_id": "743211632612511839", + "negative_prompt": "", + "callback_url": "" + }' +``` + +### Request Body + +| Field | Type | Required | Notes | +|-------|------|----------|-------| +| `video_id` | string | Yes | Source video ID (text-to-video, image-to-video, or prior extension). Max total 3 min. | +| `prompt` | string | No | Up to 2500 characters | +| `negative_prompt` | string | No | Up to 2500 characters | +| `cfg_scale` | number | No | Prompt reference strength, range [0, 1] | +| `watermark_info` | object | No | `{"enabled": boolean}` — generate watermarked output alongside clean output | +| `callback_url` | string | No | Server-push URL for status changes | +| `external_task_id` | string | No | User-defined ID (must be unique per user) | + +### Supported Source Videos + +- Generated by **V1.0, V1.5, or V1.6** models only +- Source videos expire **30 days** after generation — extension not possible after that + +### Response (200) + +```json +{ + "code": 0, + "message": "string", + "request_id": "string", + "data": { + "task_id": "string", + "task_status": "submitted | processing | succeed | failed", + "task_info": { "external_task_id": "string" }, + "created_at": 1722769557708, + "updated_at": 1722769557708 + } +} +``` + +--- + +## Query Single Task + +`GET /v1/videos/video-extend/{task_id}` + +```bash +curl --request GET \ + --url https://api-singapore.klingai.com/v1/videos/video-extend/{task_id} \ + --header 'Authorization: Bearer ' +``` + +Use either `task_id` or `external_task_id` as the path parameter. + +### Response — Notable Fields + +| Field | Notes | +|-------|-------| +| `task_info.parent_video.id` | Original video ID before extension | +| `task_info.parent_video.duration` | Original duration (seconds) | +| `task_result.videos[].id` | New extended video ID (cleared after 30 days) | +| `task_result.videos[].url` | Download URL (expires 30 days) | +| `task_result.videos[].duration` | **Total** video duration after extension | +| `final_unit_deduction` | Credits consumed by this task | + +--- + +## Query Task List + +`GET /v1/videos/video-extend?pageNum=1&pageSize=30` + +### Query Parameters + +| Param | Range | Notes | +|-------|-------|-------| +| `pageNum` | [1, 1000] | Page number | +| `pageSize` | [1, 500] | Items per page | + +Response body is the same schema as single-task, wrapped in a `data` array. + +--- + +## Key Takeaways + +- **+4–5 s per call** — each extension appends roughly 4–5 seconds to the source video +- **3-minute hard cap** — total extended duration cannot exceed 3 minutes +- **Model locked** — extension inherits the model and mode of the source video; you cannot switch +- **30-day expiry** — both source and extended videos are deleted after 30 days; download immediately +- **Chain extensions** — you can feed the extended video's ID back as `video_id` to extend further +- **Supported sources** — text-to-video, image-to-video, and prior extension outputs (V1.0/1.5/1.6 only) + +--- + +## Related + +- [[wiki/web-agency/kling-text-to-video-api|Kling Text-to-Video API]] — generate the source video +- [[wiki/web-agency/kling-image-to-video-api|Kling Image-to-Video API]] — animate a still image, then extend +- [[wiki/web-agency/kling-multi-image-to-video-api|Kling Multi-Image-to-Video API]] — composite sources you may want to extend +- [[wiki/web-agency/kling-motion-control-api|Kling Motion Control API]] — pose-driven video generation + +--- + +## Sources + +- `raw/Kling AI Next-Gen AI Video & AI Image Generator 6.md` +- Official docs: `https://kling.ai/document-api/apiReference/model/videoExtension` diff --git a/wiki/web-agency/kling-video-models.md b/wiki/web-agency/kling-video-models.md new file mode 100644 index 0000000..e5efb7d --- /dev/null +++ b/wiki/web-agency/kling-video-models.md @@ -0,0 +1,116 @@ +--- +title: "Kling AI Video Models — Capability Matrix" +aliases: [kling-models, kling-model-comparison, kling-video-models] +tags: [kling, ai-video, api, models, reference] +sources: [raw/Kling AI Next-Gen AI Video & AI Image Generator.md] +created: 2026-04-26 +updated: 2026-04-26 +--- + +# Kling AI Video Models — Capability Matrix + +Full model lineup with feature support per mode. Use this to pick the right model before hitting the API. + +## Model Generations at a Glance + +| Model | Tiers | Max Duration | Standout Features | +|-------|-------|-------------|-------------------| +| kling-v1 | std / pro | 5s / 10s | Camera control (std 5s), motion brush, video effects | +| kling-v1-5 | std / pro | 5s / 10s | Image-to-video only; pro adds start/end frame, motion brush, camera control | +| kling-v1-6 | std / pro | 5s / 10s | Multi-image2video, multi-elements, video effects | +| kling-v2-master | single tier | 5s / 10s | Clean text+image generation, 720p / 24fps | +| kling-v2-1 | std / pro | 5s / 10s | Image-to-video focus; no text-to-video | +| kling-v2-1-master | single tier | 5s / 10s | Text + image generation | +| kling-v2-5-turbo | std / pro | 5s / 10s | Full text+image; pro adds start/end frame | +| kling-v2-6 | std / pro | 5s / 10s | Voice control (pro img2vid), motion control (std custom duration) | +| kling-v3 | std / pro / 4k | 3–15s | Multi-shot, element control, motion control; longest clip | +| kling-v3-omni | std / pro / 4k | 3–15s | Multi-shot, element control, reference video (std/pro only up to 10s) | +| kling-video-o1 | std / pro | 5s / 10s | Single-shot only; element control + video reference | + +--- + +## Feature Deep-Dives + +### kling-v3 / kling-v3-omni (Latest Generation) +- Duration 3–15 s — longest available +- Three tiers: **std**, **pro**, **4k** (4k drops reference video support) +- Both support **multi-shot video generation** (storyboard-style scenes) +- **Element control**: video character elements + multi-image elements +- **Motion control**: std + pro only (❌ 4k) +- Voice control not yet supported on either v3 model +- v3-omni adds reference video input (std/pro 3–10s only) + +### kling-v2-6 (Voice + Motion) +- First model with **voice control** (human voice) on image-to-video (pro tier) +- **Motion control** available at custom durations (std + pro) +- std tier is audio-free only; pro enables full audio +- start/end frame: pro only, no-audio mode + +### kling-v1 (Classic, Most Features) +- Only model with **camera control** on text-to-video (std 5s) +- **Motion brush** (std/pro 5s) +- **Video effects**: dual-character Hug / Kiss / heart_gesture +- **Video extension** supported across all modes + +### kling-v1-5 / kling-v1-6 +- v1-5: image-to-video only (no text-to-video at all) +- v1-6 re-adds text-to-video; adds multi-image2video + multi-elements +- Both support video extension and dual-character effects + +--- + +## Resolution & Frame Rate Reference + +| Model | STD res | PRO res | FPS | +|-------|---------|---------|-----| +| kling-v1 | 720p | 720p | 30 | +| kling-v1-5 | 720p | 1080p | 30 | +| kling-v1-6 (img2vid) | 720p | 1080p | 30 | +| kling-v1-6 (txt2vid) | 720p | 1080p | 24 | +| kling-v2-master | — | — | 24 / 720p | +| kling-v2-1 (img2vid) | 720p | 1080p | 24 | +| kling-v2-1-master | — | 1080p | 24 | +| kling-v2-5 (img2vid) | — | 1080p | 24 | +| kling-v2-5 (txt2vid) | — | 1080p | 24 | + +> PRO tier = 1080p starting from v1-5. Always use PRO for deliverable-quality output. + +--- + +## Non-Model-Specific Features + +| Feature | Supported | Notes | +|---------|-----------|-------| +| Avatar | ✅ | Digital human video from one photo | +| Lip sync | ✅ | Text or audio drives mouth shape; see [[wiki/web-agency/kling-lip-sync-api\|Lip-Sync API]] | +| Video to audio | ✅ | Add audio to any Kling video or user upload | +| Text to audio | ✅ | Generate audio from text prompt | + +--- + +## Model Selection Guide + +- **Best quality clip (up to 15s)**: `kling-v3` or `kling-v3-omni` pro/4k +- **Multi-shot / cinematic storyboard**: `kling-v3` or `kling-v3-omni` +- **Voice-driven character video**: `kling-v2-6` pro +- **Motion transfer from reference video**: `kling-v3` std/pro or `kling-v3-omni` +- **Animate image with fine control**: `kling-v1` pro (motion brush + camera) +- **Multi-image composite**: `kling-v1-6` (see [[wiki/web-agency/kling-multi-image-to-video-api\|Multi-Image-to-Video API]]) +- **Budget / fast iteration**: `kling-v1-6` std or `kling-v2-5-turbo` std + +## Key Takeaways + +- **v3 / v3-omni are the flagship models** — 15s clips, 4K tier, multi-shot, element control +- **PRO always means 1080p** (from v1-5 onwards); STD is 720p +- **Voice control is limited** — only `kling-v2-6` pro (image-to-video) supports it; v3 does not +- **Camera control** lives in `kling-v1` std 5s only — unique to that legacy mode +- **Motion brush** available on v1 and v1-5 pro; not carried forward to v2+ +- **Video effects** (Hug/Kiss/heart_gesture) available v1, v1-5, v1-6 only +- **All videos expire after 30 days** — download before expiry (see [[wiki/web-agency/kling-text-to-video-api\|Text-to-Video API]]) + +--- + +## Sources + +- Raw: `Kling AI Next-Gen AI Video & AI Image Generator.md` +- Origin: Kling AI official API documentation — video models reference page