← 返回 Skills 市场
wells1137

Kling Video Generator

作者 Wells Wu · GitHub ↗ · v1.1.0
cross-platform ⚠ suspicious
660
总下载
0
收藏
3
当前安装
2
版本数
在 OpenClaw 中安装
/install kling-video-generator
功能描述
Generate high-quality videos from text, images, or other videos using the Kling 3.0 Omni model. Covers text-to-video, image-to-video, video editing, video re...
使用说明 (SKILL.md)

Kling 3.0 Omni Video Generator

This skill enables the generation and manipulation of videos using the Kling 3.0 Omni model. It provides a structured workflow for constructing API requests based on user intent, ensuring compliance with the model's complex parameter constraints.

Reference Files

This skill includes the following reference files:

  • references/api_reference.mdComplete official API parameter reference, including all fields, types, constraints, mutual exclusion rules (R1–R10), capability matrix, and invocation examples. Read this file before constructing any API call.
  • references/prompt_guide.md — Kling 3.0 Omni prompt writing principles, official formula, template syntax, and few-shot examples for all major scenarios.
  • scripts/kling_api.py — Python utility class for JWT authentication, task creation, and polling.

Core Capabilities

  • Text-to-Video: Generate a video from a textual description.
  • Image-to-Video: Animate a static image with a descriptive prompt.
  • Video-to-Video (Editing): Modify an existing video based on a prompt (e.g., change subject, style).
  • Video-to-Video (Reference): Use an existing video as a reference for camera movement and style.
  • Multi-shot Generation: Create a video with multiple distinct scenes or shots.
  • Audio Generation: Generate video with synchronized audio, including speech and sound effects.

Workflow: From User Intent to API Call

To correctly use the Kling API, you MUST follow this decision-making workflow to construct the API payload. The process is divided into two main stages: Prompt Design and Parameter Construction.

Stage 1: Prompt Design

Before constructing the API call, you must first design the prompt(s) based on the user's request. The quality of the prompt is the single most important factor for a good result.

  1. Consult the Prompting Guide: Read /home/ubuntu/skills/kling-video-generator/references/prompt_guide.md to understand the core principles, official formula, and few-shot examples for writing effective prompts.

  2. Identify the Scenario: Determine which of the following scenarios the user is requesting:

    • Single-shot video (from text, image, or video)
    • Multi-shot video (storyboard with multiple scenes)
  3. Write the Prompt(s):

    • For single-shot, write a single, detailed prompt following the guide's formula.
    • For multi-shot, write a separate prompt for each shot/scene.
    • Use Template Syntax: If the user provides reference images, elements, or videos, you MUST use the \x3C\x3C\x3Cimage_1>>>, \x3C\x3C\x3Celement_1>>>, \x3C\x3C\x3Cvideo_1>>> template syntax in the prompt to explicitly reference them. This is a core feature of the Omni model.

Stage 2: Parameter Construction

Once the prompt(s) are ready, construct the final API request payload by following this decision tree. This ensures all parameter constraints and interdependencies, discovered through extensive testing, are respected.

graph TD
    A[Start] --> B{Multi-shot or Single-shot?};
    B -- Multi-shot --> C[Set `multi_shot: true`];
    B -- Single-shot --> D[Set `multi_shot: false`];

    C --> E{Set `shot_type: "customize"`};
    E --> F[Construct `multi_prompt` array from prompts];
    F --> G[Calculate total duration from `multi_prompt`];
    G --> H[Set top-level `duration`];
    H --> Z[Final Payload];

    D --> I{Video input provided?};
    I -- Yes --> J{Editing or Reference?};
    I -- No --> K[Text/Image-to-Video Path];

    J -- Editing --> L[Set `refer_type: "base"`];
    J -- Reference --> M[Set `refer_type: "feature"`];

    L --> N[Ignore `duration` parameter];
    M --> O[Set `aspect_ratio`];
    N --> P{Audio handling};
    O --> P;

    K --> Q{Audio handling};
    P --> R{Audio handling};

    subgraph R [Audio Handling]
        direction LR
        R1{Want audio output?} -- Yes --> R2[Set `sound: "on"`];
        R1 -- No --> R3[Set `sound: "off"`];
        R2 --> R4{Video input exists?};
        R4 -- Yes --> R5[ERROR: `sound:on` is incompatible with video input];
        R4 -- No --> R6[OK];
    end

    Q --> Z;
    R6 --> Z;
    R3 --> Z;
    R5 --> Stop([Stop/Error]);

Key Parameter Rules (from testing)

This is not an exhaustive list, but a summary of the most critical, non-obvious rules that you MUST follow. For a complete guide, refer to the prompt_guide.md.

Parameter Rule
refer_type MUST be explicit. Do not omit. Defaults to base but this is unreliable. Use base for editing, feature for reference.
duration Ignored in base mode. In customize mode, it MUST equal the sum of multi_prompt durations.
sound Incompatible with video_list. Cannot be on if a reference video is provided.
shot_type MUST be customize for multi_shot: true with the Omni model. intelligence is not supported.
multi_prompt index MUST start from 1. Total duration MUST match top-level duration. Max 6 shots.
aspect_ratio Required for feature mode.
image_list Max 7 images without video input, max 4 images with video input.

Execution

