Execute text-to-image generation via the dreamina CLI tool. This skill handles command construction, credit management, task submission, polling, and result retrieval.
This skill does NOT craft prompts. Prompt crafting is handled by jimeng-prompt-text2image. Use that skill first to create the prompt, get user approval, then activate this skill for CLI execution.
Use this skill when:
dreamina CLI commands explicitlyDo NOT use this skill for:
1. CHECK → dreamina user_credit # Always first — check credits
2. SUBMIT → dreamina text2image --prompt="..." --ratio=X:Y --poll=0 # Async → get submit_id
3. POLL → Agent 每 ~5 秒手动调用 query_result --submit_id=<id> 检查 gen_status
4. RETRIEVE → gen_status="success" → 提取结果并报告
提交生成任务后,应由智能体(AI)负责任务状态查询,而非用 while true shell 脚本阻塞终端:
Step 1 — 提交任务(一次 terminal 调用):
dreamina text2image --prompt="..." --ratio=16:9 --poll=0
→ 解析输出中的 submit_id,记录下来。
Step 2 — 智能体周期查询(多次 terminal 调用,每次单独):
每 ~5 秒执行一次: dreamina query_result --submit_id=<submit_id>
根据返回的 gen_status 做分支判断:
| gen_status | 智能体行为 |
|---|---|
| ----------- | ----------- |
"success" | ✅ 提取结果 URL/文件,报告给用户 |
"failed" | ❌ 报告错误信息给用户 |
"querying" | ⏳ 等待 ~5 秒后再次调用 query_result(最长等待:图片 2 分钟,视频 15 分钟) |
| 长时间无变化(图片 >3min,视频 >20min) | ⚠️ 主动报告给用户,询问是否要继续等 |
> 禁止在 terminal 中使用 while true; sleep 5; ... 死循环。应由智能体在多次对话轮次中调用 query_result,每次独立发起 terminal 调用。
# Turn 1
terminal: dreamina text2image --prompt="..." --poll=0
→ parse: submit_id = "abc-123"
→ tell user: "已提交任务,submit_id=abc-123,5秒后检查结果"
# Turn 2 (after ~5s)
terminal: dreamina query_result --submit_id=abc-123
→ gen_status = "querying"
→ tell user: "任务处理中,5秒后再检查"
# Turn 3 (after ~5s)
terminal: dreamina query_result --submit_id=abc-123
→ gen_status = "success"
→ extract result_url, report to user
> 原理: 每次单独调用 terminal 而非 shell 死循环,智能体可以在每次查询结果后做灵活判断(重试、报告进度、超时处理),且不阻塞终端资源。
Before any generation command, verify the CLI environment:
1a. Check CLI is installed:
dreamina -h
If not installed:
curl -fsSL https://jimeng.jianying.com/cli | bash
1b. Check login status and credits:
dreamina user_credit
This is the definitive self-check. If it returns JSON with credit info, login and environment are working.
If login needed:
dreamina login # Opens browser for OAuth (default)
dreamina login --debug # Debug mode — prints callback URL for troubleshooting
dreamina login --headless # QR code mode — scan with Douyin app
Additional account commands:
dreamina relogin # Switch to a different account
dreamina logout # Clear credentials (keeps config.toml and tasks.db)
1c. Check config file (if login issues persist):
ls -la ~/.dreamina_cli/
> ⚠️ Note: The official docs reference config.toml, credential.json, and tasks.db at ~/.dreamina_cli/, but these files may not exist after login — especially in Docker environments. Auth state can be stored ephemerally. If ls shows only SKILL.md and version.json, login is still valid if dreamina user_credit returns your balance. See the dreamina-cli skill's references/docker-compatibility.md for Docker-specific setup info.
This skill requires a production-ready prompt. The prompt should already be:
If no prompt exists, activate jimeng-prompt-text2image first.
Take the prompt's recommendations and map them to CLI parameters:
| Prompt recommends | CLI parameter | Example |
|---|---|---|
| ------------------ | --------------- | --------- |
| Aspect ratio (e.g., 16:9) | --ratio=16:9 | --ratio=16:9 |
| Resolution (2K/4K) | --resolution_type=2k | --resolution_type=4k |
| Model version (4.5+) | --model_version=5.0 | --model_version=5.0 |
| Session organization | --session= | --session=0 |
Load references/parameter-reference.md for the complete parameter map.
Recommended (async + 智能体周期查询):
dreamina text2image --prompt="<prompt>" --ratio=16:9 --model_version=5.0 --resolution_type=4k --poll=0
→ 解析获取 submit_id,智能体随后每 ~5 秒调用 query_result 检查状态。
Quick poll (for fast tasks, auto 1s polling):
dreamina text2image --prompt="<prompt>" --ratio=16:9 --model_version=5.0 --resolution_type=4k --poll=30
With session (organized projects):
dreamina session create "project-name" # First time
dreamina text2image --prompt="<prompt>" --session=<session_id> --ratio=16:9 --poll=0
# Then follow 5s polling SOP using submit_id
After generation completes:
gen_status is "success"query_result 返回后智能体根据 gen_status 做分支判断--poll=N and it completes → output is available immediately"querying" after reasonable wait time → ask user if they want to continue waitingCommon errors and responses — see references/workflow-patterns.md for detailed patterns.
| Error | Meaning | Action |
|---|---|---|
| ------- | --------- | -------- |
AigcComplianceConfirmationRequired | Model needs first-time web authorization | Guide user to authorize on dreamina website |
| Credit insufficient | Not enough balance | Tell user, suggest checking balance |
dreamina: command not found | CLI not installed | Guide through installation |
| Authentication error | Not logged in | Run dreamina login |
| Parameter | Required | Values | Default |
|---|---|---|---|
| ----------- | ---------- | -------- | --------- |
--prompt | Yes | String (Chinese preferred) | — |
--ratio | No | 21:9, 16:9, 3:2, 4:3, 1:1, 3:4, 2:3, 9:16 | 1:1 |
--model_version | No | 3.0, 3.1, 4.0, 4.1, 4.5, 5.0 | 5.0 |
--resolution_type | No | 1k/2k (3.x), 2k/4k (4.0+) | Model default |
--session | No | Integer session ID | 0 |
--poll | No | Seconds (0 = async) | 0 (async) |
Poll behavior: When --poll=N is set, the CLI polls every 1 second for up to N seconds.
dreamina query_result --submit_id= to check later# Credit & auth
dreamina user_credit # Check credit balance
dreamina login # Login (OAuth browser)
dreamina login --headless # Login (QR code)
# Generation
dreamina text2image --prompt="..." # Basic generation
dreamina text2image --prompt="..." --ratio=16:9 --model_version=5.0 --resolution_type=4k --poll=30
# Task management
dreamina query_result --submit_id=<id> # Check task status
dreamina query_result --submit_id=<id> --download_dir=./downloads # Query + download
dreamina list_task # List all tasks
dreamina list_task --gen_status=success # Filter by status
dreamina list_task --submit_id=<id> # Filter by submit_id
# Session management
dreamina session create "name" # Create project session
dreamina session list # List sessions
# Utility
dreamina image_upscale --image ./x.png --resolution_type=4k # Upscale image
| CLI --model_version | Official Model ID | Resolutions | Best For |
|---|---|---|---|
| ------- | ------------------- | ------------ | ---------- |
| 5.0 (default) | doubao-seedream-5-0-260128 | 2k, 3k, 4k | Latest flagship, everything. Use unless specific reason otherwise |
| 4.5 | doubao-seedream-4-5-251128 | 2k, 4k | Landscapes, illustrations, artistic. Good for creative/artistic prompts |
| 4.1 | — | 2k, 4k | Portrait editing, poster editing, multi-round editing |
| 4.0 | doubao-seedream-4-0-250828 | 1k, 2k, 4k | General purpose multi-modal editing. Reliable baseline |
| 3.1 | — | 1k, 2k | Cinematic/storytelling, film genre prompts |
| 3.0 | — | 1k, 2k | Simple/short prompts, text rendering, fast generation |
Load references/model-guide.md for detailed model selection guidance.
Q: Login succeeds but generation commands still fail?
A: Two checks: (1) verify ~/.dreamina_cli/config.toml exists and is correct; (2) run dreamina user_credit — if this fails, login/config is the issue. Don't test generation commands until user_credit works.
Q: Browser login flow is stuck?
A: Use dreamina login --debug to print detailed debug info including the callback URL. Provide this output for troubleshooting.
Q: Async task shows no final result for a long time?
A: Use --poll=N (recommend --poll=30) for auto-waiting. If timeout, save the submit_id from the intermediate result and query manually: dreamina query_result --submit_id=.
Q: How to switch or re-login to another account?
A: Run dreamina relogin — it clears existing login state and starts a new login flow.
Q: How to completely clear local login info?
A: Run dreamina logout — this clears credential.json only. config.toml and tasks.db are preserved on native installs, but these files may be absent in Docker setups.
dreamina user_credit. Warn user if balance is low. If user_credit fails, do NOT proceed to generation — fix login/config first~/.dreamina_cli/ is the config directory — may contain config.toml (settings), credential.json (login), tasks.db (history) after native (non-Docker) login. In Docker setups these files may be absent. Don't delete this directory--poll polls every 1 second — using --poll=30 means up to 30 polling attempts, not a 30-second fixed wait. Timeout returns "querying" status, not failure--poll=0 获取 submit_id,然后由智能体在对话轮次中每 ~5 秒手动调用一次 query_result。禁止 while true; sleep 5; 阻塞终端。智能体需根据每次返回的 gen_status 做分支判断(继续等/报告结果/通知超时)| Resource | Description | When to Load |
|---|---|---|
| ---------- | ------------- | -------------- |
references/parameter-reference.md | Complete CLI parameter reference with all options | When mapping prompt specs to CLI arguments |
references/model-guide.md | Detailed model selection guidance by use case | When choosing or recommending a model version |
references/workflow-patterns.md | Standard execution patterns, error handling, async workflows | When executing complex or multi-step generations |
examples/basic-generation.md | Simple single-image generation flows | Default — most common use case |
examples/batch-generation.md | Multi-image, series, and batch patterns | User wants multiple images |
examples/async-generation.md | Async submit + poll patterns | Long-running or non-blocking generations |
examples/session-workflow.md | Session-based project organization | User wants organized project workflow |
共 1 个版本