Automate JiMeng (即梦AI at jimeng.jianying.com), Seedance video generation, and canvas projects in a real browser with Playwright. Use for Douyin QR login, JiMeng image or video generation, canvas project creation/opening/prompting, record-id based status checks, canceling queued video tasks, and downloading completed results.
Resources
8Install
npx skillscat add gxagxagx/jimeng-browser-automation Install via the SkillsCat registry.
JiMeng Browser Automation
Use the bundled Playwright driver for JiMeng.
Default workflow for image:
- Ensure login
generate --tool image— returnsrecordIddownload-record --wait-complete true— waits and downloads
Default workflow for video (async — video can queue for hours):
- Ensure login
generate --tool video— submits and returnsrecordIdimmediately, does not waitrecord-status --record-id <id>— poll untilisComplete=truedownload-record --record-id <id>— download once complete
Always identify tasks by record-id, not by page order.
Daemon
Most commands reuse a background browser daemon. It starts automatically and
shuts itself down after 10 minutes of idle time. No manual management needed.
Commands routed through the daemon:generate, canvas-prompt, canvas-create-project, canvas-open-project,canvas-rename-project, record-status, find-record
record-status and find-record use a dedicated page inside the daemon so
polling never disturbs the generate/canvas page being kept warm.
To opt out: --no-daemon true
To change idle timeout: --daemon-idle-timeout-ms <ms> (default 600000)
Setup
Run from this skill directory:
npm install
npx playwright install chromiumHard rules
- Ensure login before any generate action.
- Use structured flags for structured choices:
--model,--reference-mode,--duration,--aspect,--resolution,--reference-file,--first-frame-file,--last-frame-file. - Keep the prompt focused on content: subject, scene, action, emotion, camera language, style.
- Do not hide option labels such as
9:16,1080P,高清 2K,Seedance 2.0 Fast VIP,Seedance 2.0, or首尾帧inside the prompt unless the user literally wants those words in the output. - Exception: JiMeng mention tokens are part of the content binding, not normal option flags.
- Do not guess unavailable options. Use exact visible Chinese labels or omit the flag.
- Treat the entire
runtime/directory as private local data. Do not commit it.
Natural language to flags
竖屏->--aspect 9:16横屏-> usually--aspect 16:95 秒视频->--duration 5s12 秒视频->--duration 12s高清 2K/超清 4K(image only) ->--resolution 高清 2K/--resolution 超清 4K首尾帧过渡->--reference-mode 首尾帧 --first-frame-file ... --last-frame-file ...
Minimal interface
Use these commands for normal agent work.
1. Ensure login
node scripts/jimeng-browser.js login- Run this first when the session may be stale.
- If login is required, the script saves a popup screenshot and a QR screenshot under
runtime/artifacts/. - Show the QR screenshot to the user and wait for a Douyin scan.
- The persistent browser profile lives under
runtime/jimeng-profile/.
2. Open canvas home
node scripts/jimeng-browser.js open-tool --tool canvas- The real canvas home route is
https://jimeng.jianying.com/ai-tool/assets-canvas. - This page lists recent projects and a
新建项目entry point.
3. Create a canvas project
node scripts/jimeng-browser.js canvas-create-project --json true- JiMeng opens the new project in a separate window.
- The command captures that new window and returns
projectId,projectUrl, andprojectTitle.
4. Open an existing canvas project
node scripts/jimeng-browser.js canvas-open-project --project-name "victor_测试" --json trueOptional:
--project-indexwhen multiple projects share the same visible name--project-id--project-url
Behavior:
- Clicking a recent project also opens a separate window.
- The command captures that new window and returns the resolved project URL.
5. Rename a canvas project
node scripts/jimeng-browser.js canvas-rename-project --project-id 123456 --name "my_project" --json trueBehavior:
- The current canvas page allows renaming by clicking the project name in the top-left header.
- The automation enters the inline title input, replaces the name, and confirms it.
6. Prompt inside a canvas project
node scripts/jimeng-browser.js canvas-prompt --project-id 123456 --kind image --prompt "一只白色柴犬坐在木桌上,白底,简洁插画风。" --json trueOptional:
--kind image|video|auto--model--aspect--resolution(image only:高清 2K,超清 4K)--duration(video only:4sto15s)--reference-mode(video only:全能参考,首尾帧)--reference-file /absolute/path[,/absolute/path2]--first-frame-file /absolute/path--last-frame-file /absolute/path--project-name--project-id--project-url
Behavior:
- The automation first ensures the top-right
对话drawer is open. - It then uses the right-side conversation drawer input instead of the canvas bottom editor.
- The drawer exposes the same
图片生成 / 视频生成tool choices as the normal generate page. - The automation switches the drawer tool first, then reuses the normal image/video option logic.
- The prompt is sent as normal generate content. It is not wrapped with extra
生成一张图片:...or生成一个视频:...prefixes. - The command submits the prompt inside the project and now returns the underlying generation
recordIdwhen JiMeng surfaces it. - Once
recordIdis available, the normalrecord-status,download-record, andcancel-recordcommands can be reused. - The current observed project flow first enters an Agent planning phase before it calls JiMeng generation tools.
- If the project prompt includes JiMeng reference mentions such as
@图片1or@主体1, the automation inserts real mention tags instead of plain text.
7. Generate image
node scripts/jimeng-browser.js generate --tool image --prompt "一只白色柴犬站在雨夜霓虹街头" --json trueRequired:
--prompt
Optional:
--model--aspect--resolution--reference-file /absolute/path.png
Observed image options:
- Models:
图片5.0 Lite,图片4.6,图片 4.5,图片 4.1,图片 4.0,图片 3.1,图片 3.0 - Aspect ratios:
智能,21:9,16:9,3:2,4:3,1:1,3:4,2:3,9:16 - Resolutions:
高清 2K,超清 4K
Behavior:
- Returns
recordIdon success. - Supports text-only and text-plus-reference generation.
--reference-fileaccepts one or more absolute image paths, comma-separated.- One image task can produce up to
4result images. - Image tasks can partially fail. Treat them as finished with partial failure, not as a pure hard failure.
8. Generate video
node scripts/jimeng-browser.js generate --tool video --prompt "让一只小猫坐在窗边,看向窗外的雨夜" --json trueRequired:
--prompt
Optional:
--model--reference-mode--duration--aspect--resolution--reference-file /absolute/path--first-frame-file /absolute/path--last-frame-file /absolute/path--submit-retries--submit-retry-delay-ms--record-id-wait-ms
Observed video options:
- Models observed live on 2026-04-15 in the default
全能参考dropdown:Seedance 2.0 Fast VIP,Seedance 2.0 VIP,Seedance 2.0 Fast,Seedance 2.0 - Supported video models:
Seedance 2.0 Fast VIP,Seedance 2.0 VIP,Seedance 2.0 Fast,Seedance 2.0 - Supported reference modes:
全能参考,首尾帧 - Durations currently seen:
4sto15s - Aspect ratios:
21:9,16:9,4:3,1:1,3:4,9:16 - Resolutions: none (no resolution selector for video)
Behavior:
- Submits the task and returns immediately. Does not wait for generation to finish.
- Usually returns
recordIdon success. Userecord-statusto poll anddownload-recordto fetch the file. - Supports pure text,
全能参考, and首尾帧. - One video task produces
1MP4. - For hot models, inspect
serverAccepted,historyRecordId,serverRet, andserverErrmsg. - JiMeng can accept a task before the history card appears.
serverAccepted=truewith norecordIdis accepted, not a hard failure. - For
Seedance 2.0 Fast VIP,Seedance 2.0 VIP,Seedance 2.0 Fast, andSeedance 2.0, prefer:
--submit-retries 2 --submit-retry-delay-ms 60000 --record-id-wait-ms 1800009. Check task status
node scripts/jimeng-browser.js record-status --record-id <record-id> --json trueUseful fields:
statusisCompleteisFailedisCanceledcanCancelprogressPercentqueuePositionqueueTotaletaTexthistoryRecordIdfailedCountpartialFailureauditFailureTypeauditFailurePhasefailureReason
10. Cancel queued video task
node scripts/jimeng-browser.js cancel-record --record-id <record-id> --json true- Supported for video tasks.
- Uses JiMeng's direct cancel API.
- Works even if the card is no longer visible in the current list.
11. Download result
node scripts/jimeng-browser.js download-record --record-id <record-id> --wait-complete true --json true- Image records download up to
4PNG files. - Video records download
1MP4. - Older records can still be recovered through the history API fallback.
- For partial image records, download every successful image that exists and record the counts in
record-download.json. - For video: poll with
record-statusfirst untilisComplete=true, then calldownload-recordwithout--wait-complete. This avoids blocking the daemon queue for hours. --wait-complete trueis fine for image tasks (fast). For video tasks it blocks the caller for the full generation duration — avoid it unless you have a specific reason.
Video reference-mode rules
Choose models from the reference mode first, not the other way around.
Current supported note from 2026-04-15:
- Keep video work on
全能参考and首尾帧. - Keep model choices on
Seedance 2.0 Fast VIP,Seedance 2.0 VIP,Seedance 2.0 Fast, andSeedance 2.0. 主体参考and older video-model families are removed from supported guidance.
Important:
- JiMeng can silently rewrite incompatible model/mode combinations.
- The automation re-reads the final visible model and mode after selection and stops on mismatch.
Mention rules
Mention tokens are only for modes that bind uploaded materials through the editor.
全能参考: use@图片1,@图片2,@图片3in upload order.首尾帧: do not rely on prompt mention tokens. Use--first-frame-fileand--last-frame-file.
Important:
- Plain text
@图片1is not enough. The automation must select the popup option so JiMeng inserts a real mention tag node. - The same mention insertion logic is also reused inside canvas project prompts when the active project editor supports uploaded-material mentions.
Canvas project rules
- Canvas home is
assets-canvas, not the normal generate route. 新建项目opens a new canvas window at/ai-tool/canvas/<projectId>?enter_from=create_new....- Clicking a recent project opens a new canvas window at
/ai-tool/canvas/<projectId>?enter_from=assets.... - Clicking the project name in the top-left header enters inline rename mode.
- The preferred project generation entry is the top-right
对话drawer. - The drawer exposes
图片生成and视频生成, and the resulting controls match the normal generate page closely enough to reuse the same option-selection logic. - For now, treat project creation requests as prompt-driven:
- image request ->
--kind image - video request ->
--kind video
- image request ->
- After submit, the project commonly enters
意图分析/任务规划before the actual image/video generation step.
Status model
Map JiMeng results into these coarse states:
queued:排队加速中,生成中,造梦中,智能创意中completed:已完成canceled:已取消failed: any task withisFailed=true
Special case:
- Partial image tasks can be both complete and failed:
isComplete=true,isFailed=true,partialFailure=true
Verified failure cases:
- Submit-time reject:
你输入的文字不符合平台规则,请修改后重试 - Post-generation reject:
视频未通过审核,本次不消耗积分 - Peak-hour reject:
因目前处于使用高峰期,暂时无法提交更多任务,请等待其他任务完成后再尝试提交~ - User cancel:
你已取消生成,积分已返还
When to read references
Read references/jimeng-flow.md when you need:
- exact current option labels
- selector/debugging detail
- route and login observations
- canvas project window behavior
- failure and queue API shape
- mention behavior verification
Maintenance only
These commands are useful for debugging site changes, but they are not part of the normal workflow:
node scripts/jimeng-browser.js snapshot --tool image|videonode scripts/jimeng-browser.js open-tool --tool home|image|video|canvasnode scripts/jimeng-browser.js canvas-create-projectnode scripts/jimeng-browser.js canvas-open-project --project-name "未命名项目"node scripts/jimeng-browser.js canvas-prompt --project-id 123456 --prompt "..."node scripts/jimeng-browser.js find-record --record-id <record-id>node scripts/jimeng-browser.js list-records
Bundled files
scripts/jimeng-browser.js: browser driver and command entrypointreferences/jimeng-flow.md: site observations and verified edge casesruntime/tracked-records.jsonl: local append-only task registry