Communitygithub.com

jeremylongshore/tons-of-skills-marketplace

使用 Kling AI 从文本提示生成视频。适用于根据描述创建视频、学习提示工程技术或构建文本转视频管道。触发短语如“kling ai text to video”、“klingai prompt”、“generate video from text”、“text2video kling”。

tons-of-skills-marketplace 是什么?

此技能封装了 Kling AI 的 Text-to-Video API,允许开发者通过文本提示直接生成视频。它支持从 v1 到 v2.6 的多个模型版本,提供标准和专业两种模式,并集成了高级功能如摄像机控制、负向提示以及 v2.6 及以上的原生音频生成。技能提供了完整的 Python 代码示例,详细说明了如何使用 JWT 认证、创建任务、轮询结果以及处理错误。这对于希望快速将文本转视频功能集成到 AI 代理或自动化管道中的开发者来说非常实用,能够大大减少手动调用 API 的重复工作。该技能设计为可跨多种 AI 代理平台使用,例如 Claude Code 或 Cursor,并通过清晰的参数表和示例代码降低了上手门槛。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/jeremylongshore/tons-of-skills-marketplace/tree/HEAD/plugins/saas-packs/klingai-pack/skills/klingai-text-to-video

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Kling AI 文本转视频

概述

使用 /v1/videos/text2video 接口从文本提示生成视频。支持 v1 到 v2.6 模型、标准/专业模式、摄像机控制、负向提示以及原生音频(v2.6+)。

端点: POST https://api.klingai.com/v1/videos/text2video

请求参数

参数类型必填描述
model_name字符串是模型版本(参见模型目录)
prompt字符串是视频描述,最多 2500 字符
negative_prompt字符串否要在生成中排除的内容
duration字符串是"5" 或 "10" 秒
aspect_ratio字符串否"16:9"(默认)、"9:16"、"1:1" 等
mode字符串否"standard"(默认)或 "professional"
cfg_scale浮点数否提示遵循度(0.0-1.0,默认 0.5)
camera_control对象否摄像机运动配置
callback_url字符串否完成通知的 Webhook URL

完整示例 — Python

import jwt, time, os, requests

BASE = "https://api.klingai.com/v1"

def get_headers():
    ak, sk = os.environ["KLING_ACCESS_KEY"], os.environ["KLING_SECRET_KEY"]
    token = jwt.encode(
        {"iss": ak, "exp": int(time.time()) + 1800, "nbf": int(time.time()) - 5},
        sk, algorithm="HS256", headers={"alg": "HS256", "typ": "JWT"}
    )
    return {"Authorization": f"Bearer {token}", "Content-Type": "application/json"}

# 创建文本转视频任务
response = requests.post(f"{BASE}/videos/text2video", headers=get_headers(), json={
    "model_name": "kling-v2-6",
    "prompt": "Aerial drone shot of a coral reef at golden hour, "
              "tropical fish swimming through crystal clear water, "
              "sun rays penetrating the surface, cinematic 4K",
    "negative_prompt": "blurry, low quality, distorted, watermark",
    "duration": "5",
    "aspect_ratio": "16:9",
    "mode": "professional",
    "cfg_scale": 0.5,
})

task = response.json()
task_id = task["data"]["task_id"]

# 轮询等待完成
while True:
    time.sleep(15)
    result = requests.get(
        f"{BASE}/videos/text2video/{task_id}", headers=get_headers()
    ).json()

    status = result["data"]["task_status"]
    if status == "succeed":
        video = result["data"]["task_result"]["videos"][0]
        print(f"视频 URL: {video['url']}")
        print(f"时长: {video['duration']}s")
        break
    elif status == "failed":
        raise RuntimeError(result["data"]["task_status_msg"])
    # else: submitted/processing — keep polling

带摄像机控制

# 摄像机运动类型:pan, tilt, zoom, roll
response = requests.post(f"{BASE}/videos/text2video", headers=get_headers(), json={
    "model_name": "kling-v2-6",
    "prompt": "A medieval castle on a cliff at sunrise, fog in the valley",
    "duration": "5",
    "mode": "standard",
    "camera_control": {
        "type": "simple",
        "config": {
            "horizontal": 5,    # 向右平移(负值向左),范围 -10 到 10
            "vertical": 0,      # 倾斜(负值向下,正值向上)
            "zoom": 3,          # 放大(正值)或缩小(负值)
            "roll": 0,          # 旋转
            "pan": 0,           # 左右移动
            "tilt": -2,         # 上下移动
        }
    },
})

规则: 对于 type: "simple",config 中只能有一个非零字段。

带原生音频(仅 v2.6)

response = requests.post(f"{BASE}/videos/text2video", headers=get_headers(), json={
    "model_name": "kling-v2-6",
    "prompt": "A jazz band performing in a dimly lit club, saxophone solo, "
              "audience clapping, warm amber lighting",
    "duration": "10",
    "mode": "professional",
    "motion_has_audio": True,  # 生成同步音频
})

提示工程技巧

技巧示例
场景 + 动作 + 风格"A samurai walking through cherry blossoms, cinematic slow motion"
光线提示"golden hour", "neon-lit", "overcast diffused light"
镜头语言"close-up", "wide establishing shot", "tracking shot"
负向提示"blurry, watermark, text overlay, distorted faces"
材质/纹理"brushed steel", "hand-painted watercolor", "photorealistic"

成本参考

时长标准专业
5 秒10 积分35 积分
10 秒20 积分70 积分

