← 返回 Skills 市场
umrzcz-831

Kling Image Generate

作者 umrjs · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ⚠ suspicious
113
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install kling-image-generate
功能描述
可灵AI图像生成API工具。支持文生图、图生图、多图参考生成、图像Omni、扩图等功能。使用环境变量KLING_ACCESS_KEY和KLING_SECRET_KEY进行鉴权。当用户需要生成AI图像、图片编辑、图像扩展等任务时使用此技能。
使用说明 (SKILL.md)

可灵图像生成

🇨🇳 中文 | 🇬🇧 English

可灵AI图像生成服务,提供文生图、图生图、扩图等多种图像生成和编辑能力。

🔒 安全说明: 本技能需要调用可灵AI官方 API (api-beijing.klingai.com),并使用用户提供的 API Key 进行 JWT 鉴权。所有凭证仅存储在本地环境变量中,不会上传或共享。

快速开始

1. 配置环境变量

export KLING_ACCESS_KEY="your_access_key"
export KLING_SECRET_KEY="your_secret_key"

2. 运行脚本

# 文生图(推荐带进度版本)
python3 scripts/generate_image_with_progress.py \
  --prompt "一只可爱的猫咪,皮克斯风格" \
  --model kling-v3 \
  --n 2 \
  --aspect_ratio 1:1 \
  --wait

# 图生图
python3 scripts/generate_image_with_progress.py \
  --prompt "保持原图风格,添加花朵装饰" \
  --image "https://example.com/image.png" \
  --image_reference subject \
  --wait

脚本清单

脚本 用途 推荐度
generate_image_with_progress.py 图像生成(带进度显示) ⭐ 推荐
generate_image.py 图像生成(基础版) 可选
generate_omni_image.py Omni多图生成 按需
expand_image.py 图像扩图 按需
query_task.py 查询任务状态 工具
list_tasks.py 获取任务列表 工具

核心功能使用

文生图

python3 scripts/generate_image_with_progress.py \
  --prompt "描述你想要的图像内容" \
  --model kling-v3 \
  --n 1 \
  --aspect_ratio 1:1 \
  --resolution 2k \
  --wait

常用参数:

  • --model: 模型(kling-v3, kling-v2-1, kling-v1-5 等)
  • --n: 生成数量 1-9
  • --aspect_ratio: 1:1, 16:9, 9:16, 4:3 等
  • --resolution: 1k, 2k
  • --wait: 等待任务完成并显示进度

图生图

python3 scripts/generate_image_with_progress.py \
  --prompt "基于参考图的描述" \
  --image "https://example.com/ref.jpg" \
  --image_reference subject \
  --image_fidelity 0.7 \
  --wait

参考类型:

  • subject: 主体参考(保持人物/物体主体)
  • face: 面部参考(保持面部特征)

Omni多图生成

支持多图参考、风格迁移等高级功能:

python3 scripts/generate_omni_image.py \
  --prompt "将\x3C\x3C\x3Cimage_1>>>的风格应用到\x3C\x3C\x3Cimage_2>>>上" \
  --images "url1,url2" \
  --model kling-v3-omni \
  --resolution 2k \
  --wait

扩图

智能扩展图像边界:

# 手动指定扩展比例
python3 scripts/expand_image.py \
  --image "https://example.com/img.jpg" \
  --up 0.5 --down 0.5 --left 0.5 --right 0.5 \
  --prompt "扩展区域的描述" \
  --wait

# 自动计算比例
python3 scripts/expand_image.py \
  --image "https://example.com/img.jpg" \
  --auto_ratio \
  --width 1024 --height 1024 \
  --aspect_ratio 16:9 \
  --wait

任务管理

查询任务状态

python3 scripts/query_task.py --task_id "xxx"

获取任务列表

python3 scripts/list_tasks.py --api_type generation --page 1

详细参考

