Repository navigation
Conversation
Adds a DashScope (Alibaba Cloud Bailian) video tool backed by wan3.0-video, so an existing DASHSCOPE_API_KEY unlocks text, image, first/last-frame, and reference-to-video generation with native audio. - Async submit/poll/download against the DashScope-native video-synthesis endpoint; timeouts and failures keep task_id. - Defaults to 720P instead of the API's 1080P default, which bills 2x per second. - Local images/videos/audio are inlined as base64 data URIs, so the selector's fal.ai upload path (and FAL_KEY) is not required. - DASHSCOPE_REGION=intl / DASHSCOPE_BASE_URL select the endpoint, matching the variable names proposed in OpenMontageInc#584. - Cost is reconciled against the output duration DashScope reports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Adds the faster wan3.0-video-prime model alongside wan3.0-video, with per-model pricing. Both cost tables now use the Singapore list price, the most expensive region per the official model pages, so the estimate is a true upper bound; the earlier standard-model rates came from a third-party source and ran ~4% under Singapore. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
calesthio
left a comment
There was a problem hiding this comment.
Thank you for adding direct Wan 3.0 coverage. Both model IDs and the request family are documented, and all 26 focused mocked tests pass. Paid-job recovery and current endpoint setup need correction.
[P1] Resume accepted jobs without a new paid submission. execute always POSTs, accepts no task_id/resume input, and advertises timeout as retryable with max_retries=2. Although failure results sometimes retain task_id, invoking the tool again creates a second paid task while the first may still complete. Persist acceptance, add a query/download-only resume path and disable submission retries; report unknown actual billing as unknown rather than the default zero. Test timeout, lost POST response and download failure without duplicate POSTs.
[P2] Update the default endpoint/setup to the current workspace contract. The current Wan 3.0 reference specifies workspace-ID regional maas.aliyuncs.com URLs, while this adapter defaults to dashscope.aliyuncs.com/dashscope-intl.aliyuncs.com and documents only the existing API key. Implement/document the workspace-specific endpoint, or provide maintained compatibility evidence for the legacy default. Current official guidance also explicitly says not to recreate accepted tasks.
No paid generation was performed.
Save accepted Wan 3.0 job metadata before polling and disable submission retries. Use the configured Model Studio workspace endpoint and keep costs unknown when usage is missing.
|
Thanks for the review. Both points are addressed in 569c3d9 (already on this branch). P1 – accepted jobs are resumable, no re-submission
P2 – workspace endpoint
Local check: |
Summary
Adds
dashscope_video, a DashScope (Alibaba Cloud Bailian / 阿里云百炼) video tool backed by Wan 3.0:wan3.0-videoby default, or the fasterwan3.0-video-prime. Users who already haveDASHSCOPE_API_KEYfordashscope_image/dashscope_tts/dashscope_asrget video generation from the same key. The tool supports text-to-video, image-to-video, first/last-frame, and reference-to-video (images, videos, and audio), with native audio and clips up to 30s.Wan 3.0 currently ranks near the top of the public text-to-video leaderboards (Artificial Analysis #1, LMArena #6). It is also one of the cheaper top-tier options per second, and Chinese prompts and Mandarin dialogue are first-class. The only existing Wan path is the local-GPU
wan_video(Wan 2.x).Design notes
video-synthesisendpoint withX-DashScope-Async: enable, poll/api/v1/tasks/{task_id}, then downloadvideo_urlimmediately because it expires after 24h. Timeouts and failures returntask_idso a job can be recovered.resolutionshould not silently pay double.data:{mime};base64,..., a format the API accepts).image_urlis intentionally not declared ininput_schema:video_selectoruploadsreference_image_pathto fal.ai for any provider that declares it, and that would make this tool requireFAL_KEY. A selector routing test covers this.DASHSCOPE_REGION=intl(alsointernational/singapore) selectsdashscope-intl.aliyuncs.com, andDASHSCOPE_BASE_URLoverrides the endpoint. These are the same variable names and values proposed fordashscope_imagein Fix DashScope intl endpoint and Explainer prop forwarding #584, so the two PRs compose cleanly. This PR does not touchdashscope_image.py.wan3.0-video~$0.052 / $0.104 / $0.208,wan3.0-video-prime$0.068 / $0.14 / $0.28 (480P / 720P / 1080P).duration=-1(model-chosen length) is budgeted at the 30s maximum, then reconciled againstusage.output_video_durationafter the task finishes.wan3.0-video(default) andwan3.0-video-primeshare one request shape; only the price differs, somodelis a plain enum.Changes
tools/video/dashscope_video.py: the new tool, discovered automatically by the registry andvideo_selector.tests/contracts/test_dashscope_video.py: payload construction for every operation, input validation, region routing, cost, and the execute path (success with polling and download, submit error, failed task, timeout, missing key). It also covers selector routing forimage_to_videowith a localreference_image_path.tests/contracts/test_dashscope_tools.py: adds the tool to the shared DashScope contract suite and the discovery test..agents/skills/dashscope/SKILL.md,docs/PROVIDERS.md,.env.example: video API notes, parameters, pricing, troubleshooting, and the optional region variables.Verification
pytest tests: 1930 passed, 12 skipped, 3 xfailed.text_to_video,duration=2,resolution=480P. The task (6178e23b-c6b7-4272-8d50-d50670e6cf9b) succeeded in 82s and produced an 854x480, 30fps H.264 clip with an AAC audio track (2.02s).usage.output_video_duration=2reconciled the reported cost to $0.10.wan3.0-video-prime(taskd041938e-e448-4480-9702-c75de41f29aa) succeeded in 89s with identical output specs. The reported cost was $0.14. A single sample showed no speedup, which is likely queue noise.wan3.0-videoandwan3.0-video-primeexist;wan3.0-t2vandwan3.0-i2vreturnModel not exist. Note that the/compatible-mode/v1/modelslisting does not show video models at all.API reference: https://help.aliyun.com/zh/model-studio/wan3-video-generation-api-reference
Assisted by Claude Code