← 返回 Skills 市场
chenzihao0731

zeroHub Image API

作者 chenzihao · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
37
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install zerohub-image-api
功能描述
zeroHub 图片生成 API Skill。使用用户提供的 ZEROHUB_API_KEY 查询余额、提交图片生成任务、轮询结果,并可将生成图片下载到用户指定目录后发送。
使用说明 (SKILL.md)

zeroHub Image API Skill

什么时候用

当用户希望通过 zeroHub API 生成图片、查询账户余额、验证 sk-img-... API Key、轮询生成任务,或把生成结果保存到本地目录后再发送时,使用本 skill。

本 skill 面向通用分发场景设计:API Key 由用户自行提供,生成结果通过 zeroHub 返回的 URL 获取,并保存到用户指定的输出目录。

关于 zeroHub

zeroHub 是一个面向开发者和自动化工作流的图片生成 API 服务,提供统一的图片生成接口、任务查询接口和余额查询接口,适合在 Agent、脚本、工作流或业务系统中接入图像生成能力。

  • 官网:https://zerohub.zhyy.ltd
  • API 文档:https://zerohub.zhyy.ltd/docs

功能

  • 查询 zeroHub 账户余额;
  • 提交文生图 / 图生图生成任务;
  • 轮询任务状态直到成功、失败或超时;
  • 自动处理 zeroHub 返回的相对图片 URL;
  • 将生成图片下载到用户指定目录;
  • 输出结构化 JSON,方便后续发送文件或继续自动化处理。

服务信息

  • Base URL 默认:https://zerohub.zhyy.ltd
  • API 文档:https://zerohub.zhyy.ltd/docs
  • 认证方式:Authorization: Bearer \x3CZEROHUB_API_KEY>
  • 默认模型:gpt-image-2
  • 主要接口:
    • GET /v1/user/balance
    • POST /v1/images/generations
    • GET /v1/images/query/{task_id}

安全要求

  1. 不要在 skill、脚本、日志或回复中写入真实 API Key。
  2. API Key 应由用户通过环境变量 ZEROHUB_API_KEY 提供。
  3. 执行 shell 命令前建议使用 set +x,避免命令回显泄露 Key。
  4. 生成任务可能产生费用;提交生成前应确认用户确实想要生成图片。
  5. 下载目录应由用户明确指定;不要擅自写入不确定的位置。
  6. 如果用户没有提供 API Key,应提示其先配置 ZEROHUB_API_KEY

推荐流程

1. 查询余额

set +x
export ZEROHUB_API_KEY='\x3Cuser-provided-key>'

./scripts/zerohub_image_public.py balance

2. 生成图片并下载到指定目录

set +x
export ZEROHUB_API_KEY='\x3Cuser-provided-key>'

./scripts/zerohub_image_public.py generate \
  --prompt 'A small red lobster mascot sitting on a lotus leaf, cute sticker style' \
  --size '1:1' \
  --quality low \
  --output-dir './outputs' \
  --download

脚本会:

  1. 提交图片生成请求;
  2. 解析返回的 task_id
  3. 按间隔轮询任务状态;
  4. 成功后读取 images / preview_images
  5. 将相对 URL 补全为完整 URL;
  6. 下载图片到 --output-dir
  7. 输出 JSON,包含 task_idstatusimagesdownloaded_files 等字段。

3. 只下载已有图片 URL

./scripts/zerohub_image_public.py download \
  --output-dir './outputs' \
  'https://zerohub.zhyy.ltd/api/image-gen/v1/images/assets/xxx'

常用参数

generate

  • --prompt:生成提示词,必填。
  • --model:模型名,默认 gpt-image-2
  • --size:图片比例或尺寸,默认 1:1
  • --quality:质量,可选 autolowmediumhigh,默认 low
  • --images:参考图 URL,支持多个。
  • --max-wait:最长等待秒数,默认 180
  • --interval:轮询间隔秒数,默认 5
  • --download:生成成功后下载图片。
  • --output-dir:下载目录,使用 --download 时必填。
  • --no-preview-download:只下载正式图片,不下载预览图。

download

  • --output-dir:下载目录,必填。
  • --prefix:输出文件名前缀,默认 zerohub-image
  • urls:一个或多个图片 URL。

发送结果

脚本输出的 downloaded_files 是一个数组。每一项通常包含:

{
  "ok": true,
  "url": "https://...",
  "path": "./outputs/zerohub-task-1.png",
  "filename": "zerohub-task-1.png",
  "content_type": "image/png",
  "size": 123456
}

后续可以使用当前运行环境提供的文件发送能力,把 path 对应的本地文件发送给用户。

注意

  • zeroHub 返回的图片可能是相对 URL,例如 /api/image-gen/v1/images/assets/\x3Ctoken>;脚本会自动基于 ZEROHUB_BASE_URL 补全。
  • 可以通过环境变量 ZEROHUB_BASE_URL 覆盖默认服务地址。
  • 下载目录会自动创建。
  • 文件名会进行安全清理,避免路径穿越。
  • 如果下载失败,JSON 中会保留失败 URL 和错误信息,方便用户手动处理或重试。
安全使用建议
Install only if you are comfortable giving the skill your zeroHub API key and letting it make outbound network requests and save files in a directory you choose. Avoid using the download command with untrusted URLs, and prefer running it in a restricted environment because it does not currently enforce zeroHub-only hosts, private-network blocking, or download size limits.
能力标签
requires-sensitive-credentials
能力评估
Purpose & Capability
The documented purpose is to use a user-provided zeroHub API key to query balance, generate images, poll tasks, and optionally download image outputs; the script implements those functions directly.
Instruction Scope
The standalone download command accepts any user-supplied URL, and generated-result downloads trust URLs returned by the remote API; the artifacts do not limit downloads to zeroHub hosts or image content.
Install Mechanism
The package contains a markdown skill file, metadata, and one Python helper script with no declared third-party dependencies or install-time execution.
Credentials
Use of ZEROHUB_API_KEY, outbound API calls, and writing to a user-selected output directory are disclosed and proportionate to the image-generation workflow.
Persistence & Privilege
The script creates the requested output directory and writes downloaded response bodies to disk, but it reads the entire response without a size cap and does not validate that fetched targets are public zeroHub image assets.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install zerohub-image-api
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /zerohub-image-api 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: zeroHub image generation helper with balance query, task polling, and URL download to user-selected output directory.
元数据
Slug zerohub-image-api
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

zeroHub Image API 是什么?

zeroHub 图片生成 API Skill。使用用户提供的 ZEROHUB_API_KEY 查询余额、提交图片生成任务、轮询结果,并可将生成图片下载到用户指定目录后发送。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 37 次。

如何安装 zeroHub Image API?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install zerohub-image-api」即可一键安装,无需额外配置。

zeroHub Image API 是免费的吗?

是的,zeroHub Image API 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

zeroHub Image API 支持哪些平台?

zeroHub Image API 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 zeroHub Image API?

由 chenzihao(@chenzihao0731)开发并维护,当前版本 v1.0.0。

💬 留言讨论