Skip to content

feat(video): add Alibaba Wan 2.6 text-to-video - #2643

Merged
steebchen merged 2 commits into
mainfrom
alibaba-wan-t2v-video
Jun 11, 2026
Merged

steebchen merged 2 commits into
mainfrom
alibaba-wan-t2v-video

Conversation

@steebchen

@steebchen steebchen commented Jun 11, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds video generation via Alibaba (DashScope) to the gateway, starting with the text-to-video model wan-2-6-t2v (wan2.6-t2v). This is the first video integration for the existing Alibaba provider; only text-to-video is wired up for now.

What changed

  • packages/models — new wan-2-6-t2v model (output: ["video"], videoGenerations: true) with:
    • Per-second pricing: $0.08/s (720p) and $0.12/s (1080p)
    • Supported sizes 1280x720 / 720x1280 / 1920x1080 / 1080x1920 and durations 2–15s
    • Audio always on (supportsVideoAudio: true, supportsVideoWithoutAudio: false) — DashScope auto-dubs wan2.6 output and exposes no disable toggle
    • Mapping marked test: "skip" so it is excluded from the default e2e suite
  • apps/gateway/src/videos/videos.ts — createAlibabaVideoJob submits an async DashScope task via POST /api/v1/services/aigc/video-generation/video-synthesis with the X-DashScope-Async: enable header and { model, input.prompt, parameters.{size,duration} } body (size converted to DashScope W*H format). Added the dispatcher case and the default base URL.
  • apps/worker/src/services/video-jobs.ts — fetchAlibabaStatus polls GET /api/v1/tasks/{task_id}, maps output.task_status (PENDING/RUNNING/SUCCEEDED/FAILED) to the canonical status and surfaces the direct output.video_url. Alibaba is excluded from the /v1/videos/{id}/content metadata fetch since DashScope returns a direct OSS URL.

Defaults to the international endpoint https://dashscope-intl.aliyuncs.com (matching the existing Alibaba chat default). Uses the existing LLM_ALIBABA_API_KEY credential — no new env/provider setup required.

Testing

  • pnpm format and pnpm build pass
  • pnpm vitest run packages/models/src/providers.spec.ts apps/gateway/src/lib/alibaba-pricing.spec.ts — 153 passed
  • E2E intentionally skipped (real paid video API)

Notes / follow-ups (out of scope)

  • Image-to-video and region selection (the provider already declares Singapore/US/Beijing endpoints) are not wired up yet — text-to-video only, as requested.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added Alibaba (DashScope) as a video-generation provider.
    • New "Wan 2.6 Text-to-Video" model: up to 15s, multiple resolutions, audio support, per-second pricing.
  • Content & Moderation

    • Recognition of Alibaba "green-net" moderation signals (improved content-filter matching).
  • Tests

    • Added a test covering the new moderation signal handling.
  • Integration

    • Worker/status polling and provider status handling updated to include Alibaba.

Add the Alibaba (DashScope) wan2.6-t2v text-to-video model as a first
video-generation integration for the Alibaba provider.

- packages/models: add the wan-2-6-t2v model (video output, per-second
  pricing for 720p/1080p, supported sizes/durations, audio always on)
- gateway: createAlibabaVideoJob submits an async DashScope video task
  (POST /api/v1/services/aigc/video-generation/video-synthesis with the
  X-DashScope-Async header) and base-URL/dispatcher wiring
- worker: fetchAlibabaStatus polls GET /api/v1/tasks/{task_id}, maps
  task_status -> canonical status and surfaces the direct video_url

Defaults to the international DashScope endpoint
(dashscope-intl.aliyuncs.com).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f6daf99b-d81f-49f9-9d95-a776158be6ac

📥 Commits

Reviewing files that changed from the base of the PR and between a0d4809 and 1e9ef19.

📒 Files selected for processing (2)
  • packages/shared/src/content-filter.spec.ts
  • packages/shared/src/content-filter.ts

Walkthrough

Adds Alibaba (DashScope) video-generation support: registers a new video model, implements gateway-side async job creation and routing to Alibaba, and adds worker-side status polling that normalizes task status, progress, result URLs, and errors. Also updates content-filter signals and tests for Alibaba moderation messages.

Changes

Alibaba Video Generation Provider

Layer / File(s) Summary
Model definition for Alibaba video generation
packages/models/src/models/alibaba.ts
Defines wan-2-6-t2v model with video output type, 15s max duration, per-resolution per-second pricing, supported sizes and durations (2–15s), and audio support flags.
Gateway job creation and routing
apps/gateway/src/videos/videos.ts
Adds alibaba base URL mapping, implements createAlibabaVideoJob to build DashScope async payloads (prompt, parameters), POST to video-synthesis endpoint, parse output.task_id, throw 502 on missing task id, and routes createUpstreamVideoJob to this handler.
Worker status polling and metadata handling
apps/worker/src/services/video-jobs.ts
Adds alibaba base URL, isAlibabaVideoProvider, and fetchAlibabaStatus to query DashScope task status, normalize task_status/output into job metadata (status, progress, video URLs, mime, structured errors), integrates into fetchUpstreamStatus, and excludes Alibaba from generic content-metadata fetching.
Content filter signals and tests
packages/shared/src/content-filter.ts, packages/shared/src/content-filter.spec.ts
Adds "Green net check failed" to content-filter signals and a Vitest case asserting detection of Alibaba DashScope “green-net” moderation text.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • smakosh
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'feat(video): add Alibaba Wan 2.6 text-to-video' accurately summarizes the main change—adding support for Alibaba's Wan 2.6 model for text-to-video generation across gateway and worker services.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch alibaba-wan-t2v-video

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a0d4809657

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1197 to +1198
case "alibaba":
return "https://dashscope-intl.aliyuncs.com";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor Alibaba's configured region endpoint

When an Alibaba key is configured for us-virginia or cn-beijing via the existing LLM_ALIBABA_REGION/alibaba_region support, this new video path still submits to the Singapore endpoint. Alibaba documents that the endpoint URL and API key must belong to the same region (cross-region calls fail), so video generation will be broken for users whose chat/image Alibaba setup works in a non-default region. The worker has the same hard-coded default for polling, so the fix needs to resolve the provider's region endpoint consistently for creation and status checks.

Useful? React with 👍 / 👎.

Alibaba/DashScope Wan video moderation rejects prompts with "Green net
check failed for input text". Add that signal to the content-filter
detector so the failed video job is logged as content_filter instead of
upstream_error.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@steebchen
steebchen merged commit b1ad08c into main Jun 11, 2026
15 of 16 checks passed
@steebchen
steebchen deleted the alibaba-wan-t2v-video branch June 11, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant