# OpenClaw GPT Image 2 Skill
Generate images from OpenClaw conversations with `gpt-image-2`, save them locally, and send them through Telegram or QQBot.
This is a small, auditable skill for users who already have an OpenAI-compatible Images API endpoint configured in `~/.openclaw/openclaw.json`, or who want to pass `-BaseUrl` and an API key environment variable directly.
## What it includes
- `SKILL.md`: OpenClaw skill instructions and trigger description.
- `scripts/generate_gpt_image2.ps1`: PowerShell script that calls `/v1/images/generations`.
- `agents/openai.yaml`: optional UI metadata.
No API keys, bot tokens, chat IDs, or provider secrets are included.
## Install
Copy this folder into an OpenClaw skills directory:
```powershell
Copy-Item -Recurse . "$env:USERPROFILE\.openclaw\skills\gpt-image2"
openclaw skills info gpt-image2
```
Or install it as a workspace skill:
```powershell
Copy-Item -Recurse . "E:\Openclaw_Workspace\skills\gpt-image2"
openclaw skills info gpt-image2
```
Restart the OpenClaw gateway or start a new conversation so the agent sees the new skill.
## Configure
The script can read a provider from `~/.openclaw/openclaw.json`:
```json
{
"models": {
"providers": {
"cpamc": {
"baseUrl": "https://example.com/v1",
"apiKey": "..."
}
}
}
}
```
Then run:
```powershell
pwsh -NoProfile -File .\scripts\generate_gpt_image2.ps1 -Prompt "A clean travel poster for Zhengzhou, China" -ProviderId cpamc
```
You can also avoid storing the API key in OpenClaw config:
```powershell
$env:OPENAI_API_KEY = "sk-..."
pwsh -NoProfile -File .\scripts\generate_gpt_image2.ps1 `
-Prompt "A clean travel poster for Zhengzhou, China" `
-BaseUrl "https://api.openai.com/v1" `
-ApiKeyEnv "OPENAI_API_KEY" `
-ProviderId openai
```
## Telegram
Set a target chat ID once:
```powershell
$env:OPENCLAW_TELEGRAM_TARGET = "123456789"
```
Generate and send:
```powershell
pwsh -NoProfile -File .\scripts\generate_gpt_image2.ps1 `
-Prompt "A clean travel poster for Zhengzhou, China" `
-SendTelegram `
-Caption "郑州旅游海报"
```
## QQBot
Generate and emit a structured payload:
```powershell
pwsh -NoProfile -File .\scripts\generate_gpt_image2.ps1 `
-Prompt "A clean travel poster for Zhengzhou, China" `
-EmitQQPayload `
-Caption "郑州旅游海报"
```
The agent should return the printed `QQBOT_PAYLOAD:` block exactly, with no extra text.
## Security
- Do not commit `~/.openclaw/openclaw.json`, `.env`, generated images, chat IDs, or tokens.
- Review any third-party image skill before installing it. Skills can run local commands and access files.
- This script only sends the prompt to the configured image provider endpoint.
## License
MIT