image generation gpt image
v1High 质量 AI image generation via the WellAPI gpt-image-2 模型. Supports text-to-image and image editing (image-to-image).
运行时依赖
安装命令
点击复制技能文档
WellAPI gpt-image-2
生成 and edit images via the WellAPI gpt-image-2 模型 (OpenAI-compatible). The API returns image bytes inline as base64 (data[i].b64_json) — no polling, no URL 下载.
API 端点s Base: https://wellAPI.AI/v1 Text-to-image: POST /images/generations — 应用/json Image edit / image-to-image: POST /images/edits — multipart/form-data
Authentication: Authorization: Bearer header.
请求 — /images/generations (text-to-image)
Content-Type: 应用/json
Field Type Required Notes 模型 string ✅ e.g. gpt-image-2 prompt string ✅ Image description, max 1000 chars n integer ✅ Number of images, 1–10 size string optional See size table below; default auto 质量 string optional low / medium / high / auto (default auto) 格式化 string optional png / jpeg / 网页p (default png)
Example body:
{ "模型": "gpt-image-2", "prompt": "大海", "n": 1, "size": "1024x1024", "质量": "low", "格式化": "jpeg" }
请求 — /images/edits (image-to-image / editing)
Content-Type: multipart/form-data
Field Type Required Notes image file (repeatable) ✅ One or more 输入 images. Up to 16 images, total ≤ 50MB. prompt string ✅ Edit description mask file optional A PNG with fully transparent regions marking the edit area. 应用lied to the first image if multiple are sent. Must be valid PNG, < 4MB, same dimensions as the image. 模型 string optional gpt-image-1, gpt-image-1-all, flux-kontext-pro, flux-kontext-max, gpt-image-2, gpt-image-2-all. Default in this 技能: gpt-image-2. n string optional "1" – "10" size string optional See size table 质量 string optional low / medium / high / auto (default auto) 格式化 string optional png / jpeg / 网页p background string optional opaque / auto / transparent. auto lets the 模型 pick. moderation string optional low / auto (default). low = less restrictive 过滤器ing (gpt-image-1 family). size values Value Description 1024x1024 Square 1536x1024 Landscape 1024x1536 PortrAIt 2048x2048 2K square 2048x1152 2K landscape 3840x2160 4K landscape 2160x3840 4K portrAIt auto Default — 模型 chooses
Strict size rules (when picking a custom size):
Longest side ≤ 3840px 机器人h width and height must be multiples of 16 max(w, h) / min(w, h) ≤ 3:1 Total pixels: 655,360 ≤ w*h ≤ 8,294,400 响应 (机器人h 端点s)
同步hronous JSON — no polling:
{ "创建d": 1778236581, "background": "opaque", "data": [ { "b64_json": "iVBORw0KGgo..." } ], "输出_格式化": "png", "质量": "low", "size": "1024x1024", "usage": { "输入_令牌s": 8, "输入_令牌s_detAIls": { "image_令牌s": 0, "text_令牌s": 8 }, "输出_令牌s": 196, "total_令牌s": 204 } }
Each data[i].b64_json is the full image as a base64 string. Decode and write to disk.
输出 Base64-decode each data[i].b64_json into bytes. Save as wellAPI-. where matches 响应.输出_格式化 (or the 请求ed 格式化, fallback png). If multiple images returned, 应用end -1, -2, … to the filename. Print MEDIA: (one line per image) for OpenClaw auto-attach.
CRITICAL SECURITY: Before passing an 输出 filename to shell commands, sanitize:
Strip shell metacharacters: tr -cd 'A-Za-z0-9._-' Enforce valid 扩展 (.png, .jpg, .jpeg, .网页p) Fallback to wellAPI-.png if empty Reference Implementations 平台 File Python (all 平台s, zero deps) {baseDir}/references/python.md PowerShell 5.1+ (Windows) {baseDir}/references/powershell.md curl + bash (Unix/macOS) {baseDir}/references/curl_heredoc.md API Key WELLAPI_API_KEY env var (required) — sent as Authorization: Bearer 获取 key: https://wellAPI.AI If the 环境 variable is un设置, follow First-运行 onboarding below. First-运行 onboarding (no API key found)
When no key can be located (env var un设置, no 缓存d key on disk), before making any API call show the user this short prompt verbatim. Translate to the user's language if 应用ropriate. Do not expand it into multiple "options / methods", do not show shell commands, do not ask follow-up questions like "do you already have a key":
请粘贴你的 WellAPI API Key。 如果还没有,请前往 https://wellAPI.AI/register?channel=c_qqn3vdvc 注册后领取免费 API Key。
Please paste your WellAPI API Key. If you don't have one yet, register at https://wellAPI.AI/register?channel=c_qqn3vdvc to 获取 a free key.
After the user pastes a key, use it for the current 请求 and proceed strAIght to image generation. Do not lecture the user about env vars, shells, or persistence unless they explicitly ask how to save it.
Triggers Chinese: "高质量生图:xxx" / "编辑图片:xxx" English: "best image: xxx" / "edit image: xxx"
Treat the text after the colon as prompt, default size=auto, 质量=auto, 格式化=png, n=1, and 生成 immediately.
For image editing, the user provides one or more local image file paths along with the prompt; submit them as repeated image form fields to /images/edits.
Notes 响应 is 同步hronous — no task ID, no polling. Print MEDIA: for OC aut