安全使用建议
Before installing: (1) Note that the package requires KLING_ACCESS_KEY and KLING_SECRET_KEY (the registry metadata incorrectly omitted them) — only provide keys you trust and consider using a dedicated/limited account. (2) Confirm you trust the API host api-beijing.klingai.com and are comfortable the service will receive JWT-authenticated requests. (3) Avoid supplying an untrusted callback_url (it can cause results to be posted to an external endpoint). (4) Install dependencies in an isolated environment (virtualenv) and review the scripts yourself; if you later suspect key leakage, rotate the keys. If you want higher assurance, ask the publisher for a homepage or source repo and a corrected metadata entry that lists the required env vars.
功能分析
Type: OpenClaw Skill Name: kling-image-generate Version: 1.0.1 The skill bundle is a legitimate integration for the Kling AI image generation service. It provides scripts (e.g., generate_image_with_progress.py, expand_image.py) to interact with the official Kling AI API (api-beijing.klingai.com). Authentication is handled securely by generating JWT tokens locally using environment variables (KLING_ACCESS_KEY, KLING_SECRET_KEY), and there is no evidence of credential exfiltration, unauthorized network calls, or malicious prompt injection.
能力评估
Purpose & Capability
The scripts and SKILL.md implement a client for the Kling AI image API (text->image, image->image, omni, expansion). The requested credentials (KLING_ACCESS_KEY, KLING_SECRET_KEY) and dependencies (requests, JWT libraries) are coherent with that purpose. However, registry metadata lists no required env vars/primary credential while the SKILL.md and all scripts clearly require the two KLING_* environment variables — this metadata mismatch is an inconsistency to be aware of.
Instruction Scope
SKILL.md instructs users to set the two KLING_* env vars and run included Python scripts; the scripts only call the documented api-beijing.klingai.com endpoints and do not attempt to read unrelated system files or other credentials. One operational note: the scripts accept an optional callback_url parameter (which will be invoked by the remote service) — if you supply a third-party callback URL you could direct generated results to an external endpoint, so treat callback_url as a potential exfil vector if misused.
Install Mechanism
No install specification is included (instruction- + script bundle). The included requirements.txt (requests, PyJWT, cryptography) matches the code's usage. There are no external downloads or obscure install URLs in the package.
Credentials
The skill requires KLING_ACCESS_KEY and KLING_SECRET_KEY for JWT authentication — this is appropriate and necessary for the stated API calls. The concern is that the package/registry metadata omitted these required env variables (declared as 'none'), which is an internal inconsistency and could mislead less-technical users into installing without supplying keys. No other unrelated secrets are requested.
Persistence & Privilege
The skill does not request persistent 'always' inclusion and does not modify other skills or system-wide configuration. It runs as user-invoked scripts and has normal, limited privileges.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install kling-image-generate
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /kling-image-generate 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
- Added a security notice specifying API usage and JWT authentication requirements. - Clarified that API credentials are stored only in local environment variables and not shared. - No changes to core functionality or usage instructions.
v1.0.0
kling-image-generate 1.0.0 - 首次发布:集成可灵AI图像生成API工具,支持文生图、图生图、多图参考生成、图像Omni、扩图等核心功能。 - 提供多种脚本,支持基础与进阶的图像生成、扩图及任务管理功能演示和调用。 - 中文详细文档,包含环境变量配置、常用参数说明和功能脚本举例。 - 支持多模型选择、分辨率与比例可调,适用于多场景AI图像生成需求。
元数据
Slug kling-image-generate
版本 1.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Kling Image Generate 是什么?

可灵AI图像生成API工具。支持文生图、图生图、多图参考生成、图像Omni、扩图等功能。使用环境变量KLING_ACCESS_KEY和KLING_SECRET_KEY进行鉴权。当用户需要生成AI图像、图片编辑、图像扩展等任务时使用此技能。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 113 次。

如何安装 Kling Image Generate?

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

Kling Image Generate 是免费的吗?

是的,Kling Image Generate 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Kling Image Generate 支持哪些平台?

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

谁开发了 Kling Image Generate?

由 umrjs(@umrzcz-831)开发并维护,当前版本 v1.0.1。

💬 留言讨论