[video] Direct vendor APIs — Vidu and Alibaba DashScope (Wan)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
The work belongs in praisonaiagents/video/adapters/, where new files vidu.py and dashscope_wan.py are proposed alongside a shared _async_task_poll.py; start by reading the existing video adapters there and how the registry resolves model prefixes. Done means one Vidu route and two DashScope Wan routes (wan2.6-flash and wan2.2-kf2v-flash, which must reject seconds other than 5) pass mocked tests, with DASHSCOPE_API_KEY and VIDU_API_KEY added to .env.example. The issue spans several providers and open design decisions about off-peak job handling, so it needs maintainer scoping first.
索引モデルが issue の本文から書いたものです。
説明
Epic: #5171
Problem statement
The cost picker uses direct vendor APIs to avoid reseller markup:
Vidu Q3 Turbo
- Channel: Vidu direct (off-peak)
- 1080p, includes audio
- Off-peak 48 hour queue vs standard queue ~$0.065/s (picker)
Alibaba Wan (DashScope)
| SKU | Picker behavior |
|---|---|
| Wan 2.6 Flash | Direct pricing vs OpenRouter ~$0.15/s resold |
| Wan 2.2 KF2V Flash | 5s fixed, silent, ~$0.015/s @ 480p |
| Wan 2.7 | Strong water/leaves motion; loose loop seam on people |
PraisonAI TS maps qwen → DASHSCOPE_API_KEY for chat embeddings, not Wan video REST endpoints. No ViduVideoProvider exists.
Vidu API — implementation requirements
Provider id: vidu
Model strings:
VideoAgent(llm="vidu/q3-turbo")
VideoAgent(llm="vidu/q3-turbo-offpeak") # if separate SKU
Tasks:
-
Read Vidu official API docs at implementation time (endpoints for text-to-video / image-to-video).
-
Auth header pattern (likely
Authorization: Bearer <API_KEY>— envVIDU_API_KEY). -
Queue mode parameter for off-peak vs standard — map kwargs:
agent.generate(..., queue="offpeak") # or vendor enum -
Poll until terminal state; download MP4.
-
User-facing SLA text: off-peak may take up to 48 hours (picker); do not block
wait_for_completiondefault 600s — requiremax_wait_timeoverride or async job pattern:Design decision: For off-peak,
generate()returns job id immediately; document that user must poll with longmax_wait_timeor use webhooks if Vidu supports them.
Error codes: map 402/429/quota to clear messages.
Alibaba DashScope Wan — implementation requirements
Provider id: dashscope (preferred prefix for consistency with Qwen)
Model strings (illustrative — pin exact API model ids in PR):
VideoAgent(llm="dashscope/wan2.6-flash")
VideoAgent(llm="dashscope/wan2.2-kf2v-flash")
VideoAgent(llm="dashscope/wan2.7")
Environment:
DASHSCOPE_API_KEY(same as Qwen)
API pattern (typical for DashScope async tasks):
POSTcreate async task withmodel,input,parameters- Poll
GETtask status - Retrieve
output.video_url
Implement against current Alibaba documentation for Wan video (not text generation).
KF2V Flash rules:
- If user passes
seconds != "5", raiseVideoProviderValidationErroror clamp with warning (picker: fixed 5s). - Silent output — no audio track in deliverable.
Resolution mapping:
| Picker | Parameter |
|---|---|
| 480p | resolution="480P" or equivalent |
| 720p / 1080p | map from size or kwargs |
Channel selection (document in matrix #10)
For Wan 2.7 same picker row may list OpenRouter + Alibaba direct:
llm= prefix |
Channel |
|---|---|
dashscope/wan2.7 |
Direct (lower $/s per picker) |
openrouter/... |
Single key multi-model (#03) |
replicate/... |
Flat-run variants (#04) |
Registry must treat these as different providers with different job id namespaces.
ViduVideoProvider / DashScopeWanVideoProvider files
praisonaiagents/video/adapters/vidu.py
praisonaiagents/video/adapters/dashscope_wan.py
Shared utilities:
praisonaiagents/video/adapters/_async_task_poll.py— generic poll loop with backoff if both vendors share pattern
Testing
Vidu mocks:
- off-peak submit returns
status=queued - standard queue faster completion
DashScope mocks:
- KF2V rejects wrong duration
- 2.6 Flash success path
No live keys in CI.
Examples
examples/python/video/video_vidu_q3_turbo_offpeak.pyexamples/python/video/video_dashscope_wan_kf2v.pyexamples/python/video/video_dashscope_wan27.py
Acceptance criteria
- One Vidu + two Alibaba routes working in mocked tests
- Off-peak documented with long-running job guidance
- Env vars in
.env.example - Estimator direct $/s from catalog (#08) differs from OpenRouter same SKU
Dependencies
Requires #02
Related
Epic #01, #03, #04, #08, #10
Appendix: Vidu off-peak job UX
- Return job id immediately; document expected queue latency up to 48h.
- Provide
estimate_queue_wait()in catalog, not in provider. - Desktop (#09) should show 'queued' state without blocking UI thread for 48h.
Appendix: DashScope Wan SKU checklist
- wan2.6-flash — map seconds and resolution from VideoAgent args.
- wan2.2-kf2v-flash — enforce 5s duration.
- wan2.7 — document loop seam caveat from picker measurements.
- wan2.6-flash — map seconds and resolution from VideoAgent args.
- wan2.2-kf2v-flash — enforce 5s duration.
- wan2.7 — document loop seam caveat from picker measurements.
- wan2.6-flash — map seconds and resolution from VideoAgent args.
- wan2.2-kf2v-flash — enforce 5s duration.
- wan2.7 — document loop seam caveat from picker measurements.
- wan2.6-flash — map seconds and resolution from VideoAgent args.
- wan2.2-kf2v-flash — enforce 5s duration.
- wan2.7 — document loop seam caveat from picker measurements.
- wan2.6-flash — map seconds and resolution from VideoAgent args.
- wan2.2-kf2v-flash — enforce 5s duration.
- wan2.7 — document loop seam caveat from picker measurements.
- wan2.6-flash — map seconds and resolution from VideoAgent args.
- wan2.2-kf2v-flash — enforce 5s duration.
- wan2.7 — document loop seam caveat from picker measurements.
- wan2.6-flash — map seconds and resolution from VideoAgent args.
- wan2.2-kf2v-flash — enforce 5s duration.
- wan2.7 — document loop seam caveat from picker measurements.
- wan2.6-flash — map seconds and resolution from VideoAgent args.
- wan2.2-kf2v-flash — enforce 5s duration.
- wan2.7 — document loop seam caveat from picker measurements.
- wan2.6-flash — map seconds and resolution from VideoAgent args.
- wan2.2-kf2v-flash — enforce 5s duration.
- wan2.7 — document loop seam caveat from picker measurements.
- wan2.6-flash — map seconds and resolution from VideoAgent args.
- wan2.2-kf2v-flash — enforce 5s duration.
- wan2.7 — document loop seam caveat from picker measurements.
- wan2.6-flash — map seconds and resolution from VideoAgent args.
- wan2.2-kf2v-flash — enforce 5s duration.
- wan2.7 — document loop seam caveat from picker measurements.
- wan2.6-flash — map seconds and resolution from VideoAgent args.
- wan2.2-kf2v-flash — enforce 5s duration.
- wan2.7 — document loop seam caveat from picker measurements.
- wan2.6-flash — map seconds and resolution from VideoAgent args.
- wan2.2-kf2v-flash — enforce 5s duration.
- wan2.7 — document loop seam caveat from picker measurements.
- wan2.6-flash — map seconds and resolution from VideoAgent args.
- wan2.2-kf2v-flash — enforce 5s duration.
- wan2.7 — document loop seam caveat from picker measurements.
- wan2.6-flash — map seconds and resolution from VideoAgent args.
- wan2.2-kf2v-flash — enforce 5s duration.
- wan2.7 — document loop seam caveat from picker measurements.
Vidu API implementation checklist
- Implement auth header per Vidu docs (API key or signed token — confirm current spec).
- Submit text-to-video and image-to-video endpoints as separate profile entries.
- Poll task id until success; map vendor states to VideoJob status enum.
- Download MP4 from signed URL; SSRF allowlist Vidu CDN hosts only.
- Off-peak queue: document optional
max_wait_time=172800for batch jobs. - Expose
vidu:job id namespace; strip prefix in get_status/download. - Validation: max prompt length, aspect ratio enums per SKU table in issue body.
- Unit tests with httpx mock for submit/poll/download happy path.
- Integration test for timeout when poll exceeds max_wait_time.
- Catalog sync: static pricing row until public price API exists.
- Error mapping: quota exceeded → auth/billing class error.
- Example script under
examples/python/video/vidu_t2v.py(#10).
DashScope Wan API implementation checklist
- Use DashScope Wan video API (KF2V / T2V) per Alibaba documentation.
- KF2V: enforce fixed 5s duration — reject other seconds with validation error.
- Async task id polling pattern similar to Vidu provider.
- Map
dashscope:namespace for job ids. - Region endpoint selection via env
DASHSCOPE_REGIONdefault cn. - API key from
DASHSCOPE_API_KEY; never log. - Handle task failure codes with actionable messages in VideoProviderError.
- Download video URL from task result payload.
- Mock tests for submit, in-progress, success, failed task JSON fixtures.
- Cross-check OpenRouter Wan route vs direct — matrix notes billing difference.
- Wire into registry with model prefix
dashscope/wan-.... - Document in CREDENTIALS.md alongside other Alibaba keys.
Direct vs reseller test matrix
| Test id | Scenario | Fixture | Expected |
|---|---|---|---|
test_direct_wan_01 |
Scenario 1 | mock HTTP | pass |
test_direct_wan_02 |
Scenario 2 | mock HTTP | pass |
test_direct_wan_03 |
Scenario 3 | mock HTTP | pass |
test_direct_wan_04 |
Scenario 4 | mock HTTP | pass |
test_direct_wan_05 |
Scenario 5 | mock HTTP | pass |
test_direct_wan_06 |
Scenario 6 | mock HTTP | pass |
test_direct_wan_07 |
Scenario 7 | mock HTTP | pass |
test_direct_wan_08 |
Scenario 8 | mock HTTP | pass |
test_direct_wan_09 |
Scenario 9 | mock HTTP | pass |
test_direct_wan_10 |
Scenario 10 | mock HTTP | pass |
test_direct_wan_11 |
Scenario 11 | mock HTTP | pass |
test_direct_wan_12 |
Scenario 12 | mock HTTP | pass |
test_direct_wan_13 |
Scenario 13 | mock HTTP | pass |
test_direct_wan_14 |
Scenario 14 | mock HTTP | pass |
test_direct_wan_15 |
Scenario 15 | mock HTTP | pass |
test_direct_wan_16 |
Scenario 16 | mock HTTP | pass |
test_direct_wan_17 |
Scenario 17 | mock HTTP | pass |
test_direct_wan_18 |
Scenario 18 | mock HTTP | pass |
test_direct_wan_19 |
Scenario 19 | mock HTTP | pass |
test_direct_wan_20 |
Scenario 20 | mock HTTP | pass |
test_direct_wan_21 |
Scenario 21 | mock HTTP | pass |
test_direct_wan_22 |
Scenario 22 | mock HTTP | pass |
Additional verification notes
- Document Vidu off-peak max_wait_time recommendation: 172800 seconds optional.
- Map DashScope task failure codes to VideoProviderError messages.
- Test KF2V rejects seconds=8 with actionable validation text.
- Document Vidu off-peak max_wait_time recommendation: 172800 seconds optional.
- Map DashScope task failure codes to VideoProviderError messages.
- 主要言語
- Python
- スター
- 9.3k
- フォーク
- 1.5k
- 平均マージ
- 1日 5時間
- マージ済み PR(30日)
- 520
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
MervinPraison/PraisonAI のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
MervinPraison/PraisonAI#6710 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
claude
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
MervinPraison/PraisonAI#6707 ·
メンテナーはふだん 1 日以内に返信
-
bug claude
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
MervinPraison/PraisonAI#6671 ·
メンテナーはふだん 1 日以内に返信
-
Compaction budget regression fixture remains below budget with accurate tokenization再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
MervinPraison/PraisonAI#5418 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
bug claude documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
MervinPraison/PraisonAI#5341 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
MervinPraison/PraisonAI の issue をすべて見る
似ている issue
-
cognition
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
collabnix/awesome-mcp-lists#433 ·
メンテナーはふだん 4 日以内に返信
-
CrossEntropyFilter raises on zero probabilities and single-class results対応中かも @NopeCharon が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
datajoint/datajoint-python#1703 ·
メンテナーはふだん 6 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Archmonger/ServeStatic#129 ·