ToAPIs
    AccueilToAPIs
    Génération d'imagesGPT Image 2.6, Gemini, FLUX…Génération de vidéosSeedance, Veo, Kling, Sora…Chat et rédactionGPT-5.6, Claude, DeepSeek…Voix et musiqueVoix off, TTS, audio
    Nouvelle sortieSeedance 2.5
    TarifsDocumentation APIMCP
    BlogAlternatives
    Se connecterCommencer gratuitement
    Tous les modèlesTarifsDocumentation APIMCPBlogAlternatives
    Se connecterCommencer gratuitement

    Langue

    1. Accueil
    2. Blog
    3. Tutoriel
    4. Building Precision Image-to-Video Pipelines with Wan 2.6 R2V API
    Retour à tous les articles
    tutorial2026-11-238 min de lecture

    Building Precision Image-to-Video Pipelines with Wan 2.6 R2V API

    A production guide to Wan 2.6 image-to-video and reference-video (R2V) on ToAPIs: documented public IDs wan2.6 and wan2.6-flash, routing rules, exclusive media fields, polling, and dated pricing snapshots.

    ToAPIs Engineering & Evaluation Team
    Wan 2.6Video APITutorialImage-to-VideoR2V
    TL;DR - Points clés
    • There is no documented public model ID wan-2-6-r2v, and no official generation path at /videos/wan2.6-r2v/generation. R2V is a capability of wan2.6 (and, separately, wan2.6-flash) reached by sending metadata.reference_urls. The server then routes to an upstream named wan2.6-r2v or wan2.6-r2v-flash. Keep sending the public catalog string.
    • Submit jobs to POST /v1/videos/generations with a Bearer API key. Persist the task id and poll GET /v1/videos/generations/{id}. Ordinary tasks may also be queried with GET /v1/tasks/{id}. Official examples use https://toapis.com (mainland China: https://toapis.cn).
    • On wan2.6, image_urls (one public image URL, i2v) and metadata.reference_urls (public video URLs, r2v) cannot be combined. aspect_ratio and shot_type apply to text-to-video and reference-video modes, not image-to-video. Duration is 5, 10, or 15 seconds; resolution is 720p or 1080p (default 1080p). Base64 is not accepted.
    • wan2.6-flash is a different public ID. It supports only image-to-video and reference-video; a prompt-only request fails. Audio can be turned off and is billed differently. Do not collapse Flash and non-Flash into one ID, and do not treat Flash as a drop-in for text-to-video.
    • Do not copy draft figures such as $0.018/s, $0.030/s, motion_amplitude, or average latency. A 2026-11-23 official Flash price table lists ¥0.3/s and ¥0.5/s with audio at 720p and 1080p, or ¥0.15/s and ¥0.25/s when silent. Model-guide snapshots the same day listed 12 credits/s for wan2.6 and 6 credits/s for wan2.6-flash. The account catalog is authoritative.

    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 at wan-2-6-flash. A 2026-11-23 check of the official Wan 2.6 generation reference (HTTP 200) lists the public ID wan2.6. The official Flash generation reference (HTTP 200) lists wan2.6-flash. The docs path /videos/wan2.6-r2v/generation returned HTTP 404. The URL /model-guide/wan2-6-r2v returned HTTP 200 with the title “Model Guide Not Found” and is not a live guide. toapis.com/sitemap.xml that day listed wan2-6 and wan2-6-flash only for this family.
    • What “R2V” means here: On wan2.6, sending metadata.reference_urls (public video URLs) selects Reference Video (r2v) mode. The official page says the server then routes to an upstream model named wan2.6-r2v. You still send model: "wan2.6". Image-to-video uses image_urls (one image). Prompt-only requests go to text-to-video. Those three modes are mutually exclusive in practice because image_urls cannot be combined with metadata.reference_urls.
    • Contract: Submit asynchronously to POST /v1/videos/generations, then poll GET /v1/videos/generations/{id} until completed or failed. Ordinary tasks may also be queried with GET /v1/tasks/{id}. Official examples use https://toapis.com (and https://toapis.cn for mainland China). Earlier posts in this series sometimes used https://api.toapis.com. Pick one origin and keep it consistent. This article follows the official examples.
    • Flash is not the same ID: wan2.6-flash supports 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-Flash wan2.6 always includes audio by default.
    • Unverified claims to drop: Draft parameters such as motion_amplitude, draft unit prices such as $0.018 or $0.030 per 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 IDRole in this guideDocumented jobs
    wan2.6Default public IDText-to-video (prompt only), image-to-video (image_urls), reference-video / R2V (metadata.reference_urls)
    wan2.6-flashSeparate Flash public IDImage-to-video and reference-video only; prompt-only requests fail
    wan3.0-videoRelated later Wan ID; see the Wan 3.0 quickstartA 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 providedUpstream 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 onlyText-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.

    Abstract routing diagram: image, video, and prompt inputs enter a hexagonal gateway and exit toward two output families

    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 ratioDescription720p size1080p size
    16:9Landscape (default)1280×7201920×1080
    9:16Portrait720×12801080×1920
    1:1Square960×9601440×1440
    4:3Landscape1088×8321632×1248
    3:4Portrait832×10881248×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):

    bash
    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:

    bash
    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:

    bash
    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

    python
    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 stateCommon categoryRecommended action
    400Unknown model alias, mixed image_urls and metadata.reference_urls, Flash prompt-only request, or aspect_ratio on an i2v callSend wan2.6 or wan2.6-flash, drop one exclusive media family, and use public URLs only
    401Missing or invalid API keyRotate the key in the ToAPIs dashboard and confirm the Authorization: Bearer header
    429Rate or concurrency limitHonor Retry-After when present; back off with jitter; retry only when safe
    5xx or client timeoutTemporary gateway or upstream issueQuery the existing task id before resubmitting
    status: queued or in_progressNot an errorWait and poll again
    status: failedGeneration did not succeedRead error.code and error.message (and error.reason when present). Do not retry an unchanged policy-rejected payload

    WaitTime=min⁡(MaxWait,BaseInterval×2attempt)+Uniform(0,1)\text{WaitTime} = \min(\text{MaxWait}, \text{BaseInterval} \times 2^{\text{attempt}}) + \text{Uniform}(0, 1)WaitTime=min(MaxWait,BaseInterval×2attempt)+Uniform(0,1)


    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:

    Mode720p unit price1080p 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.

    Estimated cost=successful billable seconds×current account rate for that model, resolution, and audio flag\text{Estimated cost} = \text{successful billable seconds} \times \text{current account rate for that model, resolution, and audio flag}Estimated cost=successful billable seconds×current account rate for that model, resolution, and audio flag

    • 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.6 always 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.6 or wan2.6-flash — not draft aliases such as wan-2-6-r2v or wan-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_ratio and shot_type on image-to-video requests.
    • Persist the task id, poll GET /v1/videos/generations/{id}, and read result.data[0].url only after completed.
    • 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).

    Découvrir les modèles cités dans cet article

    AlibabaVIDEO

    wan2.6

    Tarif actuel : 12 credits /second
    Guide du modèleEssayer dans la consoleObtenir une clé d'API
    AlibabaVIDEO

    wan2.6-flash

    Tarif actuel : 6 credits /second
    Guide du modèleEssayer dans la consoleObtenir une clé d'API
    UnknownVIDEO

    wan3.0-video

    Tarif actuel : 26.3 credits /second
    Guide du modèleEssayer dans la consoleObtenir une clé d'API

    Articles associés

    tutorial2026-11-20T10:00:00+08:008 min de lecture

    Alibaba Wan 3.0 Video API: Getting Started with Next-Gen Video Generation

    A production quickstart for wan3.0-video and wan3.0-video-prime on ToAPIs: one All-in-One endpoint, first and last frames versus reference media, file or link references, video editing constraints, and the documented polling path.

    TO
    ToAPIs Engineering & Evaluation Team
    #Wan 3.0
    tutorial2026-11-11T10:00:00+08:007 min de lecture

    Intégration de l'API MiniMax Hailuo 2.3 : générer des mouvements humains complexes en vidéo IA

    Guide développeur de l'API vidéo MiniMax Hailuo 2.3 sur ToAPIs : schémas de prompt pour le mouvement humain, contrat de requête actuel pour les tâches de 6 et 10 secondes en 768P et 1080P, et exemples cURL et Python.

    TO
    ToAPIs Engineering & Evaluation Team
    #MiniMax Hailuo
    tutorial2026-11-23T10:00:00+08:007 min de lecture

    OpenAI Sora 2 API: Endpoints, Authentication Scopes, and Persona Creation

    A production guide to ToAPIs Sora2 endpoints: the documented generation ID sora-2-vvip, character creation and status with sora-2 or sora-2-pro, remix, Bearer authentication, and the absence of a live model-guide price.

    TO
    ToAPIs Engineering & Evaluation Team
    #Sora 2
    ToAPIs
    AccueilToAPIs
    Passerelle d'API d'IA pour l'entreprise. Accédez à GPT-5, Claude, Gemini et plus de 200 modèles via une API unifiée.

    Modèles populaires

    • Seedance 2.5 API
    • Seedance 2.0 API
    • Veo 3.1 Fast API
    • Kling 3.0 Turbo API
    Afficher plusAfficher moins
    • GPT Image 2 API
    • Claude Opus 4.8 API
    • Nano Banana 2 API
    • Seedance 2 Mini API
    • Tous les modèles

    Catégories d'API

    • API image IA
    • API vidéo IA
    • API texte-vers-vidéo
    • API image-vers-vidéo
    Afficher plusAfficher moins
    • API d'édition d'image IA
    • API LLM et raisonnement
    • Tous les outils API →

    Alternatives

    Alternatives
    • Alternative à Kie.ai
    • Alternative à Fal.ai
    • Alternative à OpenRouter
    • Alternative à Replicate
    • Alternative à Wavespeed AI
    • Toutes les comparaisons →

    Guides à la une

    Guides à la une
    • Tarifs de Seedance 2.0 et 2.5
    • Guide de l'API Seedance la moins chère
    • Guide d'intégration de MiniMax H3
    • Clé d'API Seedance 2 gratuite
    • Démarrage rapide de l'API Seedance 2
    • Tous les articles techniques →

    Développeurs et plateforme

    Développeurs et plateforme
    • Documentation API
    • MCP
    • Tarifs
    • Playground de modèles
    • LLMs.txt
    • Contacter le support
    • Annuaire des guides de modèles
    Entité exploitante :
    鯨樞智能科技有限公司
    JINGSHU INTELLIGENT LIMITED
    Siège social :
    ROOM 5042, 5/F, YAU LEE CENTRE, NO.45, HOI YUEN ROAD, KWUN TONG, KOWLOON, HONG KONG
    ConfidentialitéConditionsUsage acceptableSuppression des donnéesConservation des donnéesSous-traitants et régionsFacturation et remboursementsPolitique relative aux cookiesPlan du siteÀ propos

    © 2026 ToAPIs. Tous droits réservés.