Use this skill for:
qwen-image is a skill name, not a built-in tool name.qwen-image.read on this SKILL.md, then execute the Python command below..MEDIA: in tool-stage outputs; only output MEDIA: in the final assistant reply.MEDIA: lines into markdown image links.qwen-vision-rename instead.SKILL.md or script source unless command fails.--emit-media-ref. 1) parse the last MEDIA_REF: line from stdout (ignore preceding shell noise lines)
2) final reply must be exactly one line: MEDIA:
3) if missing MEDIA_REF:, retry command once
1) failure reason
2) actionable fix
Install dependencies:
pip3 install -r {baseDir}/requirements.txt
Set API key:
export DASHSCOPE_API_KEY="your_api_key"
Optional region switch:
export DASHSCOPE_REGION="sg" # sg or bj
Or use .env (auto-loaded from current directory, then {baseDir}):
cat > .env <<'EOF'
DASHSCOPE_API_KEY=your_api_key
DASHSCOPE_REGION=sg
OPENCLAW_MEDIA_OUTBOUND_DIR=~/.openclaw/media/outbound
OPENCLAW_MEDIA_BASE_URL=
EOF
Static URL mapping example (Nginx):
location /gen/ {
alias /home/huiya/.openclaw/media/outbound/;
autoindex off;
}
Text to image:
python3 {baseDir}/scripts/qwen_image.py text2img \
--prompt "A futuristic tea shop in Shanghai at night, cinematic lighting" \
--model qwen-image-2.0-pro \
--size "1024*1024" \
--n 1 \
--emit-media-ref \
--publish-dir ~/.openclaw/media/outbound \
--out-dir {baseDir}/tmp/qwen-image
Image to image:
python3 {baseDir}/scripts/qwen_image.py img2img \
--images ./input.png \
--prompt "Keep composition, convert this to watercolor style" \
--model qwen-image-2.0-pro \
--n 1 \
--emit-media-ref \
--publish-dir ~/.openclaw/media/outbound \
--out-dir {baseDir}/tmp/qwen-image
qwen-image-2.0-pro (quality first). qwen-image-2.0 can be used for faster/cheaper runs.data:image/...;base64,....--out-dir.OPENCLAW_MEDIA_OUTBOUND_DIR (default: ~/.openclaw/media/outbound)..view.html preview pages and uses those URLs in visible text to reduce markdown-image rewrites.OPENCLAW_MEDIA_BASE_URL is optional. Keep it empty for portable packaging; set it per deployment only when you need public links (e.g. https://example.com/gen or local http://127.0.0.1:8090).--emit-media-ref + final one-line MEDIA: reply is recommended for Feishu to avoid duplicate media sends.--reply-format link..env values.InvalidApiKey.共 1 个版本