Communitygithub.com

TerminalSkills/skills

API Runway ML pour la génération et l'édition de vidéos par IA — Gen-3 Alpha Turbo, image-vers-vidéo et vidéo-vers-vidéo. À utiliser pour générer une vidéo à partir de texte ou d'images, appliquer des effets vidéo IA ou automatiser des pipelines de production vidéo créative.

Qu'est-ce que skills ?

Cette compétence expose l'API REST de Runway ML, axée sur le modèle Gen-3 Alpha Turbo, pour générer des vidéos de haute qualité à partir de prompts textuels ou d'images fixes. Elle suit un modèle asynchrone classique : création d'une tâche, interrogation de son état jusqu'à son achèvement, puis téléchargement du résultat. Elle est utile aux développeurs et aux ingénieurs logiciels qui souhaitent intégrer la génération vidéo par IA dans leurs applications, automatiser des pipelines de contenu vidéo (comme des clips publicitaires ou des animations), ou expérimenter avec des effets vidéo créatifs. La compétence prend en charge les environnements Python et utilise `requests` et `python-dotenv`. Elle fournit des fonctions prêtes à l'emploi pour la génération texte-vers-vidéo et image-vers-vidéo, ainsi qu'un exemple de pipeline complet orchestrant la soumission, l'attente et le téléchargement. La documentation inclut également des instructions de configuration, une référence complète des paramètres, et des bonnes pratiques comme la gestion des clés API, des limites de débit et de l'expiration des URL de sortie.

Compatible avec✓Claude Code✓Codex CLI✓Cursor✓Gemini CLI
npx skills add https://github.com/TerminalSkills/skills/tree/HEAD/skills/runway-ml

Demander à votre IA préférée

Ouvre une nouvelle conversation avec cette compétence d'agent déjà préchargée.

Documentation

API Runway ML

Présentation

Le modèle Gen-3 Alpha Turbo de Runway génère des vidéos de haute qualité à partir de prompts textuels ou d'images. L'API REST suit un modèle de tâche asynchrone : créez une tâche, interrogez son état d'avancement, puis téléchargez le résultat. Utilisez-la pour produire des clips cinématographiques, animer des images ou créer des pipelines automatisés de contenu vidéo.

Configuration

pip install requests python-dotenv
export RUNWAY_API_KEY="votre_clé_api_ici"

URL de base : https://api.dev.runwayml.com/v1 Documentation API : https://docs.runwayml.com

Concepts clés

  • Tâche : Un travail de génération vidéo asynchrone. Renvoie immédiatement un task_id.
  • Gen-3 Alpha Turbo : Le modèle Gen-3 le plus rapide — idéal pour les pipelines de production.
  • Image-vers-vidéo (gen3a_turbo) : Anime une image fixe pour créer du mouvement.
  • Texte-vers-vidéo : Génère une vidéo uniquement à partir d'un prompt textuel.
  • Durée : 5 ou 10 secondes.
  • Ratio : 1280:720 (paysage), 720:1280 (portrait), 1104:832, 832:1104, 960:960 (carré).

Instructions

Étape 1 : Configurer le client

import os
import time
import requests

API_KEY = os.environ["RUNWAY_API_KEY"]
BASE_URL = "https://api.dev.runwayml.com/v1"
HEADERS = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json",
    "X-Runway-Version": "2024-11-06"
}

Étape 2 : Génération texte-vers-vidéo

def text_to_video(
    prompt_text: str,
    duration: int = 5,
    ratio: str = "1280:720",
    seed: int = None
) -> str:
    """Soumet une tâche texte-vers-vidéo et renvoie le task_id."""
    payload = {
        "model": "gen3a_turbo",
        "promptText": prompt_text,
        "duration": duration,
        "ratio": ratio
    }
    if seed is not None:
        payload["seed"] = seed

    r = requests.post(f"{BASE_URL}/image_to_video", json=payload, headers=HEADERS)
    r.raise_for_status()
    return r.json()["id"]

task_id = text_to_video(
    prompt_text="Un plan de drone survolant une vallée de montagne brumeuse à l'heure dorée, cinématographique, ralenti",
    duration=5,
    ratio="1280:720"
)
print(f"Tâche soumise : {task_id}")

Étape 3 : Génération image-vers-vidéo

import base64
from pathlib import Path

def image_to_video(
    image_path: str,
    prompt_text: str = "",
    duration: int = 5,
    ratio: str = "1280:720",
    seed: int = None
) -> str:
    """Anime une image en vidéo. image_path peut être un fichier local ou une URL."""

    if image_path.startswith("http"):
        prompt_image = image_path
    else:
        # Encode le fichier local en URI de données
        img_bytes = Path(image_path).read_bytes()
        ext = Path(image_path).suffix.lstrip(".").lower()
        mime = {"jpg": "image/jpeg", "jpeg": "image/jpeg", "png": "image/png", "webp": "image/webp"}.get(ext, "image/png")
        b64 = base64.b64encode(img_bytes).decode()
        prompt_image = f"data:{mime};base64,{b64}"

    payload = {
        "model": "gen3a_turbo",
        "promptImage": prompt_image,
        "promptText": prompt_text,
        "duration": duration,
        "ratio": ratio
    }
    if seed is not None:
        payload["seed"] = seed

    r = requests.post(f"{BASE_URL}/image_to_video", json=payload, headers=HEADERS)
    r.raise_for_status()
    return r.json()["id"]

