Generate and edit images via Volcengine Doubao-Seedream API using {baseDir}/scripts/generate_image.py.
This skill wraps the Volcengine Ark Image Generation API. It supports text-to-image, image editing, multi-reference fusion, sequential/group generation, PNG output, prompt optimization, web search, and streaming output. Works with Seedream 5.0-lite (default), 4.5, and 4.0 models.
bash
# Text to image (simplest form)
uv run {baseDir}/scripts/generate_image.py --prompt "一只赛博朋克风格的猫"
# Image editing (with reference image)
uv run {baseDir}/scripts/generate_image.py --prompt "变为水墨画风格" --image "https://example.com/photo.jpg"
# Multi-reference fusion
uv run {baseDir}/scripts/generate_image.py --prompt "融合风格" --image "https://a.jpg" --image "https://b.jpg"
# Group/sequential generation
uv run {baseDir}/scripts/generate_image.py --prompt "四格漫画" --sequential --max-images 4
# List available models
uv run {baseDir}/scripts/generate_image.py --list-models
Set VOLC_API_KEY env var or pass --api-key. Never hardcode keys in scripts.
bash
export VOLC_API_KEY="your-key"
# or
--api-key your-key
Default model: doubao-seedream-5-0-260128 (5.0-lite). Override with --model.
Feature5.0-lite4.54.0Model IDdoubao-seedream-5-0-260128``doubao-seedream-4-5-251128``doubao-seedream-4-0-250828Aliasdoubao-seedream-5-0-lite-260128——Preset sizes2K, 3K, 4K2K, 4K1K, 2K, 4KOutput formatspng, jpegjpeg onlyjpeg onlyPrompt optimizationstandardstandardstandard, fastStreaming✅✅✅Web search✅ (only model)❌❌Rate limit500 IPM500 IPM500 IPM
--prompt-optimization fast for quicker results. Good for rapid iteration. Also supports 1K for smaller/faster generation.Two ways to specify size (cannot mix):
Method 1 — Preset (recommended for most cases):
bash
--size 2K # 2048x2048 (default)
--size 3K # 3072x3072 (5.0-lite only)
--size 4K # 4096x4096 (all models)
--size 1K # 1024x1024 (4.0 only)
Method 2 — Pixel format (for custom aspect ratios):
bash
--size 3840x2160 # 16:9 widescreen
--size 1080x1920 # 9:16 portrait
--size 1200x1200 # custom square
When using preset sizes, the model picks the best aspect ratio based on your prompt. For precise control, use pixel format.
Preset1:14:33:416:99:163:22:321:91K1024×10241152×864864×11521280×720720×12801248×832832×12481512×6482K2048×20482304×17281728×23042848×16001600×28482496×16641664×24963136×13443K3072×30723456×25922592×34564096×23042304×40963744×24962496×37444704×20164K4096×40964704×35203520×47045504×30403040×55044992×33283328×49926240×2656
Examples:
3840x2160 → 8,294,400 pixels, ratio 1.78 → valid for all models2160x3840 → same pixels, ratio 0.56 → valid for all models1500x1500 → 2,250,000 pixels < 3,686,400 minimum → invalid for 5.0-lite/4.5--prompt — Text description for image generation. Supports Chinese and English. Recommended under 300 Chinese characters or 600 English words.--model — Model ID (default: doubao-seedream-5-0-260128)--size — Preset ( 1K/ 2K/ 3K/ 4K) or pixel ( WIDTHxHEIGHT, default: 2K)--image — Reference image URL or base64. Repeat for multiple images (max 14 total). Used for image editing and multi-reference fusion.Supported input formats: jpeg, png, webp, bmp, tiff, gif, heic, heif. Constraints: max 30MB per image, max 60MP (width×height), aspect ratio [1/16, 16].
--output-format — jpeg (default) or png (5.0-lite only)--response-format — url (default, 24h valid) or b64_json (base64 encoded)--watermark / --no-watermark — Enable/disable "AI生成" watermark (default: enabled)--sequential — Enable group/sequential generation (multiple related images)--max-images — Number of images in sequential mode (1-15, default: 1)--stream — Enable streaming output (get results as generated)--web-search — Enable web search for real-time info ( 5.0-lite only). Uses tools: [{type: "web_search"}] API parameter.--prompt-optimization — standard (all models) or fast (4.0 only). Rewrites prompt for better results.--list-models — List available Seedream models and their capabilities--api-key — Volcengine API key (or set VOLC_API_KEY env)bash
uv run {baseDir}/scripts/generate_image.py --prompt "充满活力的特写肖像,模特眼神犀利,头戴雕塑感帽子,色彩拼接丰富,Vogue杂志封面美学"
bash
# 4K landscape
uv run {baseDir}/scripts/generate_image.py --prompt "壮丽的山川日出,金色阳光穿过云层" --size 4K
# Custom widescreen
uv run {baseDir}/scripts/generate_image.py --prompt "赛博朋克城市夜景" --size 3840x2160
# Portrait for phone wallpaper
uv run {baseDir}/scripts/generate_image.py --prompt "极简抽象艺术" --size 1080x1920
bash
uv run {baseDir}/scripts/generate_image.py \
--prompt "保持模特姿势和构图不变,将服装材质从银色金属改为完全透明的清水" \
--image "https://example.com/original.jpg"
bash
# Combine 2 images
uv run {baseDir}/scripts/generate_image.py \
--prompt "将图1的服装换为图2的服装" \
--image "https://example.com/person.jpg" \
--image "https://example.com/clothing.jpg"
# Combine 3+ images
uv run {baseDir}/scripts/generate_image.py \
--prompt "融合这三张图的风格特征,生成统一视觉" \
--image "https://example.com/1.jpg" \
--image "https://example.com/2.jpg" \
--image "https://example.com/3.jpg"
bash
# Generate 4 related images
uv run {baseDir}/scripts/generate_image.py \
--prompt "生成一组电影级科幻写实风的4张影视分镜" \
--sequential --max-images 4
# With reference image
uv run {baseDir}/scripts/generate_image.py \
--prompt "参考这张图,生成同角色在早晨、中午、晚上的连续画面" \
--image "https://example.com/character.jpg" \
--sequential --max-images 3
bash
uv run {baseDir}/scripts/generate_image.py \
--prompt "高清产品图,白色背景,专业摄影灯光" \
--output-format png
bash
# Standard mode (higher quality, all models)
uv run {baseDir}/scripts/generate_image.py \
--prompt "一只猫" \
--prompt-optimization standard
# Fast mode (quicker, 4.0 only)
uv run {baseDir}/scripts/generate_image.py \
--prompt "一只猫" \
--model doubao-seedream-4-0-250828 \
--prompt-optimization fast
bash
# Weather forecast image
uv run {baseDir}/scripts/generate_image.py \
--prompt "制作一张上海未来5日的天气预报图,扁平化插画风格" \
--web-search
# Current events
uv run {baseDir}/scripts/generate_image.py \
--prompt "2026年最流行的时尚趋势海报" \
--web-search
bash
uv run {baseDir}/scripts/generate_image.py \
--prompt "产品宣传图,专业商业摄影" \
--no-watermark
Language: Supports Chinese and English. English tends to produce slightly better results for complex scenes, but Chinese works well too.
Length: Under 300 Chinese characters or 600 English words recommended. Too long → model may ignore some details.
Specificity: Be specific. "赛博朋克风格的猫,霓虹灯光,雨夜街道,4K,电影感" > "一只猫"
Style keywords: Append style terms for control:
Structure: For complex scenes, describe subject → composition → style → lighting → quality
Script stdout contains exactly one of:
MEDIA_URL: <url> — Image download link. Valid for 24 hours. Use markdown: MEDIA_B64: <base64> — Base64 encoded image data (when --response-format b64_json)ERROR: <msg> — Error occurred. Check message for details.ErrorCauseFixAPI key requiredNo key providedSet VOLC_API_KEY env or pass --api-key``API request failed: 401Invalid API keyCheck key at Volcengine consoleAPI request failed: 429Rate limited (500 IPM)Wait and retryNo image data in responseAPI errorCheck prompt/params, retryWARNING: may not supportModel+size/format mismatchCheck model capabilities table above
MEDIA_URL: or MEDIA_B64:All models: 500 images per minute (IPM). Plan batch operations accordingly.
For detailed API parameter docs, see references/REFERENCE.md.