Building Precision Image-to-Video Pipelines with Wan 2.6 R2V API
Target Model:
wan2.6(optional Flash ID:wan2.6-flash)
Inference Endpoint:https://toapis.com/v1/videos/generations
Related: OpenAI Sora 2 API guide · Alibaba Wan 3.0 video API quickstart · Wan 3.0 Prime vs Wan 2.6 Flash · MiniMax H3 automated R2V pipeline · Wan 2.6 reference · Wan 2.6 Flash reference · wan2.6 model guide · wan2.6-flash model guide
1. TL;DR & Performance Overview
- Catalog first: Planning drafts sometimes treat “Wan 2.6 R2V” as a public model named
wan-2-6-r2v, or they point the whole pipeline atwan-2-6-flash. A 2026-11-23 check of the official Wan 2.6 generation reference (HTTP 200) lists the public IDwan2.6. The official Flash generation reference (HTTP 200) listswan2.6-flash. The docs path/videos/wan2.6-r2v/generationreturned HTTP 404. The URL/model-guide/wan2-6-r2vreturned HTTP 200 with the title “Model Guide Not Found” and is not a live guide.toapis.com/sitemap.xmlthat day listedwan2-6andwan2-6-flashonly for this family. - What “R2V” means here: On
wan2.6, sendingmetadata.reference_urls(public video URLs) selects Reference Video (r2v) mode. The official page says the server then routes to an upstream model namedwan2.6-r2v. You still sendmodel: "wan2.6". Image-to-video usesimage_urls(one image). Prompt-only requests go to text-to-video. Those three modes are mutually exclusive in practice becauseimage_urlscannot be combined withmetadata.reference_urls. - Contract: Submit asynchronously to
POST /v1/videos/generations, then pollGET /v1/videos/generations/{id}untilcompletedorfailed. Ordinary tasks may also be queried withGET /v1/tasks/{id}. Official examples usehttps://toapis.com(andhttps://toapis.cnfor mainland China). Earlier posts in this series sometimes usedhttps://api.toapis.com. Pick one origin and keep it consistent. This article follows the official examples. - Flash is not the same ID:
wan2.6-flashsupports only image-to-video and reference-video. Text-only generation is not supported; a prompt-only request returns an error. Flash can generate silent video (audio: false) at a different documented unit price. Non-Flashwan2.6always includes audio by default. - Unverified claims to drop: Draft parameters such as
motion_amplitude, draft unit prices such as$0.018or$0.030per second, and draft latency or SLA figures are not current ToAPIs documentation. Confirm live rates in your account catalog.
2. Official Wan 2.6 IDs, Routing, and Parameter Rules
Use the public model name in the model field. Do not substitute a draft alias, and do not send the upstream name wan2.6-r2v unless a later official page lists it as a public catalog string — the 2026-11-23 generation reference does not.
| Catalog ID | Role in this guide | Documented jobs |
|---|---|---|
wan2.6 | Default public ID | Text-to-video (prompt only), image-to-video (image_urls), reference-video / R2V (metadata.reference_urls) |
wan2.6-flash | Separate Flash public ID | Image-to-video and reference-video only; prompt-only requests fail |
wan3.0-video | Related later Wan ID; see the Wan 3.0 quickstart | A different All-in-One parameter map (including first/last frames). Do not mix Wan 3.0 fields into a Wan 2.6 payload |
Routing on wan2.6 (and the Flash equivalent) is decided by the media you send:
| Parameters provided | Upstream mode |
|---|---|
metadata.reference_urls (video URLs) | Reference Video (r2v); Flash routes to wan2.6-r2v-flash |
image_urls (one image) | Image-to-Video (i2v) |
prompt only | Text-to-Video (t2v) on wan2.6; error on wan2.6-flash |
Documented request fields for wan2.6 include prompt (required for text-to-video; optional for i2v and r2v, where it describes expected motion or style), image_urls (at most one publicly accessible http:// or https:// image URL; base64 is no longer supported — use the Upload Image API first), aspect_ratio (16:9, 9:16, 1:1, 4:3, 3:4; not supported in image-to-video mode), resolution (720p or 1080p, default 1080p; 480p is not supported), duration (5, 10, or 15, default 5), negative_prompt, seed, prompt_extend (default true), audio (non-Flash models always include audio by default; set true to enable explicitly), shot_type (single or multi, text-to-video and reference-video only), watermark, and metadata.reference_urls (public video URLs; “up to several” reference videos; cannot be combined with image_urls).
The Flash reference is narrower: model is fixed as wan2.6-flash; either image_urls or metadata.reference_urls is required; prompt is optional; resolution, duration, audio (default true; false produces a silent video and is billed differently), watermark, and metadata.reference_urls are documented. Flash does not document aspect_ratio, shot_type, negative_prompt, seed, or prompt_extend on that page.

Figure 1: A documented wan2.6 or wan2.6-flash payload is submitted to POST /v1/videos/generations. image_urls and metadata.reference_urls cannot be combined. Poll the same task id and read result.data[0].url only after status is completed.
The official resolution and aspect-ratio size table for wan2.6 is:
| Aspect ratio | Description | 720p size | 1080p size |
|---|---|---|---|
| 16:9 | Landscape (default) | 1280×720 | 1920×1080 |
| 9:16 | Portrait | 720×1280 | 1080×1920 |
| 1:1 | Square | 960×960 | 1440×1440 |
| 4:3 | Landscape | 1088×832 | 1632×1248 |
| 3:4 | Portrait | 832×1088 | 1248×1632 |
3. Production Implementation: cURL & Python
The snippets follow the official examples on https://toapis.com. Replace the origin with https://toapis.cn if you are calling from mainland China. Confirm id, result.data[0].url, and the envelope against the API reference for your account before you ship.
Step 1: cURL for image-to-video and reference-video
Image-to-video on wan2.6 (do not send aspect_ratio in this mode):
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header "Authorization: Bearer $TOAPIS_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "wan2.6",
"prompt": "The product rotates slowly under studio lighting, camera locked off",
"image_urls": ["https://example.com/product.jpg"],
"resolution": "1080p",
"duration": 5
}'
Reference-video (R2V) on the same public ID. Persist the returned id:
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header "Authorization: Bearer $TOAPIS_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "wan2.6",
"prompt": "The character waves and smiles at the camera",
"metadata": {
"reference_urls": ["https://cdn.example.com/ref-character.mp4"]
},
"shot_type": "single",
"aspect_ratio": "16:9",
"resolution": "1080p",
"duration": 5
}'
A Flash image-to-video preview (silent, lower documented unit price) uses the other public ID:
curl --request POST \
--url https://toapis.com/v1/videos/generations \
--header "Authorization: Bearer $TOAPIS_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"model": "wan2.6-flash",
"prompt": "The person comes alive and smiles at the camera",
"image_urls": ["https://example.com/portrait.jpg"],
"resolution": "720p",
"duration": 5,
"audio": false
}'
Step 2: Python helper and poller
import os
import time
import requests
API_KEY = os.environ["TOAPIS_API_KEY"]
BASE = "https://toapis.com"
ENDPOINT = f"{BASE}/v1/videos/generations"
HEADERS = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json",
}
DOCUMENTED_IDS = {"wan2.6", "wan2.6-flash"}
RESOLUTIONS = {"720p", "1080p"}
DURATIONS = {5, 10, 15}
ASPECTS = {"16:9", "9:16", "1:1", "4:3", "3:4"}
SHOT_TYPES = {"single", "multi"}
def dispatch_wan26(
prompt: str | None = None,
*,
model: str = "wan2.6",
image_urls: list[str] | None = None,
reference_urls: list[str] | None = None,
aspect_ratio: str | None = None,
resolution: str = "1080p",
duration: int = 5,
negative_prompt: str | None = None,
seed: int | None = None,
prompt_extend: bool | None = None,
audio: bool | None = None,
shot_type: str | None = None,
watermark: bool | None = None,
) -> str:
if model not in DOCUMENTED_IDS:
raise ValueError("Send wan2.6 or wan2.6-flash; wan-2-6-r2v is not a documented public ID")
if duration not in DURATIONS:
raise ValueError("duration must be 5, 10, or 15")
if resolution not in RESOLUTIONS:
raise ValueError("resolution must be 720p or 1080p")
if image_urls and reference_urls:
raise ValueError("image_urls cannot be combined with metadata.reference_urls")
if image_urls and len(image_urls) != 1:
raise ValueError("image_urls is documented as supporting only 1 image")
if model == "wan2.6-flash" and not image_urls and not reference_urls:
raise ValueError("wan2.6-flash requires image_urls or metadata.reference_urls")
if model == "wan2.6" and not prompt and not image_urls and not reference_urls:
raise ValueError("wan2.6 needs a prompt, an image, or reference video URLs")
if image_urls and aspect_ratio:
raise ValueError("aspect_ratio is not supported in image-to-video mode on wan2.6")
if aspect_ratio and aspect_ratio not in ASPECTS:
raise ValueError("unsupported aspect_ratio")
if shot_type and shot_type not in SHOT_TYPES:
raise ValueError("shot_type must be single or multi")
if image_urls and shot_type:
raise ValueError("shot_type applies to text-to-video and reference-video modes only")
payload: dict = {
"model": model,
"resolution": resolution,
"duration": duration,
}
if prompt:
payload["prompt"] = prompt
if image_urls:
payload["image_urls"] = image_urls
if reference_urls:
payload["metadata"] = {"reference_urls": reference_urls}
if aspect_ratio:
payload["aspect_ratio"] = aspect_ratio
if negative_prompt:
payload["negative_prompt"] = negative_prompt
if seed is not None:
payload["seed"] = seed
if prompt_extend is not None:
payload["prompt_extend"] = prompt_extend
if audio is not None:
payload["audio"] = audio
if shot_type:
payload["shot_type"] = shot_type
if watermark is not None:
payload["watermark"] = watermark
res = requests.post(ENDPOINT, headers=HEADERS, json=payload, timeout=30)
res.raise_for_status()
data = res.json()
task_id = data.get("id") or data.get("task_id")
if not task_id:
raise RuntimeError(f"Unexpected submission envelope: {data}")
return task_id
def poll_task(task_id: str, deadline_s: int = 900) -> str:
poll_url = f"{BASE}/v1/videos/generations/{task_id}"
interval = 10.0
start = time.time()
time.sleep(5)
while time.time() - start < deadline_s:
poll = requests.get(poll_url, headers=HEADERS, timeout=15)
if poll.status_code == 429:
retry_after = poll.headers.get("Retry-After")
time.sleep(float(retry_after) if retry_after else min(interval * 2, 120))
continue
poll.raise_for_status()
data = poll.json()
status = data.get("status")
if status == "completed":
return data["result"]["data"][0]["url"]
if status == "failed":
raise RuntimeError(f"Generation failed: {data.get('error')}")
time.sleep(interval)
interval = min(interval * 1.5, 30.0)
raise TimeoutError(f"Task {task_id} exceeded {deadline_s}s; check status before retrying")
if __name__ == "__main__":
task_id = dispatch_wan26(
"The character waves and smiles at the camera",
reference_urls=["https://cdn.example.com/ref-character.mp4"],
shot_type="single",
aspect_ratio="16:9",
resolution="1080p",
duration=5,
)
print("Task:", task_id)
print("Video:", poll_task(task_id))
Download the file before expires_at; the video task status reference documents a 30-day retention window. If you leave prompt_extend enabled on wan2.6 (the default), the official page says the system automatically optimizes and enriches the prompt — it does not publish a measured delay.
4. Error Handling & Status Matrix
The categories below are diagnostic starting points, not a guarantee of exact ToAPIs error codes. A successful HTTP query still requires you to read task status. See the error reference for request errors versus status: failed reasons.
| HTTP or task state | Common category | Recommended action |
|---|---|---|
400 | Unknown model alias, mixed image_urls and metadata.reference_urls, Flash prompt-only request, or aspect_ratio on an i2v call | Send wan2.6 or wan2.6-flash, drop one exclusive media family, and use public URLs only |
401 | Missing or invalid API key | Rotate the key in the ToAPIs dashboard and confirm the Authorization: Bearer header |
429 | Rate or concurrency limit | Honor Retry-After when present; back off with jitter; retry only when safe |
5xx or client timeout | Temporary gateway or upstream issue | Query the existing task id before resubmitting |
status: queued or in_progress | Not an error | Wait and poll again |
status: failed | Generation did not succeed | Read error.code and error.message (and error.reason when present). Do not retry an unchanged policy-rejected payload |
5. Pricing & FinOps ROI
The official Wan 2.6 generation reference does not publish a unit-price table. It states that jobs are billed per second, that different resolutions have different prices, and that you should refer to the model marketplace. The official Flash generation reference does publish an “Audio vs Silent Pricing” table, reconfirmed on 2026-11-23:
| Mode | 720p unit price | 1080p unit price |
|---|---|---|
With audio (audio: true) | ¥0.3 / second | ¥0.5 / second |
Silent (audio: false) | ¥0.15 / second | ¥0.25 / second |
A 2026-11-23 fetch of the live model-guide pages showed a pricing reference of 12 credits / second for wan2.6 and 6 credits / second for wan2.6-flash. Both pages state that final billing follows the current account quote and current duration and resolution rules. Treat the credit figures and the Flash yuan table as a snapshot, not a contract for every mode. Do not convert credits to currency yourself, and do not reuse planning-draft dollar rates.
- Prototype on Flash only when the job is image-to-video or reference-video. A text-only brief does not belong on
wan2.6-flash. - Turn audio off on Flash only when you intend a silent output. The official table prices silent jobs lower; non-Flash
wan2.6always includes audio by default and has no matching official yuan table on its generation page. - A display price is not a channel guarantee. Confirm the ID and the live quote in your account catalog before you forecast a batch.
6. Frequently Asked Questions
See the FAQ block in frontmatter. Summary: send wan2.6 or wan2.6-flash, not wan-2-6-r2v; image_urls and metadata.reference_urls cannot be mixed; motion_amplitude is not documented; duration is 5, 10, or 15 seconds; always poll the generations status path and persist the task id.
7. Action Checklist
- Send
wan2.6orwan2.6-flash— not draft aliases such aswan-2-6-r2vorwan-2-6-flash. - Choose one mode: prompt only (
wan2.6), one public image URL, or public reference video URLs — never image plus reference video in the same request. - Upload local media first and pass
http(s)URLs only; do not send base64. - Omit
aspect_ratioandshot_typeon image-to-video requests. - Persist the task
id, pollGET /v1/videos/generations/{id}, and readresult.data[0].urlonly aftercompleted. - Price the job from the live account quote; treat the 2026-11-23 Flash yuan table and credit snapshots as dated references only.
- Download the video before
expires_at(documented 30-day retention).