Communitygithub.com

Army161/OpenMontage

透過多重供應商閘道,從文字提示生成 AI 影片。適用於:文字轉影片、圖生影片,以及在不同供應商(VEO、Kling、Sora、Runway、Seedance、MiniMax)之間選擇。支援 HeyGen API 和 fal.ai API 兩個閘道。

OpenMontage 是什麼?

這項技能讓 AI 代理能透過兩個主要 API 閘道(HeyGen 和 fal.ai)從文字提示生成 AI 影片,並支援多種頂級影片生成供應商,包括 Google VEO、Kling、Runway、Sora、Seedance 和 MiniMax。代理無需直接呼叫供應商工具,而是使用一個智能選擇器 (`video_selector`),該選擇器能自動處理可用性檢查、成本比較和自動降級,並將 Seedance 2.0 (透過 fal.ai) 設為電影級、預告片和高保真剪輯作品的預設首選。Seedance 2.0 因其獨特的單次同步音訊、多鏡次生成、導演級相機控制以及根據對話進行嘴型同步的功能而備受推崇。此技能適用於 Cursor 和 Claude Code 等 AI 編碼代理平台,提供完整的端點文件、輪詢邏輯以及 TypeScript 和 Python 的程式碼範例,協助開發者輕鬆將影片生成整合到其工作流程中。

相容平台~Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/Army161/OpenMontage/tree/HEAD/.agents/skills/ai-video-gen

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

影片生成(多閘道)

從文字提示生成 AI 影片。可透過兩個 API 閘道支援多個供應商:

閘道環境變數供應商工具
fal.aiFAL_KEYSeedance 2.0(標準 + 快速)、Kling v3/v2.1、MiniMax、VEOseedance_video, kling_video, minimax_video, veo_video
HeyGenHEYGEN_API_KEYVEO 3.1、Kling Pro、Sora v2、Runway Gen-4、Seedance Pro / Lite (1.x)heygen_video

首選高級預設 — Seedance 2.0。 當任何高級閘道已設定(FAL_KEY → seedance_video,或 HeyGen 的 Video Agent / Avatar Shots 路徑),Seedance 2.0 是電影、預告片和高保真剪輯工作的首選預設。它是該系列中唯一提供單次原生同步音訊、多鏡次生成、導演級相機控制以及根據引述對話進行嘴型同步的模型,並在 2026 年初於 Artificial Analysis Elo 排名第一。僅在使用者有特定理由(預算、供應商偏好、風格適合度,例如 VEO 適合真實風景或 Kling 適合特定動畫風格)時才切換。請參閱第 3 層 seedance-2-0 以獲取權威的提示和參數指南。

重要: 始終使用 video_selector 而不是直接呼叫供應商工具。選擇器負責可用性檢查、成本比較和自動降級,其評分引擎已偏向於將 Seedance 2.0 用於電影意圖。

驗證

使用最符合使用者可用供應商及成本/品質目標的已設定閘道。

  • HeyGen: 設定 HEYGEN_API_KEY 以存取多模型閘道。
  • fal.ai: 設定 FAL_KEY 以透過 fal.ai 存取 Kling、MiniMax 和 Veo。

在檢查註冊表和當前任務適合度之前,不要將任何閘道描述為預設或首選。

curl -X POST "https://api.heygen.com/v1/workflows/executions" \
  -H "X-Api-Key: $HEYGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"workflow_type": "GenerateVideoNode", "input": {"prompt": "夕陽下飛越沿海城市的空拍鏡頭"}}'

預設工作流程

  1. 呼叫 POST /v1/workflows/executions,指定 workflow_type: "GenerateVideoNode" 和您的提示
  2. 在回應中收到一個 execution_id
  3. 每 10 秒輪詢 GET /v1/workflows/executions/{id},直到狀態變為 completed
  4. 使用輸出中返回的 video_url

執行影片生成

端點

POST https://api.heygen.com/v1/workflows/executions

請求欄位

欄位類型必填說明
workflow_typestringY必須為 "GenerateVideoNode"
input.promptstringY要生成影片的文字描述
input.providerstring影片生成供應商(預設:"veo_3_1")。請參閱下方供應商列表。
input.aspect_ratiostring長寬比(預設:"16:9")。常用值:"16:9"、"9:16"、"1:1"
input.reference_image_urlstring用於圖生影片的參考圖片 URL
input.tail_image_urlstring用於最後幀引導的結尾圖片 URL
input.configobject供應商特定的配置覆蓋

供應商

