协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
vidu-skills【开发与工程】Generate video and images by calling the official Vidu API with curl. Use when the user wants text-to-image (文生图), text-to-video (文生视频), image-to-video (图生视频), head-tail-image-to-video (首尾帧生视频), reference-to-image (参考生图), reference-to-video (参考生视频), Create References (创建参考资料), or to submit or check Vidu tasks. Requires VIDU_TOKEN and optional VIDU_BA…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: vidu-skills description: Generate video and images by calling the official Vidu API with curl. Use when the user wants text-to-image (文生图), text-to-video (文生视频), image-to-video (图生视频), head-tail-image-to-video (首尾帧生视频), reference-to-image (参考生图), reference-to-video (参考生视频), Create References (创建参考资料), or to submit or check Vidu tasks. Requires VIDU_TOKEN and optional VIDU_BASE_URL. compatibility: Requires ability to run curl (or equivalent HTTP client). Set VIDU_TOKEN in the environment; VIDU_BASE_URL optional (default https://service.vidu.cn). See references/api_reference.md for full API. version: 1.0.4 url: https://www.vidu.cn/ secrets:
Generate AI videos and images with Vidu (生数) via direct API calls — text-to-image, text-to-video, image-to-video, start-end frame, reference-based generation, and material elements, up to 1080p/2K/4K. Use curl with VIDU_TOKEN.
All execution is done by calling the official Vidu API with curl (or any HTTP client). Base URL: $VIDU_BASE_URL (default https://service.vidu.cn for mainland China; https://service.vidu.com for overseas).
Required headers for all requests:
| Header | Value |
|---|---|
| Authorization | Token $VIDU_TOKEN |
| Content-Type | application/json |
| User-Agent | viduclawbot/1.0 (+$VIDU_BASE_URL) |
Main endpoints:
$VIDU_BASE_URL/tools/v1/files/uploads → get put_url, idput_url → get ETag$VIDU_BASE_URL/tools/v1/files/uploads/{id}/finish → get ssupload:?id={id}$VIDU_BASE_URL/vidu/v1/tasks → get task_id (response id)$VIDU_BASE_URL/vidu/v1/tasks/{task_id} → get state, creations[].nomark_uri$VIDU_BASE_URL/vidu/v1/tasks/state?id={task_id} with Accept: text/event-stream — return SSE stream to the user; do not wait for terminal state. Events include state, estimated_time_left, err_code, queue_wait_time (排队预测时间, unit: minutes).$VIDU_BASE_URL/vidu/v1/material/elements/pre-process$VIDU_BASE_URL/vidu/v1/material/elements$VIDU_BASE_URL/vidu/v1/material/elements/personal/vidu/v1/tasks with type: "text2image", input.prompts (text only), settings. Resolution 1080p, 2K, 4K./vidu/v1/tasks with type: "text2video", input.prompts (text only), settings.ssupload:?id=...; then POST /vidu/v1/tasks with type: "img2video", prompts (text + image)./vidu/v1/tasks with type: "headtailimg2video", prompts (text + image1 + image2)./vidu/v1/tasks with type: "reference2image"; Q2 only, do not send transition, duration is 0./vidu/v1/tasks with type: "character2video"; Q3 or Q2, do not send transition./vidu/v1/material/elements/personal./vidu/v1/tasks/{task_id} for result; or GET /vidu/v1/tasks/state?id={task_id} for SSE stream.export VIDU_TOKEN="your-token" (required / 必填)export VIDU_BASE_URL=https://service.vidu.cn (mainland China / 国内, default / 默认) or https://service.vidu.com (overseas / 海外)IMPORTANT: This skill sends user-provided data to Vidu’s servers:
Before using this skill, confirm that sending your content to Vidu is acceptable for your privacy and intellectual property requirements. Data handling follows Vidu’s official policy.
Security recommendations:
Vidu Terms & Privacy:
Vidu media generation is asynchronous: submit a task → get task_id → use task_id to query status/result (GET /vidu/v1/tasks/{task_id} or SSE /vidu/v1/tasks/state?id=) when needed.
type: "material".type: "material", material.id, material.version./vidu/v1/material/elements/pre-process first, then POST /vidu/v1/material/elements. Use pre-process recaption when description is omitted. Response includes element id and version for reference-to-video./vidu/v1/material/elements/personal with pager.page, pager.pagesz, keyword, modalities; returns elements[].id, version.See Supported task list below and references/parameters.md.
When building the POST /vidu/v1/tasks body, ensure the user’s request matches one of the supported task types and constraints below. All parameters are passed in the request body (type, input.prompts, settings). references/parameters.md has the same list for quick lookup.
Model version
model_version: "3.2"model_version: "3.1"| Task Type | type (API) | Input | Model | Duration | Aspect Ratio | Transition | Resolution |
|---|---|---|---|---|---|---|---|
| text-to-image (文生图) | text2image | text only | Q2 | 0 | 4:3, 3:4, 1:1, 9:16, 16:9 | — | 1080p/2K/4K |
| text-to-video (文生视频) | text2video | text only | Q3 | 1–16s | 16:9, 9:16, 1:1, 4:3, 3:4 | pro, speed | 1080p |
| text-to-video (文生视频) | text2video | text only | Q2 | 2–8s | 16:9, 9:16, 1:1, 4:3, 3:4 | — | 1080p |
| image-to-video (图生视频) | img2video | 1 image + text | Q3 | 1–16s | from image | pro, speed | 1080p |
| image-to-video (图生视频) | img2video | 1 image + text | Q2 | 2–8s | from image | pro, speed | 1080p |
| head-tail-image-to-video (首尾帧生视频) | headtailimg2video | 2 images + text | Q3 | 1–16s | — | pro, speed | 1080p |
| head-tail-image-to-video (首尾帧生视频) | headtailimg2video | 2 images + text | Q2 | 2–8s | — | pro, speed | 1080p |
| reference-to-image (参考生图) | reference2image | image + reference + text (required) | Q2 | 0 | 4:3, 3:4, 1:1, 9:16, 16:9 | — | 1080p/2K/4K |
| reference-to-video (参考生视频) | character2video | image + reference + text (required) | Q3 | 1–16s | 16:9, 9:16, 1:1, 4:3, 3:4 | — | 1080p |
| reference-to-video (参考生视频) | character2video | image + reference + text (required) | Q2 | 2–8s | 16:9, 9:16, 1:1, 4:3, 3:4 | — | 1080p |
aspect_ratio in settings.Create a material element for use in character2video or reference2image: upload 1–3 images, name and description; API returns element id and version. Flow: First call POST $VIDU_BASE_URL/vidu/v1/material/elements/pre-process (required even if user provides description; body: components, name, type: "user"). Response includes recaption (style, description). Then call POST $VIDU_BASE_URL/vidu/v1/material/elements with the pre-process response id, same components, and recaption (or user description).
Pre-process: POST $VIDU_BASE_URL/vidu/v1/material/elements/pre-process. See references/api_reference.md §3b.
Create element: POST $VIDU_BASE_URL/vidu/v1/material/elements. Body: id (from pre-process), name, modality: "image", type: "user", components (1–3 items: content = ssupload:?id={id}, src_img = ssupload:?id={id}, content_type: "image"), version: "0", recaption. See references/api_reference.md §3c.
Prerequisite: Each image must be uploaded first (Create upload → PUT to put_url → Finish) to get ssupload:?id={id}; use these in components.
$VIDU_BASE_URL/vidu/v1/material/elements/personalpager.page, pager.pagesz, pager.page_token (optional), keyword (URL-encoded), modalities (e.g. modalities=image).elements[] with id, name, version, etc.; use id and version in reference-to-video or reference-to-image prompts.References are used in reference-to-video and reference-to-image. When submitting POST /vidu/v1/tasks: type: "character2video" or "reference2image"; input.prompts must include (1) text prompt (required); (2) optional image prompt (type: "image"); (3) optional reference prompt (type: "material", name, material: { "id", "version" }). Combine image + reference + text; text required; image + reference at most 7, at least one.
Example body:
{
"input": {
"prompts": [
{ "type": "text", "content": "[@aliya]" },
{
"type": "material",
"name": "aliya",
"material": { "id": "3073530415201165", "version": "1765430214" }
}
],
"editor_mode": "normal",
"enhance": true
},
"type": "character2video",
"settings": {
"duration": 5,
"resolution": "1080p",
"movement_amplitude": "auto",
"aspect_ratio": "16:9",
"sample_count": 1,
"schedule_mode": "normal",
"codec": "h265",
"model_version": "3.1",
"use_trial": false
}
}
Summary: Submit (POST /vidu/v1/tasks → get task_id) → Query (GET /vidu/v1/tasks/{task_id} or SSE /vidu/v1/tasks/state?id=) → Get media from creations[].nomark_uri.
curl -s -X POST "$VIDU_BASE_URL/vidu/v1/tasks" \
-H "Authorization: Token $VIDU_TOKEN" \
-H "Content-Type: application/json" \
-H "User-Agent: viduclawbot/1.0 (+$VIDU_BASE_URL)" \
-d '{
"type": "text2video",
"input": {
"prompts": [{"type": "text", "content": "A cat walks in the snow at sunset"}],
"editor_mode": "normal",
"enhance": true
},
"settings": {
"duration": 5,
"resolution": "1080p",
"aspect_ratio": "16:9",
"model_version": "3.2",
"transition": "pro",
"sample_count": 1,
"schedule_mode": "normal",
"codec": "h265",
"use_trial": false
}
}'
Response contains id (task_id). Use it to query.
curl -s "$VIDU_BASE_URL/vidu/v1/tasks/$TASK_ID" \
-H "Authorization: Token $VIDU_TOKEN" \
-H "User-Agent: viduclawbot/1.0 (+$VIDU_BASE_URL)"
state: success | failed | processing | ...creations[].nomark_uri as the media URL(s).err_code, err_msg to report to the user.curl -N -s "$VIDU_BASE_URL/vidu/v1/tasks/state?id=$TASK_ID" \
-H "Authorization: Token $VIDU_TOKEN" \
-H "Accept: text/event-stream" \
-H "User-Agent: viduclawbot/1.0 (+$VIDU_BASE_URL)"
Return the SSE output directly to the user; do not wait for a terminal state. Warning for Agents: SSE streams continuous events which may produce large output. Ensure you either read a limited number of events or avoid autonomous streaming loops.
Step 1 — Create upload:
curl -s -X POST "$VIDU_BASE_URL/tools/v1/files/uploads" \
-H "Authorization: Token $VIDU_TOKEN" \
-H "Content-Type: application/json" \
-H "User-Agent: viduclawbot/1.0 (+$VIDU_BASE_URL)" \
-d '{"metadata":{"image-width":"1920","image-height":"1080"},"scene":"vidu"}'
From response take id and put_url.
Step 2 — PUT image bytes to put_url:
curl -s -X PUT "$PUT_URL" \
-H "Content-Type: image/jpeg" \
-H "x-amz-meta-image-width: 1920" \
-H "x-amz-meta-image-height: 1080" \
--data-binary @/path/to/image.jpg
Save the ETag from the response (use quotes if the server returns them).
Step 3 — Finish upload:
curl -s -X PUT "$VIDU_BASE_URL/tools/v1/files/uploads/$UPLOAD_ID/finish" \
-H "Authorization: Token $VIDU_TOKEN" \
-H "Content-Type: application/json" \
-H "User-Agent: viduclawbot/1.0 (+$VIDU_BASE_URL)" \
-d "{\"etag\":\"$ETAG\",\"id\":\"$UPLOAD_ID\"}"
Use ssupload:?id=$UPLOAD_ID in task prompts or in element components.
After uploading 1–3 images to get ssupload:?id=...:
Pre-process — POST $VIDU_BASE_URL/vidu/v1/material/elements/pre-process with body components (array: each item has content = ssupload:?id={id}, src_img = ssupload:?id={id}, content_type: "image"), name, type: "user". See api_reference §3b.
Create — POST $VIDU_BASE_URL/vidu/v1/material/elements with body including id (from pre-process response), name, modality: "image", type: "user", components, version: "0", recaption (from pre-process or user). See api_reference §3c.
model_version (Q2/Q3), duration, aspect_ratio, transition (omit for image-to-video aspect_ratio, reference-to-video transition).ssupload:?id=.... For reference-to-video with references, ensure elements exist (create via pre-process + create reference if needed).$VIDU_BASE_URL/vidu/v1/tasks with JSON body (type, input.prompts, settings). Capture id as task_id.$VIDU_BASE_URL/vidu/v1/tasks/{task_id} (or use SSE) until state is success/failed; on success return creations[].nomark_uri; on failure return err_code/err_msg.[@reference_name]; ensure text is always present.id); tell the user the task is in progress and they can query status/result with that task_id (e.g. GET /vidu/v1/tasks/{task_id} or SSE state endpoint).If the environment cannot run curl (or equivalent HTTP client), execution as described above is not possible. Tell the user that this skill requires curl (or an HTTP client) with VIDU_TOKEN and point them to references/api_reference.md for manual API usage.