VideoToken

Alibaba Wan 3.0 API Integration Guide: Node.js, DashScope Protocol, R2 Delivery & Reference Video Billing

Tutorial · 6 min read · Updated 2026-12-03

Developer integration guide for Alibaba Wan 3.0 (wan3.0-video and wan3.0-video-prime) on VideoToken: TypeScript/Node.js & DashScope native examples, reference-video decimal-second billing, and Cloudflare R2 CDN links.

How does VideoToken deliver Alibaba Wan 3.0 outputs via Cloudflare R2?

VideoToken (video-token.cc) mirrors every completed Alibaba Wan 3.0 (wan3.0-video & wan3.0-video-prime) MP4 onto Cloudflare R2 automatically, returning stable global HTTPS URLs starting at $0.0205/s (480p), $0.0409/s (720p), and $0.0818/s (1080p) as of December 2026 — see /compare/wan-3-api-pricing for full provider comparisons.

Direct upstream URLs from regional providers often expire within 24 hours and throttle overseas egress; R2 CDN mirroring ensures fast, reliable downloads across North America, Europe, and Asia.

  • 480p: $0.0205/s (~$0.10 per 5s clip) — ultra-fast creative exploration.
  • 720p: $0.0409/s (~$0.20 per 5s clip) — production default for vertical social and product video.
  • 1080p: $0.0818/s (~$0.41 per 5s clip) — crisp full-HD broadcast and landing page hero loops.

How do you call Alibaba Wan 3.0 in TypeScript / Node.js?

Use standard Node 20+ fetch with zero heavy SDK dependencies. Swap model to wan3.0-video-prime whenever you need elevated concurrency during campaign launches.

const API_KEY = process.env.VIDEOTOKEN_API_KEY!;
const BASE = "https://video-token.cc";

async function runWan3() {
  const createRes = await fetch(BASE + "/v1/videos", {
    method: "POST",
    headers: {
      Authorization: "Bearer " + API_KEY,
      "Content-Type": "application/json",
      "Idempotency-Key": crypto.randomUUID(),
    },
    body: JSON.stringify({
      model: "wan3.0-video",
      prompt: "120fps macro slow motion of golden tonkotsu broth pouring into a handcrafted ceramic ramen bowl, backlit steam, warm Tokyo counter bokeh.",
      resolution: "720p",
      ratio: "9:16",
      duration: 5,
      generate_audio: true,
    }),
  });
  const created = await createRes.json();
  if (!createRes.ok) throw new Error(JSON.stringify(created));

  for (let i = 0; i < 120; i++) {
    await new Promise((r) => setTimeout(r, 5000));
    const poll = await fetch(BASE + "/v1/videos/" + created.id, {
      headers: { Authorization: "Bearer " + API_KEY },
    }).then((r) => r.json());
    if (poll.status === "completed") return poll; // poll.video_url is a Cloudflare R2 HTTPS link
    if (poll.status === "failed") throw new Error(JSON.stringify(poll));
  }
  throw new Error("Timed out waiting for Wan 3.0 task");
}

How does Alibaba Wan 3.0 bill reference videos and 2–30s / auto (-1) durations?

Alibaba Wan 3.0 supports 2–30 second durations (or duration: -1 for automatic duration, reserving 30s upfront). When calling Wan 3.0 with a reference video, upstream bills on usage.duration (input_video_duration + output_video_duration, combined <= 30s) with exact decimal-second settlement.

VideoToken reserves the estimated duration upfront and settles strictly on verified upstream usage.duration once Cloudflare R2 transfer finishes—if generation or transfer fails, 100% of reserved funds return automatically. Native DashScope callers can also use POST /api/v1/services/aigc/video-generation/video-synthesis (with X-DashScope-Async: enable) and poll GET /api/v1/tasks/{task_id} (PENDING -> RUNNING -> SUCCEEDED / FAILED).

Frequently Asked Questions

How does VideoToken compare to Alibaba Cloud Official, fal.ai, and Replicate for Wan 3.0?

At 720p, VideoToken charges $0.0409/s ($0.20 per 5s clip), compared to ~$0.0909/s on Alibaba Cloud Official and ~$0.10/s on fal.ai and Replicate—saving over 55% with R2 delivery included.

What is the difference between wan3.0-video and wan3.0-video-prime?

wan3.0-video optimizes for the lowest standard per-second price, while wan3.0-video-prime routes onto priority capacity for bursty production workloads.

Related Models

wan3.0-video · wan3.0-video-prime