供應商值說明
VEO 3.1"veo_3_1"Google VEO 3.1(預設,最高品質)
VEO 3.1 Fast"veo_3_1_fast"更快的 VEO 3.1 變體
VEO 3"veo3"Google VEO 3
VEO 3 Fast"veo3_fast"更快的 VEO 3 變體
VEO 2"veo2"Google VEO 2
Kling Pro"kling_pro"Kling Pro 模型
Kling V2"kling_v2"Kling V2 模型
Sora V2"sora_v2"OpenAI Sora V2
Sora V2 Pro"sora_v2_pro"OpenAI Sora V2 Pro
Runway Gen-4"runway_gen4"Runway Gen-4
Seedance Lite"seedance_lite"Seedance Lite
Seedance Pro"seedance_pro"Seedance Pro
LTX Distilled"ltx_distilled"LTX Distilled(最快)

curl

curl -X POST "https://api.heygen.com/v1/workflows/executions" \
  -H "X-Api-Key: $HEYGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "workflow_type": "GenerateVideoNode",
    "input": {
      "prompt": "金色時刻飛越沿海城市的空拍鏡頭,電影級燈光",
      "provider": "veo_3_1",
      "aspect_ratio": "16:9"
    }
  }'

TypeScript

interface GenerateVideoInput {
  prompt: string;
  provider?: string;
  aspect_ratio?: string;
  reference_image_url?: string;
  tail_image_url?: string;
  config?: Record<string, any>;
}

interface ExecuteResponse {
  data: {
    execution_id: string;
    status: "submitted";
  };
}

async function generateVideo(input: GenerateVideoInput): Promise<string> {
  const response = await fetch("https://api.heygen.com/v1/workflows/executions", {
    method: "POST",
    headers: {
      "X-Api-Key": process.env.HEYGEN_API_KEY!,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      workflow_type: "GenerateVideoNode",
      input,
    }),
  });

  const json: ExecuteResponse = await response.json();
  return json.data.execution_id;
}

Python

import requests
import os

def generate_video(
    prompt: str,
    provider: str = "veo_3_1",
    aspect_ratio: str = "16:9",
    reference_image_url: str | None = None,
    tail_image_url: str | None = None,
) -> str:
    payload = {
        "workflow_type": "GenerateVideoNode",
        "input": {
            "prompt": prompt,
            "provider": provider,
            "aspect_ratio": aspect_ratio,
        },
    }

    if reference_image_url:
        payload["input"]["reference_image_url"] = reference_image_url
    if tail_image_url:
        payload["input"]["tail_image_url"] = tail_image_url

    response = requests.post(
        "https://api.heygen.com/v1/workflows/executions",
        headers={
            "X-Api-Key": os.environ["HEYGEN_API_KEY"],
            "Content-Type": "application/json",
        },
        json=payload,
    )

    data = response.json()
    return data["data"]["execution_id"]

回應格式

{
  "data": {
    "execution_id": "node-gw-v1d2e3o4",
    "status": "submitted"
  }
}

檢查狀態

端點

GET https://api.heygen.com/v1/workflows/executions/{execution_id}

curl

curl -X GET "https://api.heygen.com/v1/workflows/executions/node-gw-v1d2e3o4" \
  -H "X-Api-Key: $HEYGEN_API_KEY"

回應格式(已完成)

{
  "data": {
    "execution_id": "node-gw-v1d2e3o4",
    "status": "completed",
    "output": {
      "video": {
        "video_url": "https://resource.heygen.ai/generated/video.mp4",
        "video_id": "abc123"
      },
      "asset_id": "asset-xyz789"
    }
  }
}

輪詢以等待完成

async function generateVideoAndWait(
  input: GenerateVideoInput,
  maxWaitMs = 600000,
  pollIntervalMs = 10000
): Promise<{ video_url: string; video_id: string; asset_id: string }> {
  const executionId = await generateVideo(input);
  console.log(`已提交影片生成:${executionId}`);

  const startTime = Date.now();
  while (Date.now() - startTime < maxWaitMs) {
    const response = await fetch(
      `https://api.heygen.com/v1/workflows/executions/${executionId}`,
      { headers: { "X-Api-Key": process.env.HEYGEN_API_KEY! } }
    );
    const { data } = await response.json();

    switch (data.status) {
      case "completed":
        return {
          video_url: data.output.video.video_url,
          video_id: data.output.video.video_id,
          asset_id: data.output.asset_id,
        };
      case "failed":
        throw new Error(data.error?.message || "影片生成失敗");
      case "not_found":
        throw new Error("未找到工作流程");
      default:
        await new Promise((r) => setTimeout(r, pollIntervalMs));
    }
  }

  throw new Error("影片生成超時");
}

