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, picture, illustration, artwork, photo, or visual from a textual description. Handles API key onboarding, authenticated requests to https://wellapi.ai/v1/images/generations, and decoding the returned base64 image into a local file.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "gpt-image-2-generation" with this command: npx skills add laolujava/gpt-image-2-generation

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 <key>, decodes the base64 image, and writes the file.

Required argument

FlagMeaning
--promptThe text description of the image to generate.

Optional arguments (defaults match the WellAPI example)

FlagDefaultAllowed values
--n1integer, number of images
--size1024x1024e.g. 512x512, 1024x1024, 1024x1536, 1536x1024
--qualitylowlow, medium, high
--formatjpegjpeg, png, webp
--modelgpt-image-2model name
--output./gpt-image-2_<timestamp>.<format>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 <WELLAPI_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.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Picnow — Image Generation

Generate high-quality images via Picnow (api.letmego.top). Activate when the user wants to create, generate, draw, or design images — including product photo...

Registry SourceRecently Updated
660Profile unavailable
General

VVMAI Image Generator

Generate images via VVMAI's OpenAI-compatible Images API. Supports nano-banana and gpt-image model series. Default model is nano-banana-pro. Images are NOT s...

Registry SourceRecently Updated
3301Profile unavailable
General

Doubao Maliang Image Gen

小马良-豆包生图。Generate images with Doubao Seedream via Volcano Engine ARK. Supports Seedream 5.0 and other models. Use when the user invokes 小马良 or requests Douba...

Registry SourceRecently Updated
3120Profile unavailable
General

aesthetic-copilot

Use when the user wants to generate high-fidelity PROMPTS for Text-to-Image models (Flux, Ideogram, Midjourney) based on vague layout/content descriptions.

Registry SourceRecently Updated
2360Profile unavailable