360 Secure SkillHub
360 安全技能中心

Doubao Image Generation

通过 Python 脚本调用火山引擎豆包 Seedream 图像生成接口,支持文生图与基于参考图的图生图及多图参考,可设置模型、分辨率、guidance-scale 和输出路径,生成结果保存为本地图片,使用前需配置 API Key 环境变量。

kutouakira
kutouakira
热度 17.46
最近更新 2026-03-28 05:51:49
分类:创作依赖:代码执行 / 第三方 API / 读写文件应用场景:图像生成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add doubao-image-generation
Metadata
name
doubao-image-generation
description
Use Volcengine Doubao (Seedream) for text-to-image (t2i) and image-to-image (i2i) generation. Supports models like Seedream 4.5/4.0/3.0. Use when the user asks to generate images, edit images based on references, or create artwork using prompts. Features include adjustable resolution, prompt guidance, and multi-image references.

Doubao Image Generation

This skill provides access to Volcengine's Doubao (Seedream) image generation models. It supports high-quality text-to-image generation and image editing/variation based on input images.

Usage

Use the provided Python script to generate images.

Models

  • doubao-seedream-4.5: Latest model, supports text-to-image and multi-image references (2-14 images). High quality.
  • doubao-seedream-4.0: Supports text-to-image and multi-image references.
  • doubao-seedream-3.0-t2i: Text-to-image only.
  • doubao-seededit-3.0-i2i: Image-to-image editing (single reference image).

Script: generate_image.py

Execute the script to call the API.

Arguments:

  • --prompt: (Required) The text description of the image to generate. Max 300 Chinese characters or 600 English words.
  • --model: (Optional) The model ID to use. Default: doubao-seedream-4.5.
  • --image: (Optional) Path or URL to reference image(s). Can be specified multiple times for multi-image support (only for 4.5/4.0).
  • --width: (Optional) Width of the generated image. Default: 1024.
  • --height: (Optional) Height of the generated image. Default: 1024.
  • --size: (Optional) Preset size string (e.g., "1024x1024"). Overrides width/height if set.
  • --guidance-scale: (Optional) Text guidance scale (1.0-10.0). Higher values adhere more strictly to the prompt. Default varies by model.
  • --output: (Optional) Path to save the generated image. Default: ./generated_image.png.

Example:

# Basic text-to-image
python3 scripts/generate_image.py --prompt "A futuristic city skyline at sunset, cyberpunk style"

# Image-to-image with a reference
python3 scripts/generate_image.py --prompt "Turn this into an oil painting" --image "./sketch.png" --model "doubao-seededit-3.0-i2i"

# Multi-image reference (Seedream 4.5)
python3 scripts/generate_image.py --prompt "Combine these styles" --image "./style1.jpg" --image "./style2.jpg" --model "doubao-seedream-4.5"

Requirements

  • API Key: Set the VOLCENGINE_API_KEY environment variable.
  • Python Dependencies: requests (usually available).