[video] Direct vendor APIs — Vidu and Alibaba DashScope (Wan)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 14/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 9.3k
- Fork
- 1.5k
- Merge trung bình
- 1 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 520
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MervinPraison/PraisonAI
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
MervinPraison/PraisonAI#6710 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
claude
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
MervinPraison/PraisonAI#6707 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug claude
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
MervinPraison/PraisonAI#6671 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Compaction budget regression fixture remains below budget with accurate tokenizationCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
MervinPraison/PraisonAI#5418 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug claude documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
MervinPraison/PraisonAI#5341 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của MervinPraison/PraisonAI
Issue tương tự
-
cognition
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Suggestion]: Geonode MCP ServerĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
collabnix/awesome-mcp-lists#433 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
CrossEntropyFilter raises on zero probabilities and single-class resultsCó thể đã có người làm @NopeCharon đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
datajoint/datajoint-python#1703 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Archmonger/ServeStatic#129 ·