video-ad-generator by creatify-ai/video-ad-generator
npx skills add https://github.com/creatify-ai/video-ad-generator --skill video-ad-generator用于创建高转化率视频广告的完整框架——从创意策略到规模化生产。
在创建任何广告之前,请填写此简报。它强制在生产前进行战略性思考。
CREATIVE BRIEF
==============
Product/Service: _______________
Product URL: _______________
Price Point: _______________
TARGET AUDIENCE
- Demographics: _______________
- Primary pain point: _______________
- Secondary pain points: _______________
- Current solution they use: _______________
- Objections to buying: _______________
PRODUCT POSITIONING
- Core benefit (1 sentence): _______________
- Supporting benefits (3 max): _______________
- Proof points (reviews, stats, awards): _______________
- Unique mechanism (what makes it work): _______________
AD SPECIFICATIONS
- Platform: [ ] Meta [ ] TikTok [ ] YouTube [ ] LinkedIn [ ] Other
- Format: [ ] 9:16 [ ] 16:9 [ ] 1:1 [ ] 4:5
- Length: [ ] 15s [ ] 30s [ ] 60s
- Tone: [ ] Professional [ ] Casual [ ] Urgent [ ] Humorous [ ] Educational
- CTA: _______________
CREATIVE DIRECTION
- Style: [ ] UGC [ ] Avatar [ ] Product Demo [ ] Testimonial [ ] Explainer
- Must include: _______________
- Must avoid: _______________
- Reference ads (URLs): _______________
前 3 秒决定用户是否会观看你的广告。使用这些经过验证的公式:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
用意想不到的内容打破滚动模式。
最适合: TikTok, Instagram Reels, 广泛受众
开启一个观众需要关闭的好奇心循环。
最适合: 教育产品、B2B、需要深思熟虑的购买
自信地陈述最核心的益处。
最适合: 竞争激烈的市场、DTC 产品、有价格优势的产品
将观众置于一个能产生共鸣的场景中。
最适合: 生活方式产品、Z世代/千禧一代受众、TikTok
使用数据或资质来建立即时可信度。
最适合: 健康/美容、B2B、高端产品、持怀疑态度的受众
开场钩子之后,主体部分传递信息。根据你的目标匹配结构:
最适合: 痛点驱动的产品、健康/保健、生产力工具
最适合: 科技产品、SaaS、功能丰富的产品
最适合: 电子商务、订阅产品、竞争激烈的市场
最适合: 美容、健身、家居装修、清洁产品
最适合: 生活方式产品、UGC 风格广告、TikTok/Reels
| 行动号召类型 | 示例 | 最适合 |
|---|---|---|
| 直接型 | "立即购买" / "今天就来获取" | 电子商务、意图明确 |
| 好奇心型 | "看看为什么 [X] 人选择了它" | 考虑阶段 |
| 紧迫感型 | "仅剩 [X] 件,特价中" | 库存有限、促销活动 |
| 风险逆转型 | "免费试用 30 天" | SaaS、订阅、高价位 |
| 社交型 | "加入 [X] 名满意客户" | 社区驱动的产品 |
| 益处型 | "今天就开始 [期望的结果]" | 转型产品 |
| 平台 | 主要格式 | 次要格式 | 最大长度 | 自动播放? |
|---|---|---|---|---|
| TikTok | 9:16 | — | 60秒 (15-30秒最佳) | 是,声音开启 |
| Instagram Reels | 9:16 | — | 90秒 (15-30秒最佳) | 是,默认静音 |
| Instagram Feed | 1:1 或 4:5 | 9:16 | 60秒 (15秒最佳) | 是,默认静音 |
| Facebook Feed | 1:1 或 4:5 | 16:9 | 240秒 (15-30秒最佳) | 是,默认静音 |
| YouTube Shorts | 9:16 | — | 60秒 (30-45秒最佳) | 是,声音开启 |
| YouTube Pre-roll | 16:9 | — | 15秒 或 30秒 (不可跳过: 6-15秒) | 是,声音开启 |
| 16:9 或 1:1 | — | 30秒 (15秒最佳) | 是,默认静音 |
Need maximum reach on mobile? → 9:16
Running YouTube pre-roll? → 16:9
Want to repurpose across Meta + LinkedIn? → 1:1
Instagram Feed placement priority? → 4:5
Creating one asset for everywhere? → 1:1 (safest universal)
跨平台创建广告系列时:
1. Write 5 hook variants for same product
2. Pair each hook with identical body + CTA
3. Generate all 5 as video ads
4. Launch as separate ad sets with identical targeting
5. After 3 days: Kill bottom 2 performers
6. After 7 days: Scale winner, create new hooks inspired by winner
这些异步模式适用于任何视频生成 API,而不仅仅是 Creatify。
import time
import requests
def poll_until_done(status_url, headers, max_wait=600, interval=10):
"""Universal async polling for video generation jobs."""
elapsed = 0
while elapsed < max_wait:
resp = requests.get(status_url, headers=headers)
data = resp.json()
status = data.get("status", "")
if status == "done":
return data
elif status in ("failed", "error"):
raise Exception(f"Job failed: {data.get('failed_reason', 'Unknown')}")
time.sleep(interval)
elapsed += interval
raise TimeoutError(f"Job did not complete within {max_wait}s")
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route("/webhook/video-complete", methods=["POST"])
def handle_video_webhook():
"""Receive webhook when video generation completes."""
payload = request.json
job_id = payload["id"]
status = payload["status"]
if status == "done":
video_url = payload["video_output"]
# Process completed video (download, notify, queue next step)
process_completed_video(job_id, video_url)
elif status == "failed":
handle_failure(job_id, payload.get("failed_reason"))
return jsonify({"received": True}), 200
import time
from collections import deque
class RateLimiter:
"""Token bucket rate limiter for API calls."""
def __init__(self, max_per_minute=30):
self.max_per_minute = max_per_minute
self.timestamps = deque()
def wait_if_needed(self):
now = time.time()
# Remove timestamps older than 60 seconds
while self.timestamps and self.timestamps[0] < now - 60:
self.timestamps.popleft()
if len(self.timestamps) >= self.max_per_minute:
sleep_time = 60 - (now - self.timestamps[0])
time.sleep(max(0, sleep_time))
self.timestamps.append(time.time())
def batch_generate_with_retry(jobs, generate_fn, max_retries=3):
"""Process a batch of generation jobs with retry logic."""
limiter = RateLimiter(max_per_minute=30)
results = []
for job in jobs:
retries = 0
while retries < max_retries:
try:
limiter.wait_if_needed()
result = generate_fn(job)
results.append({"job": job, "result": result, "status": "success"})
break
except Exception as e:
retries += 1
if retries == max_retries:
results.append({"job": job, "error": str(e), "status": "failed"})
else:
time.sleep(2 ** retries) # Exponential backoff
return results
使用 API 规模化自动化第一部分的所有内容。
import requests
CREATIFY_API_ID = "your-api-id"
CREATIFY_API_KEY = "your-api-key"
HEADERS = {
"Content-Type": "application/json",
"X-API-ID": CREATIFY_API_ID,
"X-API-KEY": CREATIFY_API_KEY,
}
BASE_URL = "https://api.creatify.ai/api"
还没有 API 密钥? 没问题 — 在 2 分钟内获取一个:
- 在 creatify.ai 免费注册
- 前往 设置 → API
- 复制你的 API ID 和 API Key — 就这么简单。新账户可获得免费额度开始使用。
将任何产品 URL 转换为完整的视频广告。这是最受欢迎的端点——非常适合电子商务团队。
流程: URL → 抓取 → AI 脚本 → 预览 → 渲染
成本: 每 30 秒视频 5 积分 + 链接 1 积分 + 脚本 1 积分
def create_link(url):
"""Scrape product data from a URL."""
resp = requests.post(f"{BASE_URL}/links/", headers=HEADERS, json={"url": url})
resp.raise_for_status()
return resp.json() # Returns id, title, description, images, etc.
def generate_scripts(title, description, language="en", target_audience="general", video_length=30):
"""Generate AI marketing scripts for the product."""
resp = requests.post(f"{BASE_URL}/ai_scripts/", headers=HEADERS, json={
"title": title,
"description": description,
"language": language,
"target_audience": target_audience,
"video_length": video_length,
})
resp.raise_for_status()
return resp.json()
def create_video_from_link(link_id, script=None, aspect_ratio="9x16", webhook_url=None):
"""Generate a video ad from a scraped link."""
payload = {
"link_id": link_id,
"aspect_ratio": aspect_ratio,
}
if script:
payload["script"] = script
if webhook_url:
payload["webhook_url"] = webhook_url
resp = requests.post(f"{BASE_URL}/link_to_videos/", headers=HEADERS, json=payload)
resp.raise_for_status()
return resp.json()
def check_video_status(video_id):
"""Check status of a video generation job."""
resp = requests.get(f"{BASE_URL}/link_to_videos/{video_id}/", headers=HEADERS)
resp.raise_for_status()
return resp.json()
# Use the poll_until_done helper from Part 1:
result = poll_until_done(
f"{BASE_URL}/link_to_videos/{video_id}/",
HEADERS,
max_wait=600
)
video_url = result["video_output"]
def url_to_video(product_url, aspect_ratio="9x16"):
"""Complete pipeline: product URL → finished video ad."""
# 1. Scrape product page
link = create_link(product_url)
link_id = link["id"]
# 2. Generate AI scripts
scripts = generate_scripts(link["title"], link["description"])
# 3. Create video
video = create_video_from_link(link_id, aspect_ratio=aspect_ratio)
# 4. Wait for completion
result = poll_until_done(
f"{BASE_URL}/link_to_videos/{video['id']}/",
HEADERS,
max_wait=600
)
return result["video_output"]
使用你自己的产品重新创建一个成功的竞争对手广告。提供一个参考视频 + 你的产品链接。
成本: 每个克隆 15 积分
def clone_ad(link_id, video_url, aspect_ratio="9x16", webhook_url=None):
"""Clone a reference ad with your product assets."""
payload = {
"link": link_id,
"video_url": video_url,
"aspect_ratio": aspect_ratio,
}
if webhook_url:
payload["webhook_url"] = webhook_url
resp = requests.post(f"{BASE_URL}/ads_clone/", headers=HEADERS, json=payload)
resp.raise_for_status()
return resp.json()
def check_clone_status(clone_id):
"""Check status of an ad clone job."""
resp = requests.get(f"{BASE_URL}/ads_clone/{clone_id}/", headers=HEADERS)
resp.raise_for_status()
return resp.json()
从 URL 或产品详情生成营销脚本。返回多个脚本变体。
成本: 每次生成 1 积分
def generate_scripts_from_url(url, language="en", target_audience="general", video_length=30):
"""Generate scripts from a product URL (scrapes automatically)."""
link = create_link(url)
return generate_scripts(
title=link["title"],
description=link["description"],
language=language,
target_audience=target_audience,
video_length=video_length,
)
使用预建或自定义模板以确保品牌一致性。
def list_custom_templates():
"""List all available custom templates."""
resp = requests.get(f"{BASE_URL}/custom_templates/", headers=HEADERS)
resp.raise_for_status()
return resp.json()
def create_custom_template_video(template_id, params, webhook_url=None):
"""Generate video from a custom template."""
payload = {"template_id": template_id, **params}
if webhook_url:
payload["webhook_url"] = webhook_url
resp = requests.post(f"{BASE_URL}/custom_template_jobs/", headers=HEADERS, json=payload)
resp.raise_for_status()
return resp.json()
将产品图片转换为展示视频。
成本: 预览图片 1 积分 + 视频生成 3 积分
def create_product_video(product_image_url, webhook_url=None):
"""Create a product showcase video from an image."""
payload = {"product_url": product_image_url}
if webhook_url:
payload["webhook_url"] = webhook_url
# Step 1: Generate preview image
resp = requests.post(
f"{BASE_URL}/product_to_videos/gen_image/",
headers=HEADERS,
json=payload
)
resp.raise_for_status()
record = resp.json()
# Step 2: Poll until image is ready
record_id = record["id"]
result = poll_until_done(
f"{BASE_URL}/product_to_videos/{record_id}/",
HEADERS,
max_wait=300
)
# Step 3: Generate video from preview
video_resp = requests.post(
f"{BASE_URL}/product_to_videos/{record_id}/gen_video/",
headers=HEADERS,
json={"video_prompt": "product showcase", "webhook_url": webhook_url}
)
video_resp.raise_for_status()
return video_resp.json()
从单个输入图片生成符合 IAB 标准的广告横幅图片,支持多种标准尺寸。
成本: 每次生成 2 积分(生成多种尺寸)
def generate_iab_images(image_url, webhook_url=None):
"""Generate IAB-compliant banner images in all standard sizes."""
payload = {"image": image_url}
if webhook_url:
payload["webhook_url"] = webhook_url
resp = requests.post(f"{BASE_URL}/iab_images/", headers=HEADERS, json=payload)
resp.raise_for_status()
return resp.json()
def check_iab_status(iab_id):
"""Check IAB image generation status."""
resp = requests.get(f"{BASE_URL}/iab_images/{iab_id}/", headers=HEADERS)
resp.raise_for_status()
data = resp.json()
# When done, data["output"] contains list of {name, size, url, type}
return data
为整个产品目录生成视频广告。
def batch_url_to_video(product_urls, aspect_ratio="9x16"):
"""Generate video ads for multiple product URLs."""
limiter = RateLimiter(max_per_minute=20)
jobs = []
for url in product_urls:
limiter.wait_if_needed()
try:
link = create_link(url)
video = create_video_from_link(link["id"], aspect_ratio=aspect_ratio)
jobs.append({"url": url, "video_id": video["id"], "status": "processing"})
except Exception as e:
jobs.append({"url": url, "error": str(e), "status": "failed"})
# Poll all jobs
results = []
for job in jobs:
if job["status"] == "failed":
results.append(job)
continue
try:
result = poll_until_done(
f"{BASE_URL}/link_to_videos/{job['video_id']}/",
HEADERS,
max_wait=600
)
results.append({**job, "video_url": result["video_output"], "status": "done"})
except Exception as e:
results.append({**job, "error": str(e), "status": "failed"})
return results
获取一个成功的广告,并为每个产品克隆它。
def clone_across_catalog(reference_video_url, product_urls, aspect_ratio="9x16"):
"""Clone a winning ad for multiple products."""
results = []
for url in product_urls:
try:
link = create_link(url)
clone = clone_ad(link["id"], reference_video_url, aspect_ratio)
result = poll_until_done(
f"{BASE_URL}/ads_clone/{clone['id']}/",
HEADERS,
max_wait=600
)
results.append({"url": url, "video": result["video_output"], "status": "done"})
except Exception as e:
results.append({"url": url, "error": str(e), "status": "failed"})
return results
为跨平台广告系列创建一个广告的所有格式版本。
def multi_format_ad_set(product_url):
"""Generate 9:16, 1:1, and 16:9 versions of an ad."""
link = create_link(product_url)
formats = ["9x16", "1x1", "16x9"]
jobs = {}
for fmt in formats:
video = create_video_from_link(link["id"], aspect_ratio=fmt)
jobs[fmt] = video["id"]
results = {}
for fmt, video_id in jobs.items():
result = poll_until_done(
f"{BASE_URL}/link_to_videos/{video_id}/",
HEADERS,
max_wait=600
)
results[fmt] = result["video_output"]
return results
| 端点 | 积分 | 典型延迟 |
|---|---|---|
| 创建链接(抓取 URL) | 1 | < 60 秒 |
| AI 脚本生成 | 1 | 10-30 秒 |
| URL 转视频 | 每 30 秒视频 5 | ~5 分钟 |
| 广告克隆 | 15 | ~5 分钟 |
| 自定义模板视频 | 每 30 秒 5 | ~3 分钟 |
| 产品转视频(图片) | 1 | ~60 秒 |
| 产品转视频(视频) | 3 | ~3 分钟 |
| IAB 图片 | 2 | ~60 秒 |
| 我想要... | 使用此端点 | 积分 |
|---|---|---|
| 将产品 URL 转换为视频广告 | URL 转视频 | ~7 |
| 重现竞争对手的广告风格 | 广告克隆 | ~16 |
| 生成营销脚本 | AI 脚本 | 1 |
| 使用我自己的视频模板 | 自定义模板 | 5/30秒 |
| 创建产品展示 | 产品转视频 | 4 |
| 生成展示横幅广告 | IAB 图片 | 2 |
| 为整个目录创建广告 | 批量 URL 转视频 | 每个 ~7 |
| 测试 5 种钩子变体 | URL 转视频 x5 | ~35 |
每周安装次数
1
代码仓库
GitHub 星标数
17
首次出现
1 天前
安全审计
安装于
amp1
cline1
opencode1
cursor1
kimi-cli1
codex1
Complete framework for creating high-converting video ads — from creative strategy to production at scale.
Before creating any ad, fill out this brief. It forces strategic thinking before production.
CREATIVE BRIEF
==============
Product/Service: _______________
Product URL: _______________
Price Point: _______________
TARGET AUDIENCE
- Demographics: _______________
- Primary pain point: _______________
- Secondary pain points: _______________
- Current solution they use: _______________
- Objections to buying: _______________
PRODUCT POSITIONING
- Core benefit (1 sentence): _______________
- Supporting benefits (3 max): _______________
- Proof points (reviews, stats, awards): _______________
- Unique mechanism (what makes it work): _______________
AD SPECIFICATIONS
- Platform: [ ] Meta [ ] TikTok [ ] YouTube [ ] LinkedIn [ ] Other
- Format: [ ] 9:16 [ ] 16:9 [ ] 1:1 [ ] 4:5
- Length: [ ] 15s [ ] 30s [ ] 60s
- Tone: [ ] Professional [ ] Casual [ ] Urgent [ ] Humorous [ ] Educational
- CTA: _______________
CREATIVE DIRECTION
- Style: [ ] UGC [ ] Avatar [ ] Product Demo [ ] Testimonial [ ] Explainer
- Must include: _______________
- Must avoid: _______________
- Reference ads (URLs): _______________
The first 3 seconds determine whether someone watches your ad. Use these proven formulas:
Breaks the scroll pattern with something unexpected.
Best for: TikTok, Instagram Reels, broad audiences
Opens a curiosity loop the viewer needs to close.
Best for: Educational products, B2B, considered purchases
Leads with the strongest benefit, stated confidently.
Best for: Competitive markets, DTC products, price-advantaged products
Places the viewer inside a relatable scenario.
Best for: Lifestyle products, Gen Z/Millennial audiences, TikTok
Uses data or credentials to establish instant credibility.
Best for: Health/beauty, B2B, premium products, skeptical audiences
After the hook, the body delivers the message. Match the structure to your goal:
Best for: Pain-point-driven products, health/wellness, productivity tools
Best for: Tech products, SaaS, feature-rich products
Best for: E-commerce, subscription products, competitive markets
Best for: Beauty, fitness, home improvement, cleaning products
Best for: Lifestyle products, UGC-style ads, TikTok/Reels
| CTA Type | Example | Best For |
|---|---|---|
| Direct | "Shop now" / "Get yours today" | E-commerce, clear intent |
| Curiosity | "See why [X] people switched" | Consideration stage |
| Urgency | "Only [X] left at this price" | Limited inventory, promos |
| Risk Reversal | "Try it free for 30 days" | SaaS, subscription, high-price |
| Social | "Join [X] happy customers" | Community-driven products |
| Benefit | "Start [desired outcome] today" | Transformation products |
| Platform | Primary Format | Secondary | Max Length | Autoplay? |
|---|---|---|---|---|
| TikTok | 9:16 | — | 60s (15-30s optimal) | Yes, sound on |
| Instagram Reels | 9:16 | — | 90s (15-30s optimal) | Yes, sound off default |
| Instagram Feed | 1:1 or 4:5 | 9:16 | 60s (15s optimal) | Yes, sound off |
| Facebook Feed | 1:1 or 4:5 | 16:9 | 240s (15-30s optimal) | Yes, sound off |
| YouTube Shorts | 9:16 | — | 60s (30-45s optimal) | Yes, sound on |
| YouTube Pre-roll | 16:9 |
Need maximum reach on mobile? → 9:16
Running YouTube pre-roll? → 16:9
Want to repurpose across Meta + LinkedIn? → 1:1
Instagram Feed placement priority? → 4:5
Creating one asset for everywhere? → 1:1 (safest universal)
When creating a campaign across platforms:
1. Write 5 hook variants for same product
2. Pair each hook with identical body + CTA
3. Generate all 5 as video ads
4. Launch as separate ad sets with identical targeting
5. After 3 days: Kill bottom 2 performers
6. After 7 days: Scale winner, create new hooks inspired by winner
These async patterns work for any video generation API, not just Creatify.
import time
import requests
def poll_until_done(status_url, headers, max_wait=600, interval=10):
"""Universal async polling for video generation jobs."""
elapsed = 0
while elapsed < max_wait:
resp = requests.get(status_url, headers=headers)
data = resp.json()
status = data.get("status", "")
if status == "done":
return data
elif status in ("failed", "error"):
raise Exception(f"Job failed: {data.get('failed_reason', 'Unknown')}")
time.sleep(interval)
elapsed += interval
raise TimeoutError(f"Job did not complete within {max_wait}s")
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route("/webhook/video-complete", methods=["POST"])
def handle_video_webhook():
"""Receive webhook when video generation completes."""
payload = request.json
job_id = payload["id"]
status = payload["status"]
if status == "done":
video_url = payload["video_output"]
# Process completed video (download, notify, queue next step)
process_completed_video(job_id, video_url)
elif status == "failed":
handle_failure(job_id, payload.get("failed_reason"))
return jsonify({"received": True}), 200
import time
from collections import deque
class RateLimiter:
"""Token bucket rate limiter for API calls."""
def __init__(self, max_per_minute=30):
self.max_per_minute = max_per_minute
self.timestamps = deque()
def wait_if_needed(self):
now = time.time()
# Remove timestamps older than 60 seconds
while self.timestamps and self.timestamps[0] < now - 60:
self.timestamps.popleft()
if len(self.timestamps) >= self.max_per_minute:
sleep_time = 60 - (now - self.timestamps[0])
time.sleep(max(0, sleep_time))
self.timestamps.append(time.time())
def batch_generate_with_retry(jobs, generate_fn, max_retries=3):
"""Process a batch of generation jobs with retry logic."""
limiter = RateLimiter(max_per_minute=30)
results = []
for job in jobs:
retries = 0
while retries < max_retries:
try:
limiter.wait_if_needed()
result = generate_fn(job)
results.append({"job": job, "result": result, "status": "success"})
break
except Exception as e:
retries += 1
if retries == max_retries:
results.append({"job": job, "error": str(e), "status": "failed"})
else:
time.sleep(2 ** retries) # Exponential backoff
return results
Automate everything from Part 1 at scale using the API.
import requests
CREATIFY_API_ID = "your-api-id"
CREATIFY_API_KEY = "your-api-key"
HEADERS = {
"Content-Type": "application/json",
"X-API-ID": CREATIFY_API_ID,
"X-API-KEY": CREATIFY_API_KEY,
}
BASE_URL = "https://api.creatify.ai/api"
Don't have an API key yet? No problem — grab one in under 2 minutes:
- Sign up free at creatify.ai
- Go to Settings → API
- Copy your API ID and API Key — that's it. New accounts get free credits to start.
Transform any product URL into a complete video ad. This is the most popular endpoint — ideal for e-commerce teams.
Flow: URL → Scrape → AI Script → Preview → Render
Cost: 5 credits per 30 seconds of video + 1 credit for link + 1 credit for script
def create_link(url):
"""Scrape product data from a URL."""
resp = requests.post(f"{BASE_URL}/links/", headers=HEADERS, json={"url": url})
resp.raise_for_status()
return resp.json() # Returns id, title, description, images, etc.
def generate_scripts(title, description, language="en", target_audience="general", video_length=30):
"""Generate AI marketing scripts for the product."""
resp = requests.post(f"{BASE_URL}/ai_scripts/", headers=HEADERS, json={
"title": title,
"description": description,
"language": language,
"target_audience": target_audience,
"video_length": video_length,
})
resp.raise_for_status()
return resp.json()
def create_video_from_link(link_id, script=None, aspect_ratio="9x16", webhook_url=None):
"""Generate a video ad from a scraped link."""
payload = {
"link_id": link_id,
"aspect_ratio": aspect_ratio,
}
if script:
payload["script"] = script
if webhook_url:
payload["webhook_url"] = webhook_url
resp = requests.post(f"{BASE_URL}/link_to_videos/", headers=HEADERS, json=payload)
resp.raise_for_status()
return resp.json()
def check_video_status(video_id):
"""Check status of a video generation job."""
resp = requests.get(f"{BASE_URL}/link_to_videos/{video_id}/", headers=HEADERS)
resp.raise_for_status()
return resp.json()
# Use the poll_until_done helper from Part 1:
result = poll_until_done(
f"{BASE_URL}/link_to_videos/{video_id}/",
HEADERS,
max_wait=600
)
video_url = result["video_output"]
def url_to_video(product_url, aspect_ratio="9x16"):
"""Complete pipeline: product URL → finished video ad."""
# 1. Scrape product page
link = create_link(product_url)
link_id = link["id"]
# 2. Generate AI scripts
scripts = generate_scripts(link["title"], link["description"])
# 3. Create video
video = create_video_from_link(link_id, aspect_ratio=aspect_ratio)
# 4. Wait for completion
result = poll_until_done(
f"{BASE_URL}/link_to_videos/{video['id']}/",
HEADERS,
max_wait=600
)
return result["video_output"]
Recreate a winning competitor ad using your own product. Provide a reference video + your product link.
Cost: 15 credits per clone
def clone_ad(link_id, video_url, aspect_ratio="9x16", webhook_url=None):
"""Clone a reference ad with your product assets."""
payload = {
"link": link_id,
"video_url": video_url,
"aspect_ratio": aspect_ratio,
}
if webhook_url:
payload["webhook_url"] = webhook_url
resp = requests.post(f"{BASE_URL}/ads_clone/", headers=HEADERS, json=payload)
resp.raise_for_status()
return resp.json()
def check_clone_status(clone_id):
"""Check status of an ad clone job."""
resp = requests.get(f"{BASE_URL}/ads_clone/{clone_id}/", headers=HEADERS)
resp.raise_for_status()
return resp.json()
Generate marketing scripts from a URL or product details. Returns multiple script variants.
Cost: 1 credit per generation
def generate_scripts_from_url(url, language="en", target_audience="general", video_length=30):
"""Generate scripts from a product URL (scrapes automatically)."""
link = create_link(url)
return generate_scripts(
title=link["title"],
description=link["description"],
language=language,
target_audience=target_audience,
video_length=video_length,
)
Use pre-built or custom templates for consistent branding.
def list_custom_templates():
"""List all available custom templates."""
resp = requests.get(f"{BASE_URL}/custom_templates/", headers=HEADERS)
resp.raise_for_status()
return resp.json()
def create_custom_template_video(template_id, params, webhook_url=None):
"""Generate video from a custom template."""
payload = {"template_id": template_id, **params}
if webhook_url:
payload["webhook_url"] = webhook_url
resp = requests.post(f"{BASE_URL}/custom_template_jobs/", headers=HEADERS, json=payload)
resp.raise_for_status()
return resp.json()
Transform product images into showcase videos.
Cost: 1 credit for preview image + 3 credits for video generation
def create_product_video(product_image_url, webhook_url=None):
"""Create a product showcase video from an image."""
payload = {"product_url": product_image_url}
if webhook_url:
payload["webhook_url"] = webhook_url
# Step 1: Generate preview image
resp = requests.post(
f"{BASE_URL}/product_to_videos/gen_image/",
headers=HEADERS,
json=payload
)
resp.raise_for_status()
record = resp.json()
# Step 2: Poll until image is ready
record_id = record["id"]
result = poll_until_done(
f"{BASE_URL}/product_to_videos/{record_id}/",
HEADERS,
max_wait=300
)
# Step 3: Generate video from preview
video_resp = requests.post(
f"{BASE_URL}/product_to_videos/{record_id}/gen_video/",
headers=HEADERS,
json={"video_prompt": "product showcase", "webhook_url": webhook_url}
)
video_resp.raise_for_status()
return video_resp.json()
Generate IAB-compliant ad banner images in multiple standard sizes from a single input image.
Cost: 2 credits per generation (produces multiple sizes)
def generate_iab_images(image_url, webhook_url=None):
"""Generate IAB-compliant banner images in all standard sizes."""
payload = {"image": image_url}
if webhook_url:
payload["webhook_url"] = webhook_url
resp = requests.post(f"{BASE_URL}/iab_images/", headers=HEADERS, json=payload)
resp.raise_for_status()
return resp.json()
def check_iab_status(iab_id):
"""Check IAB image generation status."""
resp = requests.get(f"{BASE_URL}/iab_images/{iab_id}/", headers=HEADERS)
resp.raise_for_status()
data = resp.json()
# When done, data["output"] contains list of {name, size, url, type}
return data
Generate video ads for an entire product catalog.
def batch_url_to_video(product_urls, aspect_ratio="9x16"):
"""Generate video ads for multiple product URLs."""
limiter = RateLimiter(max_per_minute=20)
jobs = []
for url in product_urls:
limiter.wait_if_needed()
try:
link = create_link(url)
video = create_video_from_link(link["id"], aspect_ratio=aspect_ratio)
jobs.append({"url": url, "video_id": video["id"], "status": "processing"})
except Exception as e:
jobs.append({"url": url, "error": str(e), "status": "failed"})
# Poll all jobs
results = []
for job in jobs:
if job["status"] == "failed":
results.append(job)
continue
try:
result = poll_until_done(
f"{BASE_URL}/link_to_videos/{job['video_id']}/",
HEADERS,
max_wait=600
)
results.append({**job, "video_url": result["video_output"], "status": "done"})
except Exception as e:
results.append({**job, "error": str(e), "status": "failed"})
return results
Take one winning ad and clone it for every product.
def clone_across_catalog(reference_video_url, product_urls, aspect_ratio="9x16"):
"""Clone a winning ad for multiple products."""
results = []
for url in product_urls:
try:
link = create_link(url)
clone = clone_ad(link["id"], reference_video_url, aspect_ratio)
result = poll_until_done(
f"{BASE_URL}/ads_clone/{clone['id']}/",
HEADERS,
max_wait=600
)
results.append({"url": url, "video": result["video_output"], "status": "done"})
except Exception as e:
results.append({"url": url, "error": str(e), "status": "failed"})
return results
Create one ad in all formats for cross-platform campaigns.
def multi_format_ad_set(product_url):
"""Generate 9:16, 1:1, and 16:9 versions of an ad."""
link = create_link(product_url)
formats = ["9x16", "1x1", "16x9"]
jobs = {}
for fmt in formats:
video = create_video_from_link(link["id"], aspect_ratio=fmt)
jobs[fmt] = video["id"]
results = {}
for fmt, video_id in jobs.items():
result = poll_until_done(
f"{BASE_URL}/link_to_videos/{video_id}/",
HEADERS,
max_wait=600
)
results[fmt] = result["video_output"]
return results
| Endpoint | Credits | Typical Latency |
|---|---|---|
| Create Link (scrape URL) | 1 | < 60 seconds |
| AI Script Generation | 1 | 10-30 seconds |
| URL to Video | 5 per 30s of video | ~5 minutes |
| Ad Clone | 15 | ~5 minutes |
| Custom Template Video | 5 per 30s | ~3 minutes |
| Product to Video (image) | 1 | ~60 seconds |
| Product to Video (video) | 3 | ~3 minutes |
| IAB Images | 2 | ~60 seconds |
| I want to... | Use this endpoint | Credits |
|---|---|---|
| Turn a product URL into a video ad | URL to Video | ~7 |
| Recreate a competitor's ad style | Ad Clone | ~16 |
| Generate marketing scripts | AI Scripts | 1 |
| Use my own video template | Custom Templates | 5/30s |
| Create a product showcase | Product to Video | 4 |
| Generate display banner ads | IAB Images | 2 |
| Create ads for entire catalog | Batch URL to Video | ~7 each |
| Test 5 hook variants | URL to Video x5 | ~35 |
Weekly Installs
1
Repository
GitHub Stars
17
First Seen
1 day ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
amp1
cline1
opencode1
cursor1
kimi-cli1
codex1
专业文案撰写指南:转化文案写作技巧、框架与SEO优化原则
56,000 周安装
| — |
| 15s or 30s (non-skip: 6-15s) |
| Yes, sound on |
| 16:9 or 1:1 | — | 30s (15s optimal) | Yes, sound off |