360 Secure SkillHub
360 安全技能中心

Dashscope Imagegen

通过命令行脚本调用阿里云 DashScope 的通义万相 wan2.6-t2i 模型,按文本提示词异步生成 PNG 图片,可指定尺寸、生成数量、负面提示词与输出目录,也可仅返回图片链接;要求配置 DASHSCOPE_API_KEY 并使用 exec 执行脚本。

chaoyang78
chaoyang78
热度 16.02
最近更新 2026-05-21 18:47:22
分类:创作依赖:代码执行 / 第三方 API / 读写文件应用场景:图像生成

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add dashscope-imagegen
Metadata
name
dashscope-imagegen
description
Generate images using DashScope wan2.6-t2i model (通义万相). Use when user asks to generate/create images, illustrations, or visual content via DashScope/通义万相. Requires exec tool and DASHSCOPE_API_KEY.

dashscope-imagegen

Generate images using Alibaba Cloud DashScope wan2.6-t2i model (通义万相 2.6).

Usage

python3 ~/.openclaw/scripts/dashscope-imagegen.py "your prompt here" [options]

Options

  • --size SIZE — Image size, e.g. 1024*1024, 1280*720, 720*1280 (default: 1024*1024)
  • -n N — Number of images (default: 1)
  • --negative "text" — Negative prompt
  • -o DIR — Output directory (default: current dir)
  • --url-only — Only print image URLs without downloading

Examples

# Generate and download
python3 ~/.openclaw/scripts/dashscope-imagegen.py "一只可爱的橘猫坐在书桌上" -o /tmp

# URL only
python3 ~/.openclaw/scripts/dashscope-imagegen.py "sunset over mountains" --url-only --size 1280*720

# With negative prompt
python3 ~/.openclaw/scripts/dashscope-imagegen.py "professional headshot" --negative "cartoon, anime, low quality"

Supported Sizes

Total pixels must not exceed ~1.5M. Common sizes:

  • 1024*1024 (1:1)
  • 1280*720 (16:9)
  • 720*1280 (9:16)
  • 1024*768 (4:3)
  • 768*1024 (3:4)

Environment

Requires DASHSCOPE_API_KEY environment variable (set in ~/.openclaw/.env).

Notes

  • Async API: submits task, polls for completion (~10-20s)
  • Output is PNG
  • Chinese and English prompts both work well
  • prompt_extend is enabled by default for better results