Automated E-Commerce Video Ad Pipeline: Combining Seedance and MiniMax APIs
A product-image-to-video pipeline is a good fit for ToAPIs when every model call stays inside a documented duration, resolution, and image-input window. This tutorial wires official seedance-2-5, MiniMax-H3, and MiniMax-Hailuo-2.3 IDs around one staged product URL. It does not invent a $1.20-per-ad unit cost, a 15-second Hailuo clip, a Shopify scrape API, or an ElevenLabs field on the video request.
Planning drafts also treated seedance-2, minimax-h3, and gpt-image-2 loosely. The official names to call today are seedance-2-5 (or seedance-2 when you want the 4–15-second Seedance 2 family), MiniMax-H3, and gpt-image-2 for optional image-to-image cleanup. See Precise First-Frame Control in Video APIs for the URL-versus-Base64 contract, and Eliminating Video Generation Timeouts for completion signaling.
1. TL;DR & Performance Overview
- One staged URL, several official IDs. Upload the product still with
POST /v1/uploads/images(or pass a public HTTP(S) URL). Then submit first-frame jobs withimage_with_roleson Seedance and MiniMax-H3, orimage_urlson Hailuo 2.3. - Honor each duration window. 15-second vertical ads are in range for
seedance-2-5(4–30 s) andMiniMax-H3(4–15 s).MiniMax-Hailuo-2.3is 6 or 10 seconds only (1080P→ 6 s). Stitching shorter clips is a client-side step. - Combine families for documented differences, not for unpublished creative rankings: length, resolution,
generate_audio, Hailuo camera directives, and which image field the page requires. - Price from the 2026-12-01 catalog, in credits, with USD only as an estimate at 1 credit ≈ $0.005. Confirm the account catalog before you budget.
2. Official IDs and Why Two Families Appear in One Pipeline
| Official ID | Mode this pipeline uses | Duration | Resolution | Image field | Other documented traits |
|---|---|---|---|---|---|
seedance-2-5 | First-frame I2V | 4–30 s, or -1 | 480p, 720p, 1080p, 4k | image_with_roles role first_frame; use aspect_ratio: "adaptive" | generate_audio defaults to true; public HTTP(S) URLs only |
seedance-2-5-flash | Faster first-frame preview | 4–30 s, or -1 | 480p or 720p only | Same roles; up to 10 images | Lower-cost preview branch; no 1080p / 4k |
MiniMax-H3 | First-frame I2V | 4–15 s | 2K or 768p | image_with_roles role first_frame | First/last-frame mode ignores a specific aspect ratio and uses adaptive |
MiniMax-Hailuo-2.3 | First-frame I2V | 6 or 10 s; 1080P allows 6 only | 768P or 1080P | image_urls (one starting frame) | 15 camera directives such as [Push in]; max 2000-character prompt |
MiniMax-Hailuo-2.3-Fast | First-frame I2V only | Same 6 / 10 s window | 768P or 1080P | image_urls required | No text-to-video; useful as a cheaper variation branch |
MiniMax-H3-Max-Turbo is being deprecated by the model provider and does not support reference media; official docs recommend MiniMax-H3-Lite for new integrations that need a lighter H3-family ID. This pipeline uses MiniMax-H3 itself when you want the 2K first-frame path.
Optional cleanup uses gpt-image-2 on POST /v1/images/generations with reference_images (or compatible image_urls). That is documented image-to-image generation, not a ToAPIs inpainting API. Base64 is not accepted in those fields either.
Third-party steps — pulling product images from Shopify, adding a voice-over with ElevenLabs, or burning captions — stay out of band. They are not ToAPIs request fields.
3. Production Implementation: Stage, Branch, Bounded Wait

