# Gpt Image2

> Generate images with GPT Image 2 through a local OpenAI-compatible Images API script, then deliver them through OpenClaw chat channels such as Telegram or QQBot. Use when the user asks to generate, draw, create, or send an image, poster, photo, illustration, wallpaper, avatar, icon, logo, 文生图, 生成图片, 画图, 海报, 照片, 发我图片, or similar visual output requests.

- Skill: `zouchenzhen/gpt-image2` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add zouchenzhen/gpt-image2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/zouchenzhen/gpt-image2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Design & Media
- Author: zouchenzhen (https://skillmd.com/u/zouchenzhen)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/zouchenzhen/gpt-image2

---


# GPT Image 2

## Overview

Use this skill to generate images from chat with `gpt-image-2` through a local PowerShell script:

```powershell
scripts/generate_gpt_image2.ps1
```

The script calls an OpenAI-compatible `/v1/images/generations` endpoint, saves a PNG locally, and optionally sends it through Telegram or emits a QQBot media payload.

Do not use or mention nonexistent `image_gen`, `openai-image-gen`, or `nano-banana-pro` tools. Do not send `gpt-image-2` image requests to a chat/completions endpoint.

## Resolve Script Path

If the current directory is not this skill folder, resolve the script path from OpenClaw:

```powershell
$skillFile = (openclaw skills info gpt-image2 | Select-String 'Path:' | ForEach-Object { ($_ -split 'Path:\s*', 2)[1].Trim() } | Select-Object -First 1)
$script = Join-Path (Split-Path -Parent $skillFile) 'scripts/generate_gpt_image2.ps1'
```

## Channel Workflow

Choose the delivery mode from the active channel or from the user's wording.

For Telegram delivery, run:

```powershell
pwsh -NoProfile -File $script -Prompt "<image prompt>" -SendTelegram -TelegramTarget "<telegram chat id>" -Caption "<short caption>"
```

If `-TelegramTarget` is omitted, the script reads `OPENCLAW_TELEGRAM_TARGET`. If neither exists, report the error instead of pretending the image was sent.

For QQBot image replies, run:

```powershell
pwsh -NoProfile -File $script -Prompt "<image prompt>" -EmitQQPayload -Caption "<short caption>"
```

Then make the final response exactly the `QQBOT_PAYLOAD:` block printed by the script, with no extra text before or after it.

For local generation without sending, run:

```powershell
pwsh -NoProfile -File $script -Prompt "<image prompt>"
```

Then return the saved file path.

## Provider Configuration

By default the script reads `~/.openclaw/openclaw.json` and uses provider id `cpamc`, which can be changed with `-ProviderId` or `OPENCLAW_IMAGE_PROVIDER`.

Use one of these patterns:

```powershell
pwsh -NoProfile -File $script -Prompt "<prompt>" -ProviderId "cpamc"
pwsh -NoProfile -File $script -Prompt "<prompt>" -ProviderId "openai"
pwsh -NoProfile -File $script -Prompt "<prompt>" -BaseUrl "https://api.openai.com/v1" -ApiKeyEnv "OPENAI_API_KEY"
```

Never print API keys, bot tokens, or full private config contents.

## Prompting

Expand short user requests into a concrete visual prompt before calling the script. Preserve required subjects, locations, text, style, aspect, and language from the user's request.

Use `-Size 1024x1024` unless the user asks for another supported size.

## Failure Handling

If the script reports a provider, network, timeout, configuration, or delivery error, include the actionable error. Do not produce an empty answer or a verbal promise without a successful script result.

