← 返回 Skills 市场
laolujava

gpt image 2 generation

作者 LuTong · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
14
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install gpt-image-2-generation
功能描述
Generate images from text prompts using the WellAPI gpt-image-2 model. Use this skill whenever the user asks to create, draw, render, or generate an image, p...
使用说明 (SKILL.md)

gpt-image-2-generation

Generate images from natural-language prompts using the gpt-image-2 model hosted at WellAPI. The skill calls POST https://wellapi.ai/v1/images/generations, decodes the returned b64_json, and writes the image to disk.

When to use

Trigger this skill when the user asks for things like:

  • "Generate an image of a sunset over the ocean"
  • "Draw a cat wearing a top hat"
  • "Create a 1024x1024 picture of …"
  • "Make an illustration / poster / artwork of …"
  • Any other request to produce a visual from a textual description.

If the user asks for image editing (in-painting, variations, etc.), this skill currently only covers text-to-image generation; tell the user so.

Prerequisites

  1. API key — The user must supply a WellAPI key.
    • If the environment variable WELLAPI_API_KEY is set, it will be used.
    • Otherwise the skill looks for a local config file:
      • Linux/macOS: ~/.config/gpt-image-2-generation/config.json
      • Windows: %USERPROFILE%\.config\gpt-image-2-generation\config.json
    • If neither is present, the skill prompts the user to register and enter a key (see First-run onboarding below).
  2. Python 3.7+ with the standard library only (no third-party packages required).

First-run onboarding (no API key found)

When no key can be located, before making any API call tell the user verbatim (translate to the user's language if appropriate):

使用本技能需要一个免费的 WellAPI API Key。请前往 https://wellapi.ai/register?aff=DTDH 注册账号并领取免费 API Key,然后把它粘贴到下方。

To use this skill you need a free WellAPI API key. Please register at https://wellapi.ai/register?aff=DTDH to obtain one, then paste it below.

Then call the helper script to securely store the key:

python3 scripts/setup_api_key.py

The script will prompt the user for the key on stdin and persist it to the per-user config file with 0600 permissions. Never echo or log the full key after it is captured.

How to generate an image

Use the bundled script scripts/generate_image.py. It accepts CLI arguments, builds the request, sends it with Authorization: Bearer \x3Ckey>, decodes the base64 image, and writes the file.

Required argument

Flag Meaning
--prompt The text description of the image to generate.

Optional arguments (defaults match the WellAPI example)

Flag Default Allowed values
--n 1 integer, number of images
--size 1024x1024 e.g. 512x512, 1024x1024, 1024x1536, 1536x1024
--quality low low, medium, high
--format jpeg jpeg, png, webp
--model gpt-image-2 model name
--output ./gpt-image-2_\x3Ctimestamp>.\x3Cformat> output file path. When --n > 1, an index suffix is added.
--api-key (auto) overrides env / config file

Example invocations

# Minimal
python3 scripts/generate_image.py --prompt "大海"

# Custom size + format + output path
python3 scripts/generate_image.py \
  --prompt "A futuristic city skyline at dusk, cyberpunk style" \
  --size 1024x1024 \
  --quality high \
  --format png \
  --output ./city.png

The script prints the absolute path(s) of the saved image(s) on success and exits non-zero on failure.

Request / response contract

Request body sent to https://wellapi.ai/v1/images/generations:

{
  "model": "gpt-image-2",
  "prompt": "大海",
  "n": 1,
  "size": "1024x1024",
  "quality": "low",
  "format": "jpeg"
}

Headers

Authorization: Bearer \x3CWELLAPI_API_KEY>
Content-Type: application/json

Response (the image is in data[i].b64_json):

{
  "created": 1778236581,
  "data": [{ "b64_json": "iVBORw0KGg..." }],
  "output_format": "png",
  "quality": "low",
  "size": "1024x1024",
  "usage": { "input_tokens": 8, "output_tokens": 196, "total_tokens": 204 }
}

The skill base64-decodes each b64_json entry and writes the bytes to disk using output_format (or the requested --format) as the file extension.

Workflow for the agent

  1. Parse the user's image request → extract prompt, and any explicit size, quality, format, n.
  2. Resolve the API key (env → config file → prompt user via scripts/setup_api_key.py).
  3. Run scripts/generate_image.py with the parsed arguments.
  4. Report the saved file path(s) to the user. If running in an environment that can render images, also display the result.
  5. On HTTP errors, surface the upstream error message verbatim and suggest checking the API key, quota, or prompt content.

Files in this skill

  • SKILL.md — this file (metadata + instructions)
  • scripts/generate_image.py — performs the generation
  • scripts/setup_api_key.py — interactive helper to store the API key
  • scripts/api_key.py — shared helpers for locating/loading the key
  • README.md — marketplace listing
  • LICENSE — MIT license

Security notes

  • The API key is stored locally in the user's home directory with 0600 permissions and is never committed, logged, or echoed.
  • All network traffic goes only to https://wellapi.ai.
  • The skill does not execute or evaluate any data returned by the API beyond base64-decoding the image bytes.
安全使用建议
Before installing, make sure you are comfortable creating or using a WellAPI account, sending image prompts to WellAPI, and storing a WellAPI API key locally. Use a dedicated key if possible, avoid secrets in prompts, and choose safe output paths for generated images.
功能分析
Type: OpenClaw Skill Name: gpt-image-2-generation Version: 1.0.0 The skill is a functional image generation tool for the WellAPI service, containing scripts for API key management (scripts/api_key.py) and image processing (scripts/generate_image.py). It follows security best practices such as restricted file permissions (0600) for secrets and lacks any indicators of malicious intent, data exfiltration, or unauthorized execution. The inclusion of an affiliate link (aff=DTDH) in the onboarding instructions within SKILL.md and README.md is a monetization tactic but does not pose a security risk.
能力标签
requires-oauth-tokenrequires-sensitive-credentials
能力评估
Purpose & Capability
The artifacts consistently implement the stated purpose: SKILL.md describes posting text prompts to WellAPI, decoding returned base64 image data, and saving image files locally.
Instruction Scope
The workflow is limited to user-requested text-to-image generation, API-key onboarding, running the bundled generation script, and reporting saved file paths; no hidden autonomous behavior is shown.
Install Mechanism
There is no package install step, but the registry metadata lists no required binaries while SKILL.md and the bundled scripts require python3; the source/homepage are also not provided, so users should rely on reviewing the included scripts.
Credentials
Network access to WellAPI, filesystem writes for generated images, and use of a WellAPI API key are expected and disclosed for this purpose, but prompts and authentication leave the local environment.
Persistence & Privilege
The skill can persist the WellAPI API key in a per-user config file with restricted permissions; this is purpose-aligned but still sensitive account material.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install gpt-image-2-generation
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /gpt-image-2-generation 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of gpt-image-2-generation skill. - Generate images from text prompts using the WellAPI gpt-image-2 model. - Handles API key onboarding, environment/config lookup, and secure storage. - Runs image generation via bundled Python script and saves output locally. - Supports user-specified options for size, quality, format, and multiple images. - Reports errors clearly and guides user through API key setup.
元数据
Slug gpt-image-2-generation
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

gpt image 2 generation 是什么?

Generate images from text prompts using the WellAPI gpt-image-2 model. Use this skill whenever the user asks to create, draw, render, or generate an image, p... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 14 次。

如何安装 gpt image 2 generation?

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

gpt image 2 generation 是免费的吗?

是的,gpt image 2 generation 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

gpt image 2 generation 支持哪些平台?

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

谁开发了 gpt image 2 generation?

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

💬 留言讨论