UnityClaw Video (JiMeng & Doubao)
Generate video with JiMeng or Doubao, validate the downloaded video, and return local results.
Agent Workflow
1. Define one achievable shot
Extract the subject, action over time, setting, composition, camera movement, lighting, style, pacing, target channel, and reference-image role. Keep one short generation focused on one coherent shot.
Write a motion-aware prompt: describe what moves, how the camera moves, and what remains stable. For image-to-video, explicitly describe intended motion while preserving the important composition.
2. Choose a provider
| Need | Provider | Settings |
|---|---|---|
| Simple JiMeng text/image-to-video | jimeng |
Choose 16:9, 9:16, or 1:1 |
| Resolution and duration control | doubao |
Choose resolution, ratio, and duration |
| Landscape video | Either | 16:9 |
| Vertical short-form video | Either | 9:16 |
The CLI infers t2v when no attachment is supplied and i2v when one reference image is supplied. Use only one attachment.
3. Execute and validate
Run scripts/generate.js with --json and an explicit --output-dir. Quote all user-derived values. Video generation can be slow; keep the default 30-minute timeout unless needed otherwise. Do not submit duplicate concurrent requests.
Accept completion only when success is true and every file has an existing local path and positive byte size. Return the local video and state provider, mode, and selected output settings.
Retry only when error.retryable is true. Do not automatically regenerate a technically valid result without user feedback.
Configuration
Set the fixed UNITYCLAW_KEY environment variable. The runtime installation declaration installs @unityclaw/sdk; for manual execution, run npm install @unityclaw/sdk if needed.
Usage
node scripts/generate.js --provider jimeng --prompt "A slow camera push toward a mountain at sunrise" --aspect-ratio 16:9
node scripts/generate.js --provider doubao --prompt "The subject turns toward camera" --attachment ./subject.png --resolution 1080p --ratio 9:16 --duration 5 --json --output-dir ./tasks
Parameters
| Parameter | Short | Required | Default | Description |
|---|---|---|---|---|
--provider |
-P |
No | doubao |
jimeng or doubao |
--prompt |
-p |
Yes | - | Motion-aware prompt |
--attachment |
-a |
No | - | One reference image URL or local file |
--aspect-ratio |
-r |
No | 16:9 |
JiMeng ratio: 16:9, 9:16, or 1:1 |
--resolution |
-R |
No | 1080p |
Doubao: 480p, 720p, or 1080p |
--ratio |
-t |
No | adaptive |
Doubao output ratio |
--duration |
-d |
No | 5 |
Positive integer duration for Doubao |
--output-dir |
- | No | ./tasks |
Task output directory, resolved absolutely |
--timeout |
- | No | 1800000 |
Timeout from 1,000 to 3,600,000 milliseconds |
--retries |
- | No | 1 |
Transient retry count from 0 to 3 |
--json |
- | No | false |
Emit one machine-readable JSON object |
--help |
-h |
No | - | Show help |
Doubao ratios: adaptive, 16:9, 9:16, 1:1, 4:3, 3:4, 21:9.
Output Contract
With --json, success includes task metadata, selected settings, and verified files. Failure includes a stable error code, message, retryability, attempts, and available task information.
Resource Index
- Run
scripts/generate.jsfor JiMeng or Doubao video generation.