错误处理

错误原因修复
400 无效提示为空或超过 2500 字符检查提示长度
400 无效模型不支持的 model_name从目录使用有效的模型 ID
402 积分不足积分不够为账户充值
task_status: failed内容政策违规或过于复杂简化提示,移除受限内容

前提条件

  • 已批准的简要说明、权利已清理或合成的参考材料、已授权的 workspace 和预算、内容政策审查、以及用于发布和移除的指定负责人。

操作说明

  1. 根据已批准的简要说明创建沙盒草稿;不要在提示或上传内容中包含个人、受保护材料或未经核实的声明。
  2. 在提交前核实请求的时长、风格、目标、积分预算、内容政策状态以及仅限草稿设置。
  3. 审查带水印的测试渲染结果,确保符合政策、权利和质量要求;如果发现政策或归属问题,立即停止并删除草稿,而非发布。
  4. 仅在得到负责人批准后发布,并保留经过编辑的生产收据;在批准的保留期限到达后移除临时资产。

输出

生成包含以下内容的渲染收据:简要 ID、批准的来源分类、模型/模式、时长、积分估算、政策和权利审查结果、草稿目标、审批人、保留/移除参考以及任务 ID。排除提示文本、身份信息和凭证。

示例

brief=synthetic-product-demo; source=rights-cleared; mode=standard; duration=5s; policy=pass; destination=draft-only; approval=pending; cleanup=24h 是一个安全的测试请求。

资源

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

jeremylongshore/tons-of-skills-marketplace

Use when asked to structure a landing page for positioning, plan a conversion-optimized page layout, or design a launch page. Examples: "landing page for product launch", "conversion-optimized layout for SaaS

jeremylongshore/tons-of-skills-marketplace

Use when asked to design growth-optimized landing pages, activation funnel layouts, or experiment-friendly page structures. Examples: "growth-optimized landing", "activation funnel layout", "A/B testable page

jeremylongshore/tons-of-skills-marketplace

Use when asked to structure a landing page, design page layout for conversion, or plan landing page information architecture. Examples: "landing page structure for SaaS", "conversion-optimized layout

jeremylongshore/tons-of-skills-marketplace

Generate polished demo videos from a single prompt. Use when the user asks to create a demo video, product walkthrough, feature showcase, or animated presentation. Trigger with "make a demo video", "create a product video", "demo walkthrough", or "feature showcase video".

jeremylongshore/tons-of-skills-marketplace

Track cryptocurrency portfolio with real-time valuations, allocation analysis, and P&L tracking. Use when checking portfolio value, viewing holdings breakdown, analyzing allocations, or exporting portfolio data. Trigger with phrases like "show my portfolio", "check crypto holdings", "portfolio allocation", "track my crypto", or "export portfolio".

jeremylongshore/tons-of-skills-marketplace

Runs the full release workflow for the current project. Commits any uncommitted changes, pushes to remote, creates and merges a PR if on a feature branch, determines the next semver version from conventional commits, creates an annotated git tag and GitHub release with generated notes, cleans up merged branches, and returns to a clean main. Use when the user says promote, ship, release, commit and push, tag and release, or get back to main.

jeremylongshore/tons-of-skills-marketplace

Agent skill at plugins/productivity/content-multiplier/skills/channel-formats/SKILL.md

jeremylongshore/tons-of-skills-marketplace

Operate an evidence-backed editorial queue, balance topic and format coverage, schedule approved drafts, and reconcile backlog state with the publishing system. Use when choosing or scheduling the next blog work. Trigger with "show the editorial calendar" or "pick the next topic".

jeremylongshore/tons-of-skills-marketplace

Configure CI/CD pipeline for AppFolio property management integrations. Trigger: "appfolio CI".

jeremylongshore/tons-of-skills-marketplace

Diagnose and fix common AppFolio API integration errors. Trigger: "appfolio error".

jeremylongshore/tons-of-skills-marketplace

Build property management dashboard with AppFolio API data. Trigger: "appfolio property dashboard".

jeremylongshore/tons-of-skills-marketplace

Automate tenant management and lease operations with AppFolio. Trigger: "appfolio tenant management".

jeremylongshore/tons-of-skills-marketplace

Collect AppFolio API debug evidence for support tickets. Trigger: "appfolio debug".

jeremylongshore/tons-of-skills-marketplace

Deploy AppFolio integration service to cloud infrastructure. Trigger: "deploy appfolio".

jeremylongshore/tons-of-skills-marketplace

Query AppFolio properties, units, and tenants via REST API. Trigger: "appfolio hello world".

jeremylongshore/tons-of-skills-marketplace

Configure AppFolio Stack API authentication with OAuth 2.0. Use when setting up property management API access, registering as an AppFolio Stack partner, or configuring client credentials for API calls. Trigger: "install appfolio", "setup appfolio", "appfolio auth", "appfolio API key".

jeremylongshore/tons-of-skills-marketplace

Set up local development for AppFolio property management API integration. Trigger: "appfolio local dev".

jeremylongshore/tons-of-skills-marketplace

Production readiness checklist for AppFolio integrations. Trigger: "appfolio production checklist".

jeremylongshore/tons-of-skills-marketplace

Handle AppFolio API rate limits with throttling and backoff. Trigger: "appfolio rate limit".

jeremylongshore/tons-of-skills-marketplace

Reference architecture for AppFolio property management integration. Trigger: "appfolio architecture".

相关技能