Use the Jimeng CLI to generate images or videos [Important concurrency limit]: Jimeng can run at most three queued or generating tasks in parallel!
Default preference order
Always prioritize user requirements; when the user has no requirements, use the following default preference order
Image generation
- Model preference order (model_version): 4.6 > 4.5 > 5.0 > 4.0
- Resolution (resolution_type): 2k
Video generation
- Model preference order (model_version): seedance2.0 > seedance2.0fast
- Resolution (video_resolution): 720p
General (image generation + video generation)
- Ratio preference order: 16:9 > 9:16 > 1:1
Initialization
1. First check status and credits
dreamina user_credit
If the command is not found, install it first:
curl -fsSL https://jimeng.jianying.com/cli | bash
If not logged in, you need to run dreamina login login. This command will launch a local browser to obtain login credentials.
2. View all features
dreamina --help
Image generation
Image generation is relatively fast; generate directly:
dreamina text2image --prompt "你的提示词" --ratio 16:9
After generation is complete, simply download it locally.
Video generation (asynchronous task + progress polling)
Video generation usually takes a long time. After submitting a task, it will return submit_id, and you need to poll at regular intervals to get task progress and queue status.
1. Submit a video generation task
View help for specific subcommands:
dreamina multimodal2video --help
# 或
dreamina text2video --help
After submitting the task, it will return submit_id and the current queue position. Please record submit_id for subsequent polling to query progress.
2. Query task status and poll
Use the following command to query task status at regular intervals:
dreamina query_result --submit_id <submit_id>
This command will return:
- Current task status
- Queue position/queue progress
- If completed, it will return the download URL of the generated result
3. Scheduled polling process
Since video generation takes a long time, you need to poll once per minute:
# 每分钟查询一次状态
while true; do
echo "=== $(date) ==="
dreamina query_result --submit_id <submit_id>
echo
sleep 60
done
After the task is completed, extract the download URL from the returned result, use curl to download it, and specify a semantic filename:
curl -o "output.mp4" "<download_url>"
4. Queue progress and waiting time estimation
Estimate based on the actual consumption speed of the queue:
- Record the time difference and queue position changes for each poll
- Calculatehow many positions the queue advances on average per minute
- Divide the current remaining queue position by the advance speed to getthe estimated number of minutes remaining until the queue ends
- Simply tell the user these two pieces of information
Universal reference
Image generation and video generation support multiple reference inputs
Reference reference images according to the order in which the generation parameter resources are passed in: the way to reference is to write 图1, 图2, 音频1, 视频1 in the prompt, for example
提取图1、图2、图3的相机,把背景换成白色,相机在一个白色桌子上,然后以相机为主体360°缓慢旋转,晰展示相机的正面侧面以及背面。
Generate from a local text prompt file
All image generation and video generation commands support reading the prompt from a local text file: ina multimodal2video --prompt "$(cat prompt.txt)"
## 从本地文本提示词文件生成
所有生图和生视频命令都支持从本地文本文件读取提示词:
```bash
dreamina text2image --prompt "$(cat prompt.txt)" --ratio 16:9
dreamina text2video --prompt "$(cat prompt.txt)"
Local prompt + multi-reference video generation
Command line example:
dreamina multimodal2video --image ./角色A.jpg --image ./角色B.jpg --image ./场景1.jpg --prompt "角色A参考图1,角色B参考图2,场景1参考图3。 $(cat prompt.txt)"
Commonly used subcommands (prefer using these)
dreamina text2image: Generate an image based on the promptdreamina image2image: Generate an image from multiple reference imagesdreamina text2video: Text-to-videodreamina multimodal2video: All-purpose reference-to-video generation (supports image reference + text prompt)dreamina query_result: Query asynchronous task status (required for video generation)dreamina list_task: List submitted tasks and their statusesdreamina user_credit: Check remaining credits
Download resources
- Use
curlto download and specify a semantic filename:
For example
curl -o "semantic-filename.mp4" "<download_url>"
Error handling
If a generation error occurs, you must tell the user the specific error message and guide the user to resolve the error.