使用範例

簡單的文字轉影片

curl -X POST "https://api.heygen.com/v1/workflows/executions" \
  -H "X-Api-Key: $HEYGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "workflow_type": "GenerateVideoNode",
    "input": {
      "prompt": "一個人在陽光明媚的公園裡行走,淺景深"
    }
  }'

圖生影片

{
  "workflow_type": "GenerateVideoNode",
  "input": {
    "prompt": "將這張產品照片以緩慢縮放和柔和粒子效果製作成動畫",
    "reference_image_url": "https://example.com/product-photo.png",
    "provider": "kling_pro"
  }
}

適用於社交媒體的垂直格式

{
  "workflow_type": "GenerateVideoNode",
  "input": {
    "prompt": "時尚咖啡廳內景,鏡頭緩慢橫掃櫃檯",
    "aspect_ratio": "9:16",
    "provider": "veo_3_1"
  }
}

使用 LTX 快速生成

{
  "workflow_type": "GenerateVideoNode",
  "input": {
    "prompt": "抽象多彩形狀變形流動",
    "provider": "ltx_distilled"
  }
}

最佳實踐

  1. 提示描述要詳細 — 包含攝影機運鏡、燈光、風格和情緒細節
  2. 當 FAL_KEY 已設定時,預設使用 Seedance 2.0(透過 seedance_video)進行電影和動作為主的工作 — 單次同步音訊、多鏡次、嘴型同步、導演級相機。僅當使用者特別想要 Google 或 OpenAI 的角色動畫時,才使用 VEO 3.1 / Sora V2 Pro;僅當速度是硬性限制時,才使用 ltx_distilled 或 veo3_fast
  3. 使用參考圖片 進行圖生影片 — 非常適合將產品照片或靜態影像製作成動畫
  4. 影片生成是最慢的工作流程 — 最多等待 5 分鐘,每 10 秒輪詢一次
  5. 長寬比很重要 — 社交媒體限時動態/Reels 使用 9:16,橫向使用 16:9,方形使用 1:1
  6. 輸出包含 asset_id — 使用此 ID 在其他 HeyGen 工作流程中引用生成的影片
  7. 輸出 URL 是臨時的 — 請及時下載或儲存生成的影片

Individual skills in this repo

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

Army161/OpenMontage

Create AI avatar videos with precise control over avatars, voices, scripts, scenes, and backgrounds using HeyGen's v2 API. Use when: (1) Choosing a specific avatar and voice for a video, (2) Writing exact scripts for an avatar to speak, (3) Building multi-scene videos with different backgrounds per scene, (4) Creating transparent WebM videos for compositing, (5) Using talking photos as video presenters, (6) Integrating HeyGen avatars with Remotion, (7) Batch video generation with exact specs, (8) Brand-consistent production videos with precise control.

Army161/OpenMontage

Use p5.js/canvas for local procedural character effects: particles, weather, squash/stretch, walk cycles, and environmental motion.

Army161/OpenMontage

Review local character animation with schema checks, Playwright browser previews, frame sampling, and FFmpeg/ffprobe final output checks.

Army161/OpenMontage

Create videos from a text prompt using HeyGen's Video Agent. Use when: (1) Creating a video from a description or idea, (2) Generating explainer, demo, or marketing videos from a prompt, (3) Making a video without specifying exact avatars, voices, or scenes, (4) Quick video prototyping or drafts, (5) One-shot prompt-to-video generation, (6) User says "make me a video" or "create a video about X".

Army161/OpenMontage

Generate Mandarin and multilingual narration with Volcengine Doubao Speech 2.0. Use when creating Chinese voiceovers, when the user prefers Doubao/Volcengine/火山引擎/豆包 TTS, or when narration needs character-level timestamp metadata for subtitles.

Army161/OpenMontage

Video and audio processing with FFmpeg. Use for format conversion, resizing, compression, audio extraction, and preparing assets for Remotion. Triggers include converting GIF to MP4, resizing video, extracting audio, compressing files, or any media transformation task.

Army161/OpenMontage

Use when implementing Disney's 12 animation principles with Framer Motion in React applications

Army161/OpenMontage

All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). HyperFrames-native: single paused timeline, seek-safe, deterministic.

Army161/OpenMontage