task_id = image_to_video(
    image_path="product_shot.png",
    prompt_text="Le produit tourne lentement, des particules scintillantes flottent autour, sensation de luxe",
    duration=5,
    ratio="1280:720"
)
print(f"Tâche soumise : {task_id}")

Étape 4 : Interroger l'état de la tâche

def get_task(task_id: str) -> dict:
    r = requests.get(f"{BASE_URL}/tasks/{task_id}", headers=HEADERS)
    r.raise_for_status()
    return r.json()

def wait_for_task(task_id: str, poll_interval: int = 5, timeout: int = 600) -> list[str]:
    """Interroge jusqu'à ce que la tâche se termine ; renvoie la liste des URL des vidéos de sortie."""
    start = time.time()
    while True:
        task = get_task(task_id)
        status = task["status"]
        progress = task.get("progress", 0)
        print(f"[{int(time.time()-start)}s] Statut : {status} ({int(progress*100)}%)")

        if status == "SUCCEEDED":
            return task["output"]  # liste d'URL de vidéos
        elif status in ("FAILED", "CANCELLED"):
            raise RuntimeError(f"Tâche {status} : {task.get('failure', '')}")
        elif time.time() - start > timeout:
            raise TimeoutError(f"Tâche pas terminée après {timeout}s")

        time.sleep(poll_interval)

output_urls = wait_for_task(task_id)
print(f"Vidéo(s) prête(s) : {output_urls}")

Étape 5 : Télécharger le résultat

def download_video(url: str, output_path: str = "output.mp4") -> str:
    r = requests.get(url, stream=True)
    r.raise_for_status()
    with open(output_path, "wb") as f:
        for chunk in r.iter_content(chunk_size=8192):
            f.write(chunk)
    size_mb = os.path.getsize(output_path) / 1024 / 1024
    print(f"Enregistré : {output_path} ({size_mb:.1f} Mo)")
    return output_path

download_video(output_urls[0], "mountain_valley.mp4")

Exemple de pipeline complet

def generate_and_download(prompt: str, output_path: str = "output.mp4", **kwargs) -> str:
    """En une seule étape : génère une vidéo à partir de texte et la télécharge."""
    print(f"Génération : {prompt[:80]}...")
    task_id = text_to_video(prompt, **kwargs)
    urls = wait_for_task(task_id)
    return download_video(urls[0], output_path)

# Générer un clip publicitaire pour un produit
generate_and_download(
    prompt="Gros plan d'un smartphone élégant sur un bureau blanc, l'écran s'allume, zoom arrière fluide",
    output_path="product_ad.mp4",
    duration=5,
    ratio="1280:720"
)

Référence des paramètres

ParamètreValeursDescription
modelgen3a_turboUtiliser Gen-3 Alpha Turbo (le plus rapide)
duration5, 10Durée de la vidéo en secondes
ratio1280:720, 720:1280, 1104:832, 832:1104, 960:960Ratio d'aspect de la résolution
seedentierGraine de reproductibilité pour des sorties déterministes
promptTextchaînePrompt textuel décrivant la vidéo souhaitée
promptImageURL ou URI de donnéesImage de départ pour l'image-vers-vidéo

Recommandations

  • Les tâches Runway prennent 30 à 120 secondes selon la durée et la charge.
  • Les URL de sortie expirent après un certain temps — téléchargez les vidéos rapidement après la génération.
  • Rédigez des prompts descriptifs et cinématographiques : incluez le mouvement de la caméra, l'éclairage, l'ambiance.
  • Utilisez seed pour reproduire le même résultat lorsque vous itérez sur des prompts.
  • Pour la génération par lots, mettez les tâches en file d'attente en parallèle mais respectez les limites de débit (vérifiez les codes HTTP 429 et réessayez après la valeur de l'en-tête Retry-After).
  • Stockez les clés API dans des variables d'environnement — ne les codez jamais en dur.
  • Consultez https://docs.runwayml.com pour connaître les derniers noms de modèles et points d'accès, car ils évoluent rapidement.

Individual skills in this repo

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

TerminalSkills/skills

>- Run GitHub Actions locally with act. Use when a user asks to test GitHub Actions workflows locally, debug CI pipelines without pushing, or run workflows offline.

TerminalSkills/skills

>- You are an expert in AG2 (formerly AutoGen), the open-source multi-agent conversation framework. You help developers build systems where multiple AI agents collaborate through structured conversations — with tool use, human-in-the-loop, code execution, group chat orchestration, and nested conversations — for complex tasks like software development, research, and data analysis.

TerminalSkills/skills

>- Generate short-form videos with AI — script writing, text-to-speech narration, stock footage selection, subtitle generation, and video assembly. Use when: creating TikTok/YouTube Shorts/Reels content, automating video production, building content pipelines.

