When To Use
Use this skill when the user wants image generation, image editing, or reference-image-based image creation through GoAI, especially for prompts like 生成图片, 画图, 出图, 做图, 修图, and 改图.
Pass the user's image prompt through as-is unless the user explicitly asks for prompt optimization, prompt polishing, rewriting, translation, or additional creative detail. Do not silently embellish short prompts such as 画一个老虎.
Do not translate the user's prompt to another language. If the user writes in Chinese, pass Chinese to --prompt. If the user writes in English, pass English to --prompt. You may strip only lightweight request wrappers such as 帮我, 给我, 请, 生成, or 画一张, but do not rewrite the core prompt content.
Examples:
- - User:
给我生成一只狮子 -> --prompt "一只狮子" or INLINECODE10 - User:
画一个老虎 -> --prompt "画一个老虎" or INLINECODE13 - Never turn
给我生成一只狮子 into a lion unless the user explicitly asks for English translation.
Default Behavior
This package currently targets the production environment at https://mustgoai.com. Override GOAI_BASE_URL only when you intentionally need a different endpoint.
This skill now uses a single cross-platform Python entrypoint through uv. If the user does not specify a model, the script queries /api/v1/models/capabilities, sorts enabled image models by display.priority, and picks the highest-priority model.
Treat uv as the only runtime dependency the user needs to install manually. On first run, uv may create a local environment, install httpx, and download Python if the machine does not already have a usable interpreter. That first-run setup is expected and should not be described as an error.
If the user provides local image paths, the script uploads them first and sends the resulting URLs as reference_images. If the user provides remote URLs, the script passes them through unchanged.
Script Rules
Always use the Python entrypoint through uv:
CODEBLOCK0
The Python path validates GOAI_API_KEY, defaults to https://mustgoai.com unless GOAI_BASE_URL is set, and treats 401, 402, 429, content blocking, missing task_id, missing image_url, and backend terminal failure states as hard failures. Polling follows the web client behavior: it checks every 3 seconds, retries transient polling errors, and waits for a backend terminal status instead of enforcing a client-side timeout.
The Python entrypoint self-heals into uv run if it is accidentally invoked as python scripts/generate_image.py ... or python3 scripts/generate_image.py .... Do not try to repair the system Python environment for this skill.
When invoking this skill through OpenClaw's exec tool, always use timeout=600 to allow up to 10 minutes for long-running image generation. Do not describe the run as timed out or killed unless the script itself exits non-zero or the backend reports a terminal failure state.
If uv is missing, explicitly guide the user to install it first:
- - macOS: INLINECODE40
- Windows: INLINECODE41
After uv is installed, rerun the same command. Do not ask the user to install Python packages by hand; uv is responsible for preparing Python and the skill dependencies.
If execution reports a missing Python module such as httpx, do not run pip install, pip install --user, or pip install --break-system-packages. Re-run the skill through uv; the dependency set comes only from pyproject.toml and uv.lock.
If GOAI_API_KEY is missing, explicitly guide the user to visit https://mustgoai.com, register or log in, open Settings -> API Key, create a key, and then configure the skill env in ~/.openclaw/openclaw.json.
Output Contract
On success, print all four lines below in this order:
- - INLINECODE55
- INLINECODE56
- INLINECODE57
- INLINECODE58
When responding to the user after a successful run, always include both the exact local file path and the exact public URL in plain text, even if OpenClaw already rendered or read the local media file. Do not omit the URL just because the image preview succeeded. On failure, exit non-zero and print a concise error message. Do not inline the binary output back into the conversation.
使用时机
当用户需要通过GoAI进行图像生成、图像编辑或基于参考图像的创作时使用此技能,尤其适用于诸如生成图片、画图、出图、做图、修图和改图等提示词。
除非用户明确要求优化提示词、润色提示词、重写、翻译或添加额外创意细节,否则请原样传递用户的图像提示词。不要擅自对诸如画一个老虎之类的简短提示词进行修饰。
不要将用户的提示词翻译成其他语言。如果用户用中文书写,则将中文传递给--prompt。如果用户用英文书写,则将英文传递给--prompt。你只能去除诸如帮我、给我、请、生成或画一张等轻量请求包装词,但不要重写核心提示词内容。
示例:
- - 用户:给我生成一只狮子 -> --prompt 一只狮子 或 --prompt 给我生成一只狮子
- 用户:画一个老虎 -> --prompt 画一个老虎 或 --prompt 一个老虎
- 除非用户明确要求翻译成英文,否则永远不要将给我生成一只狮子变成a lion
默认行为
此包当前以生产环境https://mustgoai.com为目标。仅当你确实需要不同的端点时才覆盖GOAIBASEURL。
此技能现在通过uv使用单一的跨平台Python入口点。如果用户未指定模型,脚本会查询/api/v1/models/capabilities,按display.priority对启用的图像模型进行排序,并选择优先级最高的模型。
将uv视为用户需要手动安装的唯一运行时依赖项。首次运行时,uv可能会创建本地环境、安装httpx,如果机器尚未拥有可用的解释器,还会下载Python。这种首次运行设置是预期行为,不应被描述为错误。
如果用户提供本地图像路径,脚本会先上传这些图像,并将生成的URL作为reference_images传递。如果用户提供远程URL,脚本会原样传递。
脚本规则
始终通过uv使用Python入口点:
bash
uv run --project . python scripts/generate_image.py \
--prompt ... \
[--model ...] \
[--aspect-ratio ...] \
[--resolution ...] \
[--reference /path/to/image.png] \
[--reference https://example.com/image.png]
Python路径会验证GOAIAPIKEY,默认使用https://mustgoai.com(除非设置了GOAIBASEURL),并将401、402、429、内容屏蔽、缺少taskid、缺少imageurl以及后端终端故障状态视为硬性失败。轮询遵循Web客户端行为:每3秒检查一次,重试临时轮询错误,并等待后端终端状态,而不是强制执行客户端超时。
如果Python入口点被意外调用为python scripts/generateimage.py ...或python3 scripts/generateimage.py ...,它会自动修复为uv run。不要尝试为此技能修复系统Python环境。
当通过OpenClaw的exec工具调用此技能时,始终使用timeout=600以允许最长10分钟的长时图像生成。除非脚本本身以非零退出或后端报告终端故障状态,否则不要将运行描述为超时或被终止。
如果缺少uv,请明确引导用户先安装它:
- - macOS:brew install uv
- Windows:winget install astral-sh.uv
安装uv后,重新运行相同的命令。不要要求用户手动安装Python包;uv负责准备Python和技能依赖项。
如果执行报告缺少Python模块(如httpx),不要运行pip install、pip install --user或pip install --break-system-packages。通过uv重新运行技能;依赖项集仅来自pyproject.toml和uv.lock。
如果缺少GOAIAPIKEY,请明确引导用户访问https://mustgoai.com,注册或登录,打开设置 -> API密钥,创建一个密钥,然后在~/.openclaw/openclaw.json中配置技能环境变量。
输出约定
成功时,按顺序打印以下四行:
- - MEDIA:/absolute/path/to/generated-file
- MEDIAURL:https://...
- RESULTPATH:/absolute/path/to/generated-file
- RESULT_URL:https://...
在成功运行后回复用户时,始终以纯文本形式同时包含确切的本地文件路径和确切的公共URL,即使OpenClaw已经渲染或读取了本地媒体文件。不要因为图像预览成功就省略URL。失败时,以非零退出并打印简洁的错误消息。不要将二进制输出内联回对话中。