Figure 1. Documented pipeline: stage a product URL, optionally clean it up, branch to official Seedance and MiniMax IDs, and stitch only on the client if you need a longer cut.
The following program uploads one product image, optionally runs gpt-image-2, then starts three documented video jobs: a 15-second seedance-2-5 1080p 9:16 clip, an 8-second MiniMax-H3 2K first-frame clip, and a 6-second MiniMax-Hailuo-2.3 1080P clip with a camera directive. Each job is polled with the official 5 / 10 / 600 bound.
import os
import random
import time
import requests
API_KEY = os.environ["TOAPIS_API_KEY"]
BASE_URL = os.environ.get("TOAPIS_BASE_URL", "https://toapis.com") # or https://toapis.cn
def upload_image(path: str) -> str:
with open(path, "rb") as fh:
resp = requests.post(
f"{BASE_URL}/v1/uploads/images",
headers={"Authorization": f"Bearer {API_KEY}"},
files={"file": fh},
timeout=60,
)
resp.raise_for_status()
body = resp.json()
if not body.get("success"):
raise RuntimeError(body)
return body["data"]["url"]
def optional_cleanup(image_url: str, prompt: str) -> str:
"""Documented gpt-image-2 image-to-image. Not an inpainting-mask API."""
resp = requests.post(
f"{BASE_URL}/v1/images/generations",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json={
"model": "gpt-image-2",
"prompt": prompt,
"size": "9:16",
"resolution": "2k",
"reference_images": [image_url],
},
timeout=30,
)
resp.raise_for_status()
task_id = resp.json().get("id") or resp.json().get("task_id")
return poll_task(f"{BASE_URL}/v1/images/generations/{task_id}")["url"]
def submit_video(payload: dict) -> str:
resp = requests.post(
f"{BASE_URL}/v1/videos/generations",
headers={
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
},
json=payload,
timeout=30,
)
resp.raise_for_status()
body = resp.json()
task_id = body.get("id") or body.get("task_id")
if not task_id:
raise RuntimeError(body)
return task_id
def poll_task(url: str, max_wait: int = 600) -> dict:
start = time.time()
interval = 10
time.sleep(5)
while time.time() - start < max_wait:
resp = requests.get(url, headers={"Authorization": f"Bearer {API_KEY}"}, timeout=30)
if resp.status_code == 429:
retry_after = int(resp.headers.get("Retry-After", interval))
time.sleep(retry_after + random.uniform(0, 1))
interval = min(interval * 2, 120)
continue
resp.raise_for_status()
data = resp.json()
status = data.get("status")
if status == "completed":
item = (data.get("result") or {}).get("data") or []
if not item or not item[0].get("url"):
raise RuntimeError(data)
return {"url": item[0]["url"], "expires_at": data.get("expires_at")}
if status == "failed":
err = data.get("error") or {}
raise RuntimeError(err.get("message") or data)
time.sleep(interval + random.uniform(0, 1))
raise TimeoutError(f"still running after {max_wait}s: {url}")
def poll_video(task_id: str) -> dict:
return poll_task(f"{BASE_URL}/v1/videos/generations/{task_id}")
if __name__ == "__main__":
product_url = upload_image("product-hero.jpg")
# Optional: comment this out to use the original still unchanged.
# product_url = optional_cleanup(
# product_url,
# "Keep the product identical. Replace the cluttered background with a clean studio sweep.",
# )
jobs = {
"seedance_15s": submit_video(
{
"model": "seedance-2-5",
"prompt": "The product stands on a clean studio sweep. Slow pedestal up, soft daylight, no new logos.",
"duration": 15,
"resolution": "1080p",
"aspect_ratio": "adaptive",
"generate_audio": True,
"image_with_roles": [{"url": product_url, "role": "first_frame"}],
}
),
"h3_8s": submit_video(
{
"model": "MiniMax-H3",
"prompt": "The same product holds the frame as the camera slowly orbits, consistent identity, studio lighting.",
"duration": 8,
"resolution": "2K",
"image_with_roles": [{"url": product_url, "role": "first_frame"}],
}
),
"hailuo_6s": submit_video(
{
"model": "MiniMax-Hailuo-2.3",
"prompt": "The product turns toward the camera [Push in], then holds [Static shot]",
"image_urls": [product_url],
"duration": 6,
"resolution": "1080P",
}
),
}
for name, task_id in jobs.items():
result = poll_video(task_id)
print(name, result["url"], "expires_at=", result["expires_at"])
A compact cURL submit for the 15-second Seedance branch:
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header "Authorization: Bearer $TOAPIS_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "seedance-2-5",
"prompt": "The product stands on a clean studio sweep. Slow pedestal up, soft daylight, no new logos.",
"duration": 15,
"resolution": "1080p",
"aspect_ratio": "adaptive",
"generate_audio": true,
"image_with_roles": [{"url": "https://files.toapis.com/uploads/example.jpg", "role": "first_frame"}]
}'
If you need a cut longer than a given model's official window, concatenate the downloaded MP4 files with a local tool such as FFmpeg. That step is not a ToAPIs parameter, and it does not change what each generation request is allowed to return.
For push completion instead of a tight poll loop, configure Task Webhooks first and keep the poller as a fallback, as described in the webhook tutorial.
4. Error Handling & Status Matrix
| Situation | Official behavior | Pipeline response |
|---|---|---|
| Base64 or a local path in the generation body | Rejected on Seedance, MiniMax, Wan, and GPT Image 2 pages | Upload first; reuse data.url |
image_urls plus image_with_roles | Ambiguous on Seedance and MiniMax-H3 | Send only the documented preferred field |
Hailuo duration: 15 or 1080P + duration: 10 | Outside the documented 6 / 10 window (1080P is 6 s only) | Use 6 or 10, or pick seedance-2-5 / MiniMax-H3 for 15 s |
| Hailuo Fast without an image | Fast is I2V only | Always pass image_urls |
MiniMax-H3 resolution: "4k" | Not on the H3 page (2K / 768p only) | Use 2K, or switch the 4k branch to seedance-2-5 |
Poll queued / in_progress | Not final | Continue the official 10 s loop |
Poll completed | result.data[0].url | Download before expires_at (30-day official retention) |
Poll failed | error.message | Fail that branch only; do not assume other IDs failed |
400 webhook_not_configured | callback_url sent without a Token | Configure the Token, or omit the field |
5. Pricing & FinOps ROI
Snapshot date: 2026-12-01. Source: the public pricing page (1 credit ≈ $0.005). Unauthenticated GET /api/v1/pricing returned 401. These figures are planning arithmetic, not a quote, and not the draft economics of "$150 per human-edited UGC clip down to $1.20 per AI-generated ad."
| Step | Official ID | Catalog unit (2026-12-01) | Worked example (estimate only) |
|---|---|---|---|
| Optional cleanup | gpt-image-2 | $0.015 per request (about 3 credits) | One still ≈ $0.015 |
| 15 s vertical ad | seedance-2-5 | $2.90 / 1M usage.total_tokens; per-second figures are only budget estimates | Bill the settled usage.total_tokens from the completed task, not a draft $0.030–$0.038 / s baseline |
| 8 s 2K first-frame | MiniMax-H3 | $0.064 / s (about 12.8 credits / s) | 8 × $0.064 ≈ $0.512 (about 102 credits) |
| 6 s 1080P first-frame | MiniMax-Hailuo-2.3 | $0.194 per request (about 38.8 credits) | One clip ≈ $0.194 |
| Cheaper I2V variation | MiniMax-Hailuo-2.3-Fast | $0.136 per request (about 27.2 credits) | One clip ≈ $0.136 |
A bundle of one 15-second Seedance job, one 8-second H3 job, and one 6-second Hailuo job therefore has a known MiniMax subtotal of about $0.706 (about 141 credits) plus whatever seedance-2-5 settles in tokens, plus $0.015 if you run cleanup. Ten variations means ten such bundles (or a subset of branches), not a hidden batch discount on the official pages. Confirm live rates in the Billing Center before you commit a catalog.
6. Frequently Asked Questions
The frontmatter covers 15-second windows, why two families appear, variation pricing, GPT Image 2 cleanup, and async waiting. Two more pipeline notes:
- Audio.
seedance-2-5documentsgenerate_audio(default true). Hailuo and MiniMax-H3 generation pages do not list that same boolean; Hailuo exposes camera directives in the prompt instead. Adding a third-party voice-over is out of band. - Wan as an extra branch.
wan2.6officially accepts 5, 10, or 15 seconds at 720p / 1080p withimage_urls, andwan3.0-videoaccepts 2–30 seconds withimage_with_roles. They are valid first-frame IDs if you already use Wan; this article focuses on the scheduled Seedance + MiniMax pairing. See Wan 2.6 Image-to-Video Pipeline and Alibaba Wan 3 Video API Quickstart.
7. Action Checklist
- Stage the product still with
POST /v1/uploads/imagesor a public HTTP(S) URL. Do not send Base64 in generation requests. - Pick official IDs that match the cut you need:
seedance-2-5for up to 30 s and 1080p/4k,MiniMax-H3for up to 15 s at 2K,MiniMax-Hailuo-2.3for 6 or 10 s. - Use
image_with_roles/first_frameon Seedance and H3, andimage_urlson Hailuo. Set Seedance first-frameaspect_ratiotoadaptive. - Treat Shopify imports, ElevenLabs voice-over, captions, and FFmpeg concatenation as client-side or third-party steps.
- Submit branches asynchronously; wait with Task Webhooks plus the official 5 / 10 / 600 poller.
- Budget from the dated catalog in credits, and confirm the account price list before you multiply by SKU count.
Official sources fetched on 2026-12-01: Seedance 2.5 generation, MiniMax H3 generation, Hailuo 2.3 generation, GPT Image 2 generation, Upload Image, Get Video Task Status, and toapis.com/pricing.