name: 图片生成skill description: 可对接中转站的图片生成技能,一句描述直接出高清图。 基于 OpenAI 兼容 images API 的通用生图技能,可灵活搭配各种生图模型。支持文生图、图生图参考、多图融合与 2K 高清输出。源头优质模型:https://uniapi.thingo.com.cn。v1.1.0新增本地图片自动上传、本地图与 URL 混搭及多图融合支持;v1.1.1增加版本更新日志,修复版本更新后技能名称和简介混乱的问题; agent_created: true
Call Doubao (豆包) Seedream image generation API through an OpenAI-compatible third-party relay service (中转站), returning locally-saved image files. Designed for end users of Doubao relay services (not the official Volcengine Ark direct API), so it requires only two configurations: the relay URL and the relay API key. Supports text-to-image, image-to-image, sequential image generation, and multi-image fusion in one skill.
Use this skill when the user:
ARK_BASE_URL points to a relay, not the official volces.com)画一张图, 生成一张海报, draw a cat)基于这张参考图, 把这几张图融合一下, edit this image)生成 4 张图, 一组连续图, generate a set of 4)Do NOT use this skill when:
volc-image skill — that one hardcodes ark.cn-beijing.volces.com)Environment variables (recommended):
export ARK_BASE_URL="https://uniapi.thingo.com.cn/v1" # the relay's OpenAI-compatible base
export ARK_API_KEY="sk-relay-xxxxxx" # the relay's API key
Or write config.json in the same directory as the skill (overrides env only if env is empty):
{
"base_url": "https://uniapi.thingo.com.cn/v1",
"api_key": "sk-relay-xxxxxx",
"model": "doubao-seedream-5-0-260128",
"api_path": "images/generations",
"save_dir": "./output",
"download": true,
"retry": 1
}
Run python scripts/init.py for an interactive setup that writes config.json for you.
From a natural-language request inside WorkBuddy / OpenClaw / 小龙虾:
"用 doubao-image-api 画一只橘猫,要求卡通风格"
The agent (me) will read this skill's scripts, build the request, and return the result.
From a command line:
# Images saved to current working directory by default (follows WorkBuddy workspace)
python scripts/gen.py "一只橘猫,卡通风格" --size 2K
# Explicit save directory (if you want a custom location)
python scripts/gen.py "一只橘猫,卡通风格" --size 2K --save-dir /path/to/output
As a Python function (used by agent tools):
from scripts.gen import generate_image
result = generate_image(prompt="一只橘猫", size="2K")
# result = {"model": "...", "images": [{"url": "...", "local_path": "<save_dir>/xxx.jpg"}], "usage": {...}}
All keys resolve in this priority: CLI flag > env var > config.json > built-in default.
| Key | Env var | Default | Description |
|---|---|---|---|
base_url |
ARK_BASE_URL |
https://uniapi.thingo.com.cn/v1 |
中转站地址,默认已写死为 thingo。可用 ARK_BASE_URL 或 --base-url 覆盖(改用其它 OpenAI 兼容中转站)。 |
api_key |
ARK_API_KEY |
(required) | Relay-issued API key, usually sk-... |
model |
DOUBAO_MODEL |
doubao-seedream-5-0-260128 |
Model identifier. Relay may have its own alias; override in config.json if needed |
api_path |
DOUBAO_API_PATH |
images/generations |
Endpoint path joined onto base_url. Change only if the relay uses a non-standard path |
save_dir |
DOUBAO_SAVE_DIR |
CWD-first, auto-detected | Local directory for downloaded images. Created if missing. Default resolution order: (1) current working directory (os.getcwd()) — follows the caller's context (WorkBuddy workspace, project root, etc.); (2) $XDG_DOWNLOAD_DIR/doubao-image-api (Linux desktop spec); (3) <home>/Downloads/doubao-image-api (Windows / macOS / Linux); (4) <skill_dir>/output (last-resort fallback). Override with env var DOUBAO_SAVE_DIR, config.json, or --save-dir. |
download |
DOUBAO_DOWNLOAD |
true |
When true: download every generated image into save_dir and return the local path. When false: return only the remote URL (useful for relays whose URL doesn't expire, or for passing directly to other tools) |
retry |
DOUBAO_RETRY |
1 |
Number of retries on 5xx or network errors. Set to 0 to disable |
proxy |
DOUBAO_PROXY |
(none) | Optional HTTP proxy, e.g. http://127.0.0.1:7890. Leave empty for direct connection |
timeout |
DOUBAO_TIMEOUT |
120 |
Total request timeout in seconds |
The simplest path. Pass only prompt (and size):
generate_image(prompt="星际穿越,黑洞,电影感", size="2048x2048")
If size is omitted, the relay's default applies (commonly 1024x1024 or 2K). The size field is required by the API, so the script always sends it; users should set it explicitly when in doubt.
参考图支持两种形式:① 公网 URL(
http(s)://);② 本地文件路径(如C:/path/to/photo.jpg)——脚本会自动读取并转成data:image/...;base64,...上传,无需手动转码或上传图床。两者可混搭(如一张本地图 + 一张 URL)。重复--image可传入多张进行融合。
Pass one image URL via image:
generate_image(
prompt="把这张图改成赛博朋克风格",
image="https://example.com/photo.jpg",
size="2K"
)
The relay supports generating multiple related images in one call. Use n to set the count (1–15):
generate_image(
prompt="同一只柯基在四个季节,温馨插画",
size="2K",
n=4
)
The output images array will contain 4 entries; the script downloads all of them and returns a list of local paths.
Pass multiple images as a list and the model will fuse their features into a single output. Combine with n > 1 for a fused series. 支持本地文件路径与公网 URL 混搭(见上文图生图说明):
generate_image(
prompt="把这三张图里的元素融合成一张新图",
image=[
"https://example.com/cat.jpg",
"https://example.com/dog.jpg",
"https://example.com/bird.jpg",
],
size="2K"
)
The script always prints a single JSON object to stdout (so agent tools can json.loads it) and a one-line summary to stderr. Example:
{
"model": "doubao-seedream-5-0-260128",
"created": 1765250822,
"images": [
{
"url": "https://ark-content-generation-xxx.tos-cn-beijing.volces.com/abc.jpeg",
"size": "2048x2048",
"local_path": "C:\\path\\to\\output\\2026-07-03_abc.jpeg"
}
],
"usage": {
"generated_images": 1,
"total_tokens": 16464
}
}
images[].local_path is null when download=falseusage.total_tokens is omitted if the relay doesn't return it{"error": "...", "status": 4xx/5xx} to stdout| Situation | Behavior |
|---|---|
ARK_BASE_URL or ARK_API_KEY not set |
Exit 1 with clear message pointing to scripts/init.py |
| 4xx response from relay | Exit 1, include relay's error message verbatim |
| 5xx / network error | Retry up to retry times with exponential backoff, then exit 1 |
Image URL download fails (when download=true) |
Mark that image as local_path: null but keep the URL, so the caller can decide |
| Image URL 24h expiration warning | Logged once per run; users should consume the local file promptly |
size below upstream minimum (Seedream 5.0 requires ≥ 1920×1920 = 3,686,400 px; check the configured model's docs when switching models) |
Relay returns HTTP 400 with InvalidParameter: image size must be at least 3686400 pixels (or upstream-equivalent). Fix: pass --size 2K (2048×2048) or larger. Common mistake is passing 1024x1024. |
本技能来自小葱技能站7w4.net。
gen.py — Main entry. Exposes both CLI (python gen.py "prompt") and a Python function generate_image(**kwargs) -> dict. The agent should call generate_image directly when using this skill from inside a tool.init.py — Interactive setup wizard. Walks the user through base_url, api_key, and writes config.json. Use when neither env var is set.api-spec.md — Full Doubao Seedream API parameter reference (size presets, recommended aspect ratios, all model IDs). Load only when the agent needs to look up a specific parameter.(empty — no template files needed)
The agent MUST perform this check before invoking gen.py:
config.json from the skill root directory.api_key: if empty / missing / "" / placeholder → DO NOT call gen.py. Instead, ask the user to provide it (or set ARK_API_KEY env var), and offer to run python scripts/init.py for an interactive setup. The agent may also accept api_key from the current conversation context and pass it via --api-key.model: if empty / missing / "" → fall back to doubao-seedream-5-0-260128 (the built-in default). If the user explicitly specified a model, pass it via --model. Only ask the user if the relay's model naming is unknown.save_dir: if empty / unset (defaults to CWD) and the user wants images in a specific location, pass --save-dir explicitly. Otherwise the default CWD behavior is fine.Example of an agent-side pre-flight:
# 1. Read config
config = json.load(open("config.json"))
# 2. Validate api_key
if not config.get("api_key"):
# Ask user: "api_key is empty, please provide or run init.py"
return
# 3. Fallback model
model = config.get("model") or "doubao-seedream-5-0-260128"
# 4. Call with explicit args
run(f"python scripts/gen.py '{prompt}' --size {size} --model {model} --api-key {config['api_key']}")
doubao-image-v5 instead of doubao-seedream-5-0-260128). If the user reports "model not found", ask which model names the relay exposes and update DOUBAO_MODEL / model in config.size is a required field at the API level. If the user didn't specify it, default to 2K (2048×2048) — never omit it, and never default to 1024×1024: for the default model (Seedream 5.0) the upstream rejects anything below 1920×1920 (3,686,400 px). The minimum safe value is 1920x1920; 2048x2048 is the recommended default. When the configured model changes, re-verify upstream's size constraints — different Doubao models (or other vendors' models behind the same relay) may have different minimums.download=true so the local file is captured.api_key when echoing it back to the user.Unpack the zip into ~/.workbuddy/skills/doubao-image-api/, then run once:
python scripts/init.py # 交互式写入 config.json
python scripts/gen.py "测试 prompt" --size 2K
Or skip the file entirely and use env vars only:
export ARK_BASE_URL="https://uniapi.thingo.com.cn/v1"
export ARK_API_KEY="sk-relay-xxxxxx"
python scripts/gen.py "测试 prompt"
可对接中转站的图片生成技能,一句描述直接出高清图。基于 OpenAI 兼容 images API 的通用生图技能,可灵活搭配各种生图模型。支持文生图、图生图参考、多图融合与 2K 高清输出。源头优质模型:https://uniapi.thingo.com.cn。
修复图生图仅支持公网 URL 的问题,新增本地图片自动上传、本地图与 URL 混搭及多图融合支持。
增加版本更新日志,修复版本更新后技能名称和简介混乱的问题。
整体质量较好,文档详细、代码规范且无需额外安装依赖,上手友好。功能覆盖全面(文生图、图生图、融合图等),配置灵活,支持本地图片自动上传。安全性和错误处理考虑周全。不足是初次配置时需要手动填写 API 密钥,缺少更直观的引导提示,中文文档对小部分用户可能偏长。