TerminalSkills/skills

>- Animate 3D objects and characters in Blender with Python. Use when the user wants to keyframe properties, create armatures and rigs, set up IK/FK chains, animate shape keys for facial animation, edit F-Curves, use the NLA editor to blend actions, add drivers for expression-based animation, or script any animation workflow in Blender.

TerminalSkills/skills

>- Automate motion capture and tracking workflows in Blender with Python. Use when the user wants to import BVH or FBX mocap data, retarget motion to armatures, track camera or object motion from video, solve camera motion, clean up motion capture data, or script any tracking pipeline in Blender.

TerminalSkills/skills

>- You are an expert in Bolt.new by StackBlitz, the AI-powered full-stack development environment that runs entirely in the browser. You help developers go from idea to deployed app in minutes using natural language prompts — Bolt generates complete applications with frontend, backend, database, and deployment, all running in a WebContainer without local setup.

TerminalSkills/skills

>- Assists with using Bun as an all-in-one JavaScript/TypeScript runtime, package manager, bundler, and test runner. Use when building HTTP servers, managing packages, running tests, or migrating from Node.js. Trigger words: bun, bun serve, bun install, bun test, bun build, javascript runtime, bun runtime.

TerminalSkills/skills

>- Self-host customer support with Chatwoot. Use when a user asks to set up open-source customer support, add live chat without SaaS costs, build a multi-channel inbox, or deploy a free Intercom alternative.

TerminalSkills/skills

>- You are an expert in Chi, the lightweight, idiomatic Go HTTP router built on `net/http`. You help developers build composable HTTP services using Chi's middleware stack, route groups, URL parameters, sub-routers, and context-based request scoping — providing Express-like ergonomics while staying 100% compatible with Go's standard library.

TerminalSkills/skills

When the user wants to edit, review, or improve existing marketing copy. Also use when the user mentions 'edit this copy,' 'review my copy,' 'copy feedback,' 'proofread,' 'polish this,' 'make this better,' or 'copy sweep.' This skill provides a systematic approach to editing marketing copy through multiple focused passes.

TerminalSkills/skills

>- Add live chat and customer support with Crisp. Use when a user asks to add a chat widget, implement live customer support, set up a help desk, create a knowledge base, or add a chatbot to a website.

TerminalSkills/skills

>- Assists with building custom interactive data visualizations using D3.js. Use when creating charts, graphs, maps, force layouts, or hierarchical diagrams that require fine-grained control beyond what charting libraries provide. Trigger words: d3, data visualization, chart, svg, scales, force graph, treemap, choropleth.

TerminalSkills/skills

dbt (data build tool) transforms data in your warehouse using SQL SELECT statements. Learn project setup, models, tests, documentation, incremental materializations, and integration with data warehouses like PostgreSQL, BigQuery, and Snowflake.

TerminalSkills/skills

>- You are an expert in dlt, the open-source Python library for building data pipelines. You help developers load data from any API, file, or database into warehouses and lakes using simple Python decorators — with automatic schema inference, incremental loading, and built-in data contracts. dlt is the "requests library for data pipelines.

TerminalSkills/skills

Data Version Control for ML projects. Track large datasets and models alongside Git, build reproducible ML pipelines, and run experiments with metric comparison. Works with any storage backend including S3, GCS, Azure, and local filesystems.

TerminalSkills/skills

>- You are an expert in E2B, the cloud platform for running AI-generated code in secure sandboxes. You help developers give AI agents the ability to execute code, install packages, read/write files, and run long processes in isolated cloud environments — each sandbox is a lightweight VM that boots in ~150ms with full Linux, filesystem, and networking.

TerminalSkills/skills

>- Transcode, convert, edit, and process audio and video with FFmpeg. Use when a user asks to convert video formats (webm to mp4, mkv to mp4), extract audio from video, compress video files, trim or cut clips, concatenate videos, add subtitles, create thumbnails, apply filters, change resolution or bitrate, re-encode media, create GIFs from video, add watermarks, normalize audio, stream media, or build automated media processing pipelines.

TerminalSkills/skills

>- Create advanced animations with GSAP. Use when building complex timelines, scroll-driven animations, SVG morphing, text animations, or high-performance web animations beyond CSS capabilities.

TerminalSkills/skills

>- Generate deterministic MP4 videos from HTML, CSS, media, and seekable animations using HeyGen's HyperFrames framework. Use when someone asks to "render HTML to video", "make a video with HyperFrames", "create a programmatic video", "turn an animation into MP4", "build a launch/product video from HTML", "render GSAP/Lottie/Three.js to video", or set up an agent-driven video pipeline. Covers init/preview/render/add/lint/inspect commands, data-* timing attributes, animation adapters, and the component catalog.

TerminalSkills/skills

When the user wants to perform load testing, stress testing, or performance testing of APIs and websites using k6. Also use when the user mentions "k6," "load test," "performance test," "stress test," "spike test," "soak test," "thresholds," "virtual users," or "VUs." For browser-based testing, see selenium.

Skills associés