Communitygithub.com

Kling AI 動画延長スキル

Kling AI の継続生成機能を使って動画の長さを延長します。短いクリップから長めの動画を作成したり、シーケンスを構築する際に使用します。「klingai 動画延長」「kling ai 継続生成」「klingai ロング動画」「klingai クリップ延長」などのフレーズで起動します。

Kling AI 動画延長スキル とは?

このスキルは、Kling AI の Video Extension API を利用して、既存の動画に追加の秒数をシームレスに追加する機能を提供します。主に短いクリップから長尺の動画を生成したい開発者やAIエージェントユーザー向けに設計されており、Claude Code、Cursor、Codex などのプラットフォームと組み合わせて使用できます。完了した動画の `task_id` を指定して延長リクエストを送信し、ポーリングで完了を確認するフローです。さらに、複数の延長をチェーンして20秒以上の動画を構築するサンプルコードも含まれています。標準モード(5秒延長あたり10クレジット)とプロフェッショナルモード(同35クレジット)を選択でき、エラーハンドリングや権利・ポリシーに関する注意事項も記載されています。APIエンドポイントは `POST https://api.klingai.com/v1/videos/video-extend` で、JWT認証が必要です。

対応✓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-video-extension

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Kling AI 動画延長スキル は何をしますか?

概要

既存の動画に追加の秒数を追加して延長します。延長エンドポイントは、完了した動画の task_id を受け取り、シームレスな継続を生成します。

エンドポイント: POST https://api.klingai.com/v1/videos/video-extend

リクエストパラメータ

パラメータ型必須説明
task_idstringはい完了したソース動画のタスクID
promptstringいいえ延長部分の動き/シーンの説明
durationstringいいえ延長時間: "5"(デフォルト)
modestringいいえ"standard" または "professional"
model_namestringいいえデフォルト: "kling-v2-master"
callback_urlstringいいえ完了通知用のWebhook

基本延長

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"}

# ステップ 1: 最初の5秒動画を生成
initial = requests.post(f"{BASE}/videos/text2video", headers=get_headers(), json={
    "model_name": "kling-v2-master",
    "prompt": "砂漠の風景からロケットが打ち上げられる、シネマティック",
    "duration": "5",
    "mode": "standard",
}).json()
initial_task_id = initial["data"]["task_id"]

# 完了を待つ...
# (task_status が "succeed" になるまでポーリング)

# ステップ 2: さらに5秒延長
extension = requests.post(f"{BASE}/videos/video-extend", headers=get_headers(), json={
    "task_id": initial_task_id,
    "prompt": "ロケットが雲の中を上昇し、成層圏へ",
    "duration": "5",
    "mode": "standard",
}).json()
ext_task_id = extension["data"]["task_id"]

# ステップ 3: 延長タスクをポーリング
while True:
    time.sleep(15)
    result = requests.get(
        f"{BASE}/videos/video-extend/{ext_task_id}", headers=get_headers()
    ).json()
    if result["data"]["task_status"] == "succeed":
        extended_url = result["data"]["task_result"]["videos"][0]["url"]
        print(f"延長された動画: {extended_url}")
        break
    elif result["data"]["task_status"] == "failed":
        print(f"失敗: {result['data']['task_status_msg']}")
        break

複数延長のチェーン

def chain_extensions(initial_task_id: str, prompts: list[str],
                     duration: str = "5", mode: str = "standard") -> list[str]:
    """複数の延長をチェーンして、より長い動画を構築する。"""
    current_task_id = initial_task_id
    video_urls = []

    for i, prompt in enumerate(prompts):
        print(f"延長 {i + 1}/{len(prompts)}: 送信中...")

        # 延長を送信
        r = requests.post(f"{BASE}/videos/video-extend", headers=get_headers(), json={
            "task_id": current_task_id,
            "prompt": prompt,
            "duration": duration,
            "mode": mode,
        }).json()
        ext_task_id = r["data"]["task_id"]

        # 完了をポーリング
        while True:
            time.sleep(15)
            result = requests.get(
                f"{BASE}/videos/video-extend/{ext_task_id}", headers=get_headers()
            ).json()
            status = result["data"]["task_status"]

            if status == "succeed":
                url = result["data"]["task_result"]["videos"][0]["url"]
                video_urls.append(url)
                current_task_id = ext_task_id  # 次の延長はこれにチェーンする
                print(f"延長 {i + 1} 完了: {url}")
                break
            elif status == "failed":
                raise RuntimeError(f"延長 {i + 1} 失敗: {result['data']['task_status_msg']}")

    return video_urls

使用例: 20秒の動画を作成

# 最初の5秒を生成
initial_r = requests.post(f"{BASE}/videos/text2video", headers=get_headers(), json={
    "model_name": "kling-v2-master",
    "prompt": "山の湖に朝日が昇る、霧が立ち込める",
    "duration": "5",
    "mode": "standard",
}).json()
initial_id = initial_r["data"]["task_id"]
# ... 完了までポーリング ...

# さらに3回延長 = 5 + 5 + 5 + 5 = 合計20秒
extensions = chain_extensions(initial_id, [
    "太陽がさらに高く昇り、鳥が湖の上を飛び始める",
    "鹿が水辺に近づき水を飲む",
    "ワイドショットで後退し、山脈全体を映す",
])

コスト

各延長は新しい生成と同じコストがかかります:

延長時間標準プロフェッショナル
5秒10 クレジット35 クレジット

20秒の動画(最初の生成 + 3回延長)は、標準モードで40クレジットかかります。

エラーハンドリング

エラー原因修正方法
無効な task_idソースタスクが存在しないtask_id が完了した生成からのものであることを確認
ソースが未完了処理中のタスクを延長しようとしたソースタスクが succeed 状態になるまで待つ
延長失敗プロンプトがソースと競合延長プロンプトを元のシーンに合わせる

前提条件

  • 完了した、権利処理済みまたは合成のソースドラフト、承認済み延長概要、許可されたワークスペースとクレジット予算、ポリシーレビュー、ドラフト専用の出力先、およびロールバック/削除の責任者がいること。

手順

  1. 延長を作成する前に、ソースの所有権、完了状態、承認済みの継続概要を確認すること。プライベート、未ライセンス、またはポリシー制限のある素材は使用しないこと。
  2. 承認された期間とクレジット上限内で、ウォーターマーク付きのドラフトカナリーを1件提出し、その後ポリシー、権利、品質、出力先の制御を確認すること。
  3. 継続性、ポリシー、権利、または予算に逸脱が生じた場合は停止し、公開せずに延長タスクを削除すること。
  4. 所有者の承認を得た後にのみ公開すること。編集済みの領収書を保持し、合意された保持期間の終了時に一時的なアセットを削除すること。

出力

ソースタスク参照、権利分類、モード/期間、クレジット見積もり、ポリシーレビュー、ドラフト出力先、承認者、保持/削除参照、タスクIDを含む延長領収書を生成すること。プロンプト、ID、アセットURLは含めないこと。

例

source=synthetic-task-42; rights=cleared; duration=5s; mode=standard; policy=pass; destination=draft-only; 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".

関連スキル