Sudocode Nano Banana2
Generate images from text prompts or edit a local image with a prompt through the remote Sudocode API.
Initialize environment on first run
Before the first real use, check whether the required variables exist:
CODEBLOCK0
If the check reports missing variables, tell the user to first register at https://sudocode.us and apply for an API key, then run:
CODEBLOCK1
The initializer will prompt for values and persist them to ~/.openclaw/.env.
Use the bundled script
Run:
CODEBLOCK2
Inputs:
- -
--prompt: required - INLINECODE3 : optional local image path for image-to-image editing
- INLINECODE4 : optional output path, defaults to INLINECODE5
Environment:
- -
SUDOCODE_IMAGE_API_KEY: required API key; if missing, direct the user to register at https://sudocode.us and apply for an API key first - INLINECODE8 : optional API base URL for the remote Sudocode service, defaults to INLINECODE9
Behavior notes:
- - This skill is an API client, not a local inference model
- It sends prompts and optional input images to the configured Sudocode endpoint
- It stores credentials in
~/.openclaw/.env only when the initializer is used - It writes generated image files and per-run logs to local disk near the chosen output path
The initializer writes these values into ~/.openclaw/.env so future sessions can reuse them.
Remote API and model naming
This skill is named sudocode-nano-banana2 because it packages Sudocode's Nano Banana 2 image capability for OpenClaw.
The bundled script currently calls the upstream model identifier gemini-3.1-flash-image-preview exposed by the configured Sudocode-compatible endpoint. The skill name and upstream model identifier are intentionally different: one is the packaged skill name, the other is the current backend route used by the service.
If requests is missing, install it with:
CODEBLOCK3
Packaging and portability
This skill is structured as a standard skill package:
- -
SKILL.md: trigger metadata and operating instructions - INLINECODE16 : first-run environment bootstrap helper
- INLINECODE17 : bundled runtime script
Do not include generated images, logs, or other local run artifacts in the distributable package.
Delivering generated images
When using this skill inside OpenClaw, send the generated file with the message tool so the user can actually receive the image.
Use:
CODEBLOCK4
Then reply NO_REPLY to avoid duplicate text.
Do not rely on reading the image file or pasting a local path into chat.
Error handling
If the script exits with code 2, relay this message to the user:
CODEBLOCK5
For other failures, show the script output directly.
Sudocode Nano Banana2
通过远程 Sudocode API,根据文本提示生成图像,或根据提示编辑本地图像。
首次运行时初始化环境
在首次实际使用前,检查所需变量是否存在:
bash
uv run python dir>/scripts/initenv.py --check-only
如果检查报告缺少变量,请告知用户先在 https://sudocode.us 注册并申请 API 密钥,然后运行:
bash
uv run python dir>/scripts/initenv.py
初始化程序会提示输入值,并将其持久化到 ~/.openclaw/.env 文件中。
使用捆绑脚本
运行:
bash
uv run python dir>/scripts/sudocodenanobanana2.py --prompt ... [--inputimage path] [--output path]
输入参数:
- - --prompt:必需
- --input_image:可选的本地图像路径,用于图像到图像的编辑
- --output:可选的输出路径,默认为 output.png
环境变量:
- - SUDOCODEIMAGEAPIKEY:必需的 API 密钥;如果缺失,请引导用户前往 https://sudocode.us 注册并申请 API 密钥
- SUDOCODEBASE_URL:可选的远程 Sudocode 服务 API 基础 URL,默认为 https://sudocode.run
行为说明:
- - 此技能是一个 API 客户端,而非本地推理模型
- 它将提示和可选的输入图像发送到配置的 Sudocode 端点
- 仅在使用初始化程序时,才会将凭据存储到 ~/.openclaw/.env 文件中
- 它将生成的图像文件和每次运行的日志写入所选输出路径附近的本地磁盘
初始化程序将这些值写入 ~/.openclaw/.env,以便后续会话可以重复使用。
远程 API 和模型命名
此技能命名为 sudocode-nano-banana2,因为它将 Sudocode 的 Nano Banana 2 图像能力打包为 OpenClaw 使用。
捆绑脚本当前调用由配置的 Sudocode 兼容端点暴露的上游模型标识符 gemini-3.1-flash-image-preview。技能名称和上游模型标识符有意不同:一个是打包的技能名称,另一个是服务当前使用的后端路由。
如果缺少 requests,请使用以下命令安装:
bash
uv pip install requests
打包与可移植性
此技能按标准技能包结构组织:
- - SKILL.md:触发元数据和操作说明
- scripts/initenv.py:首次运行环境引导辅助程序
- scripts/sudocodenano_banana2.py:捆绑的运行时脚本
请勿在可分发包中包含生成的图像、日志或其他本地运行产物。
传递生成的图像
在 OpenClaw 中使用此技能时,请使用 message 工具发送生成的文件,以便用户实际接收图像。
使用:
text
message(action=send, filePath=/absolute/path/to/output.png)
然后回复 NO_REPLY 以避免重复文本。
请勿依赖读取图像文件或将本地路径粘贴到聊天中。
错误处理
如果脚本以退出码 2 结束,请向用户转发以下消息:
text
❌ 额度不足或请求过于频繁!
👉 请前往 https://sudocode.us 登录并充值后重试。
对于其他故障,直接显示脚本输出。