Communitygithub.com

Runway ML API

Runway ML API를 사용하여 AI 비디오 생성 및 편집을 수행합니다. Gen-3 Alpha Turbo 모델로 텍스트나 이미지에서 비디오를 생성하고, 이미지-투-비디오 및 비디오-투-비디오 작업을 자동화합니다.

Runway ML API란 무엇인가요?

Runway ML API 스킬은 Gen-3 Alpha Turbo 모델을 기반으로 한 비동기 작업 패턴의 REST API를 통해 고품질 비디오를 생성합니다. 텍스트 프롬프트 또는 이미지로부터 비디오를 생성하거나, 정적 이미지를 움직이는 영상으로 변환하는 이미지-투-비디오 기능을 제공합니다. 이 스킬은 비디오 생성 작업을 제출하고, 완료를 폴링하며, 결과를 다운로드하는 전체 파이프라인을 Python 코드 예제와 함께 설명합니다. 개발자는 이를 활용하여 시네마틱 클립 제작, 이미지 애니메이션, 자동화된 비디오 콘텐츠 파이프라인을 구축할 수 있으며, 텍스트-투-비디오, 이미지-투-비디오, 전체 파이프라인 예제 등 다양한 사용 사례를 지원합니다. 또한 파라미터 참조, 가이드라인, 오류 처리 방법을 제공하여 실제 프로덕션 환경에서 안정적으로 사용할 수 있도록 돕습니다.

지원 대상✓Claude Code✓Codex CLI✓Cursor✓Gemini CLI
npx skills add https://github.com/TerminalSkills/skills/tree/HEAD/skills/runway-ml

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Runway ML API은(는) 무엇을 하나요?

개요

Runway의 Gen-3 Alpha Turbo 모델은 텍스트 프롬프트나 이미지로부터 고품질 비디오를 생성합니다. REST API는 비동기 작업 패턴을 따릅니다. 작업 생성 → 완료 폴링 → 결과 다운로드 단계로 구성됩니다. 시네마틱 클립 제작, 이미지 애니메이션, 자동화된 비디오 콘텐츠 파이프라인 구축에 사용하세요.

설정

pip install requests python-dotenv
export RUNWAY_API_KEY="your_api_key_here"

기본 URL: https://api.dev.runwayml.com/v1
API 문서: https://docs.runwayml.com

핵심 개념

  • 작업: 비동기 비디오 생성 작업입니다. 즉시 task_id를 반환합니다.
  • Gen-3 Alpha Turbo: 가장 빠른 Gen-3 모델입니다. 프로덕션 파이프라인에 최적입니다.
  • 이미지-투-비디오 (gen3a_turbo): 정적 이미지에 움직임을 부여합니다.
  • 텍스트-투-비디오: 텍스트 프롬프트만으로 비디오를 생성합니다.
  • 길이: 5초 또는 10초.
  • 비율: 1280:720 (가로), 720:1280 (세로), 1104:832, 832:1104, 960:960 (정사각형).

사용 방법

1단계: 클라이언트 설정

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

2단계: 텍스트-투-비디오 생성

def text_to_video(
    prompt_text: str,
    duration: int = 5,
    ratio: str = "1280:720",
    seed: int = None
) -> str:
    """텍스트-투-비디오 작업을 제출하고 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="황금 시간대 안개 낀 산골짜기 위를 나는 드론 샷, 시네마틱, 슬로우 모션",
    duration=5,
    ratio="1280:720"
)
print(f"작업 제출됨: {task_id}")

3단계: 이미지-투-비디오 생성

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:
    """이미지를 비디오로 애니메이션합니다. image_path는 로컬 파일 또는 URL일 수 있습니다."""

    if image_path.startswith("http"):
        prompt_image = image_path
    else:
        # 로컬 파일을 데이터 URI로 인코딩
        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="제품이 천천히 회전하고, 반짝이는 입자가 주위를 떠다니며, 고급스러운 느낌",
    duration=5,
    ratio="1280:720"
)
print(f"작업 제출됨: {task_id}")

4단계: 작업 상태 폴링

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]:
    """작업이 완료될 때까지 폴링하고 출력 비디오 URL 목록을 반환합니다."""
    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] 상태: {status} ({int(progress*100)}%)")

        if status == "SUCCEEDED":
            return task["output"]  # 비디오 URL 목록
        elif status in ("FAILED", "CANCELLED"):
            raise RuntimeError(f"작업 {status}: {task.get('failure', '')}")
        elif time.time() - start > timeout:
            raise TimeoutError(f"{timeout}초 후에도 작업이 완료되지 않았습니다.")

        time.sleep(poll_interval)

output_urls = wait_for_task(task_id)
print(f"비디오 준비 완료: {output_urls}")

5단계: 결과 다운로드

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"저장됨: {output_path} ({size_mb:.1f} MB)")
    return output_path

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

전체 파이프라인 예제

def generate_and_download(prompt: str, output_path: str = "output.mp4", **kwargs) -> str:
    """한 번에 수행: 텍스트로 비디오를 생성하고 다운로드합니다."""
    print(f"생성 중: {prompt[:80]}...")
    task_id = text_to_video(prompt, **kwargs)
    urls = wait_for_task(task_id)
    return download_video(urls[0], output_path)

# 제품 광고 클립 생성
generate_and_download(
    prompt="흰색 책상 위의 세련된 스마트폰 클로즈업, 화면이 켜지고, 부드러운 카메라 후퇴",
    output_path="product_ad.mp4",
    duration=5,
    ratio="1280:720"
)

파라미터 참조

파라미터값설명
modelgen3a_turboGen-3 Alpha Turbo 사용 (가장 빠름)
duration5, 10비디오 길이 (초)
ratio1280:720, 720:1280, 1104:832, 832:1104, 960:960해상도 종횡비
seed정수결정론적 출력을 위한 재현성 시드
promptText문자열원하는 비디오를 설명하는 텍스트 프롬프트
promptImageURL 또는 데이터 URI이미지-투-비디오의 시작 이미지

가이드라인

  • Runway 작업은 길이와 부하에 따라 30~120초가 소요됩니다.
  • 출력 URL은 일정 시간 후 만료됩니다. 생성 후 즉시 비디오를 다운로드하세요.
  • 프롬프트를 설명적이고 시네마틱하게 작성하세요: 카메라 움직임, 조명, 분위기를 포함하세요.
  • 프롬프트를 반복할 때 동일한 결과를 재현하려면 seed를 사용하세요.
  • 일괄 생성 시 작업을 병렬로 큐에 추가하되, 속도 제한을 준수하세요 (HTTP 429 확인 후 Retry-After 헤더 값에 따라 재시도).
  • API 키는 환경 변수에 저장하고, 하드코딩하지 마세요.
  • 최신 모델 이름과 엔드포인트는 빠르게 변경될 수 있으므로 https://docs.runwayml.com을 확인하세요.

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.

관련 스킬