To execute a video generation task, use the provided Python script which handles authentication and polling.

  1. Set Environment Variables: Ensure KLING_ACCESS_KEY and KLING_SECRET_KEY are set.

  2. Construct the Payload: Follow the workflow above to create the JSON payload for the API call.

  3. Run the Script:

    from kling_api import KlingAPI
    
    # Get keys from environment
    access_key = os.environ.get("KLING_ACCESS_KEY")
    secret_key = os.environ.get("KLING_SECRET_KEY")
    api = KlingAPI(access_key, secret_key)
    
    # Your constructed payload
    payload = {
        "model_name": "kling-v3-omni",
        # ... other parameters based on the workflow ...
    }
    
    # Create and poll the task
    task_response = api.create_omni_video_task(payload)
    if task_response and task_response.get("code") == 0:
        task_id = task_response.get("data", {}).get("task_id")
        print(f"Task created: {task_id}")
        result = api.poll_for_completion(task_id)
        if result:
            print("Final video URL:", result.get("videos", [{}])[0].get("url"))
    

This structured approach ensures that all the nuances and constraints of the Kling 3.0 Omni API are handled correctly, leading to fewer errors and more predictable results.

安全使用建议
What to check before installing/use: - The credential request (KLING_ACCESS_KEY and KLING_SECRET_KEY) is expected for calling the Kling API, so only provide keys created for this purpose and avoid reusing high-value credentials (e.g., do not reuse AWS/GitHub tokens). Use a scoped test key if possible. - Inspect and test the bundled script (scripts/kling_api.py) in a safe environment first. There are several inconsistencies between docs and code that likely reflect sloppy engineering rather than malicious intent: the script uses base_url = "https://api.kling.ai" but the shipped API docs reference api-singapore.klingai.com; polling and response-field names in the script don't match the API reference (e.g., code/state/task_status mismatches). These can cause failed API calls or unexpected behavior. - Because the skill has no install spec, it will rely on your environment's Python and installed libraries. Prefer running in an isolated environment (virtualenv/container) and only pip-install the explicitly required packages (PyJWT, requests) from trusted sources. - The SKILL.md references an absolute path for local reference files. Verify where the skill files live in your agent runtime; ensure the agent will not try to read unrelated system paths. - Confirm the publisher/source before trusting secrets: the manifest shows Owner ID but no homepage in the registry metadata; SKILL.md references a GitHub repo. If provenance is important, verify the upstream repository and commit history. If you need to proceed but want to minimize risk: create a dedicated, limited-permission Kling API key pair for testing, run the helper script manually to confirm endpoints and response shapes, and only then allow the agent to invoke the skill autonomously.
功能分析
Type: OpenClaw Skill Name: kling-video-generator Version: 1.1.0 The OpenClaw AgentSkills skill bundle for the Kling video generator appears benign. All code and documentation are aligned with the stated purpose of generating videos using the Kling 3.0 Omni API. The `scripts/kling_api.py` handles API keys securely via environment variables and communicates with legitimate Kling AI endpoints (`https://api.kling.ai` or `https://api-singapore.klingai.com`). The `SKILL.md` and `references/prompt_guide.md` files provide detailed instructions for the AI agent on how to construct API payloads, but these instructions do not contain any directives for prompt injection against the agent, data exfiltration, unauthorized execution, or other malicious activities. No suspicious dependencies, obfuscation, or persistence mechanisms were found.
能力评估
Purpose & Capability
The skill name/description (Kling 3.0 Omni video generation) aligns with its requirements: python3 plus a service access key and secret (KLING_ACCESS_KEY, KLING_SECRET_KEY). The included helper script uses those env vars to create JWTs and call an API — this is proportional to a video-generator integration.
Instruction Scope
SKILL.md confines actions to constructing prompts and calling the Kling API and instructs the agent to read included reference files. It does not ask the agent to read arbitrary user files or unrelated credentials. However, SKILL.md uses an absolute local path (/home/ubuntu/skills/...) when telling the agent to read the prompt guide; that is brittle and may cause the agent to attempt to read system paths if installed differently. Also, the workflow gives the agent wide discretion in prompt construction (must follow many mutually exclusive rules) — not a security problem by itself but increases complexity and the chance of incorrect API calls.
Install Mechanism
There is no install spec (instruction-only with helper Python script). This is low-risk from an installation perspective. The README recommends installing PyJWT and requests via pip; those are common packages but note they will run in whatever environment the agent has. There's no remote arbitrary archive download in the install process.
Credentials
Only two environment variables are required (KLING_ACCESS_KEY, KLING_SECRET_KEY), which directly map to API authentication and are justified by the skill's purpose. No unrelated credentials, config paths, or broad system access are requested.
Persistence & Privilege
The skill does not request always:true and does not modify other skills or system-wide settings. Agent autonomy (model invocation) is enabled by default, which is normal. The skill does not request elevated persistence or privileges.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install kling-video-generator
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /kling-video-generator 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.0
Add complete official API parameter reference (api_reference.md) with all fields, constraint rules R1-R10, capability matrix, and invocation examples
v1.0.0
Initial release: structured API workflow, prompting guide with few-shot examples, and key parameter rules based on extensive testing of Kling 3.0 Omni.
元数据
Slug kling-video-generator
版本 1.1.0
许可证
累计安装 3
当前安装数 3
历史版本数 2
常见问题

Kling Video Generator 是什么?

Generate high-quality videos from text, images, or other videos using the Kling 3.0 Omni model. Covers text-to-video, image-to-video, video editing, video re... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 660 次。

如何安装 Kling Video Generator?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install kling-video-generator」即可一键安装,无需额外配置。

Kling Video Generator 是免费的吗?

是的,Kling Video Generator 完全免费(开源免费),可自由下载、安装和使用。

Kling Video Generator 支持哪些平台?

Kling Video Generator 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Kling Video Generator?

由 Wells Wu(@wells1137)开发并维护,当前版本 v1.1.0。

💬 留言讨论