HyperFrames CLI dev loop. Use when running npx hyperframes init, add, catalog, capture, lint, validate, inspect, layout, snapshot, preview, play, render, publish, lambda, doctor, browser, info, upgrade, skills, compositions, docs, benchmark, telemetry, transcribe, tts, or remove-background, or when troubleshooting the HyperFrames build/render environment. Entry point for AWS Lambda cloud rendering (`hyperframes lambda deploy / render / progress / destroy / policies`).

Army161/OpenMontage

The HyperFrames composition contract — build one renderable project. Use for composition structure, the `data-*` timing attributes, `class="clip"`, tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.

Army161/OpenMontage

Non-animation creative direction for HyperFrames videos. Use for design spec (frame.md / design.md) handling, palettes, typography, narration, beat planning, audio-reactive visuals, composition patterns, and brand / style decisions. For atomic motion patterns and scene blueprints, use `hyperframes-animation`.

Army161/OpenMontage

Audio and media assets for HyperFrames compositions, produced by one shared audio engine (`scripts/audio.mjs`) — multi-provider TTS (HeyGen / ElevenLabs / Kokoro local), background music + sound effects (HeyGen audio-library retrieval by default, with local Lyria / MusicGen BGM generation and a bundled SFX library as the no-credential fallback), Whisper transcription, background removal, and caption authoring. Use for voiceover / TTS, BGM, SFX / sound effects, transcription, captions / subtitles / lyrics / karaoke / per-word styling, voice + provider selection, and music-mood prompting.

Army161/OpenMontage

Install and wire registry blocks and components into HyperFrames compositions. Use when running hyperframes add, installing a block or component, wiring an installed item into index.html, or working with hyperframes.json. Covers the add command, install locations, block sub-composition wiring, component snippet merging, registry discovery, and authoring a new block or component to contribute upstream (idea → scaffold → validate → PR).

Army161/OpenMontage

Use when the user wants a short, design-led motion graphic where motion is the message: kinetic typography, stat or number count-up, chart/data-viz hit, logo sting, brand lockup, lower-third, callout, social overlay, animated headline/tweet/news item, motion poster, or quick captured-page highlight. Usually under 10s and up to ~30s, with no narration arc, voice-over, or live-action subject. Can render to MP4 or transparent overlay. Not for longer, multi-scene, narrated, or brand-reel pieces (use general-video), narrated website videos (website-to-video), topic explainers (faceless-explainer), product promos (product-launch-video), PR videos (pr-to-video), or captions on existing footage (embedded-captions). When unsure whether it's a quick motion-first piece or a longer / narrated treatment, see /hyperframes.

Army161/OpenMontage

Use when the user has a music track (an audio file, or a video to pull audio from) and wants a beat-synced HyperFrames video, calm to hard-hitting. The music drives everything: one analyzer reads it once, the orchestrator lays out the frames and fills a per-frame plan, and one sub-agent builds each frame. Typography and templates are the floor — a complete video needs zero assets — but any images or videos the user supplies are cut into the frames on the same beat grid (beat-cut / ken-burns). The genre (lyric video, slideshow, kinetic promo) falls out of the per-frame choices; the pipeline never branches on it.

Army161/OpenMontage

Best practices for Remotion - Video creation in React

Army161/OpenMontage

Toolkit-specific Remotion patterns — custom transitions, shared components, and project conventions. For core Remotion framework knowledge (hooks, animations, rendering, etc.), see the `remotion-official` skill.

Army161/OpenMontage

Port an existing Remotion (React) composition to HyperFrames HTML. Use ONLY when the user explicitly asks to port/convert/migrate/translate a Remotion source. Do NOT use: (a) authoring a new HyperFrames composition; (b) Remotion mentioned in passing; (c) Remotion code shared as reference only; (d) "same video as my Remotion one" without explicit migrate request — treat as fresh build. Doubt → `/general-video`. One-way, Remotion-only: no reverse export (HyperFrames→Remotion or any framework), no non-Remotion source (After Effects, Framer Motion, plain React/CSS) → out of scope, re-create via `/general-video`. Flags unsupported patterns (useState, useEffect, async calculateMetadata, third-party React libs, `@remotion/lambda`) and recommends runtime interop over lossy translation. Unsure whether to port vs. build fresh, or only a passing Remotion mention? → /hyperframes.

Army161/OpenMontage

Animate SVG character rigs with GSAP, CSS transforms, Remotion frame control, and HyperFrames-compatible browser previews.

Army161/OpenMontage

Three.js animation - keyframe animation, skeletal animation, morph targets, animation mixing. Use when animating objects, playing GLTF animations, creating procedural motion, or blending animations.

相關技能