from openai import OpenAIclient = OpenAI()# 基础视频生成response = client.video.generations.create( model="sora-2.0", prompt="""Aerial drone shot of a lighthouse standing on a rocky cliff overlooking the ocean. Waves crash against the rocks below. Golden hour lighting.""", duration=10, resolution="1080p", aspect_ratio="16:9")# 跟踪生成任务video_id = response.idstatus = response.status# 获取结果video = client.videos.get(video_id)print(video.url)
# 视频扩展response = client.video.generations.extend( model="sora-2.0", video_id="existing_video_id", prompt="Continue the scene, now it starts to rain", duration=10)# 视频编辑response = client.video.generations.edit( model="sora-2.0", base_video_id="existing_video_id", prompt="Change the time of day to sunset", mask="specific_region")# 图像转视频response = client.video.generations.create( model="sora-2.0", image=open("image.png", "rb"), prompt="Add subtle motion, wind blowing through the scene", duration=5)
2.5 定价
套餐
价格
额度
Plus
$20/月
1000积分/月
Pro
$200/月
10000积分/月
积分消耗
1080P视频:50积分/秒,720P视频:25积分/秒
三、Runway Gen-3
3.1 Gen系列演进
版本
发布时间
特点
Gen-1
2023年2月
视频风格转换
Gen-2
2023年6月
文字/图像生视频
Gen-3 Alpha
2024年6月
专业电影级质量
Gen-3
2025年2月
增强版
3.2 API调用
import requests# Runway APIheaders = { "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}# 视频生成payload = { "prompt": "Cinematic shot of a vintage sports car driving " "through a desert highway at sunset, dust particles " "floating in the air, lens flare effect", "model": "gen3", "duration": 10, "resolution": "1080p", "fps": 24, "style": "cinematic"}response = requests.post( "https://api.runwayml.com/v1/videos", headers=headers, json=payload)video_id = response.json()["id"]# 查询状态while True: status_response = requests.get( f"https://api.runwayml.com/v1/videos/{video_id}", headers=headers ) status = status_response.json()["status"] if status == "succeeded": print(status_response.json()["url"]) break elif status == "failed": print("Generation failed") break time.sleep(10)
3.3 Python SDK
from runwayml import RunwayMLclient = RunwayML()# 使用SDKjob = client.videos.create( model="gen3", prompt="Aerial view of a futuristic smart city at night, " "autonomous vehicles moving smoothly, " "neon lights reflecting on wet streets")# 获取结果result = client.videos.get(job.id)while not result.done: result = client.videos.get(job.id) time.sleep(5)print(result.output[0])
3.4 高级控制
# 使用控制信号job = client.videos.create( model="gen3", prompt="Close-up of a coffee cup on a wooden table", # 运动笔刷控制 motion_prompt="Slow camera dolly forward", # 摄像机控制 camera={ "type": "dolly", "direction": "forward", "speed": 0.5 }, # 风格预设 style_preset="film-grain")
3.5 定价
套餐
月费
积分
视频时长
Standard
$15
625
25秒
Pro
$35
1500
60秒
Unlimited
$95
无限
无限
四、快手Kling 2.0
4.1 Kling发展
版本
发布时间
能力
Kling 1.0
2023年9月
国内首个商业视频生成
Kling 1.5
2024年5月
质量提升
Kling 2.0
2025年1月
国际化、多模态
4.2 API调用
import kling# 初始化kling.api_key = "your-api-key"# 基础视频生成result = kling.videos.create( model="kling-2.0", prompt={ "text": "Beautiful mountain landscape with cherry blossoms, " "a small stream flows through the scene, " "gentle breeze making petals drift" }, duration=5, aspect_ratio="16:9", resolution="1080p")print(result.data.task_id)# 查询结果status = kling.tasks.get(result.data.task_id)if status.data.status == "completed": print(status.data.videos[0].url)