Token导航 LogoToken导航TokenDH.com
图像处理敏感数据clawhub未标认证来源可访问clear审计提醒

gpt-image-2-apiGPT 图像 2 API

Agent Skill

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

总安装

2,596

周安装

104

GitHub Stars

公开资料未说明

下载量

840
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:gpt-image-2-api(GPT 图像 2 API)
来源仓库:https://github.com/jancong/gpt-image-2-api
安装命令:
openclaw skills install gpt-image-2-api
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install gpt-image-2-api

简介

用于通过 OpenAI gpt-image-2 模型生成与编辑图像,独立于特定代理框架。

  • 适合在 OpenClaw 中与 Hermes、Claude Code 等工具配合使用。
  • 支持协作提示词与变体生成,适配多种工作流需求。
  • 使用时需确保 API 密钥有效并遵守 OpenAI 内容政策。
  • gpt-image-2-api 属于图像处理类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

name
gpt-image-2
description
Generate and edit images via OpenAI gpt-image-2 model. Agent-agnostic CLI — works with any AI agent (Hermes, Claude Code, Codex, OpenClaw, etc.). Supports configurable base_url/api_key, text-to-image and image-to-image editing.
version
2.0.0
author
AI Agent Toolkit
license
MIT
metadata
tags
[image, generation, openai, gpt-image-2, text-to-image, image-editing, agent-agnostic]
related_skills
[gemini-image-gen]

gpt-image-2

Generate and edit images via OpenAI's gpt-image-2 model. Agent-agnostic — designed to work with any AI agent or standalone from the command line.

Quick Start

# 1. Initialize config (one-time)
python3 gpt_image2.py config --init

# 2. Edit the config to set your API key
#    ~/.config/gpt-image-2/config.json

# 3. Generate
python3 gpt_image2.py generate "A cute cat on a windowsill" -o ~/cat.png --quality low

# 4. Edit
python3 gpt_image2.py edit input.png "Change the sofa to green" -o ~/output.png

Configuration

Config priority: --config flag > --base-url/--api-key flags > config file > environment variables > defaults.

Config File Locations (in priority order)

PriorityPathNotes
1$XDG_CONFIG_HOME/gpt-image-2/config.jsonXDG standard (recommended)
2~/.config/gpt-image-2/config.jsonDefault XDG fallback
3~/.gpt-image-2-config.jsonSingle-file fallback
4~/.hermes/gpt-image-2-config.jsonLegacy Hermes compat

Use python3 gpt_image2.py config --show to see which config is active.

Config File Format

{
  "base_url": "https://api.openai.com/v1",
  "api_key_env": "OPENAI_API_KEY"
}
FieldTypeDescription
base_urlstringAPI base URL. Default: https://api.openai.com/v1
api_keystringPlaintext API key (not recommended — visible in file)
api_key_envstringEnvironment variable name holding the key (recommended)

Environment Variables (fallback when no config file)

VariablePurpose
GPT_IMAGE2_API_KEYAPI key
GPT_IMAGE2_BASE_URLAPI base URL

Config Management Commands

# Create template config
python3 gpt_image2.py config --init

# Show active config (keys are masked)
python3 gpt_image2.py config --show

# Overwrite config
python3 gpt_image2.py config --init --force

CLI Reference

generate — Text-to-Image

python3 gpt_image2.py generate "prompt" [options]
OptionDefaultDescription
-o, --output~/gpt-image2-output.pngOutput file path
--qualityautolow (~70s), medium (~120s), high (~276s)
--sizeauto1024x1024, 1536x1024, 1024x1536
--formatpngpng, jpeg, webp
--n1Number of images (1-10)
--timeout600curl timeout in seconds
--configauto-detectExplicit config file path
--base-urlfrom configOverride API base URL
--api-keyfrom configOverride API key (visible in ps!)

edit — Image-to-Image

python3 gpt_image2.py edit <image_path> "edit prompt" [options]
OptionDefaultDescription
--masknonePNG mask (transparent=edit area)
--moderationautolow or auto
(all generate options also apply)

config — Manage Configuration

python3 gpt_image2.py config [--init] [--show] [--force] [--config PATH]

Script Location

The script is at scripts/gpt_image2.py relative to this skill directory.

To find it programmatically from any agent:

# If installed as a Hermes skill:
SCRIPT="$(dirname "$(readlink -f "$0")")/../skills/creative/gpt-image-2/scripts/gpt_image2.py"

# Or copy/symlink it anywhere — it's self-contained with zero dependencies beyond stdlib + curl
cp scripts/gpt_image2.py /usr/local/bin/gpt-image2

The script has zero pip dependencies — only Python 3.8+ stdlib and curl.

API Reference

Generations (Text-to-Image)

ItemValue
EndpointPOST {base_url}/images/generations
AuthAuthorization: Bearer {api_key}
Content-Typeapplication/json

Edits (Image-to-Image)

ItemValue
EndpointPOST {base_url}/images/edits
AuthAuthorization: Bearer {api_key}
Content-Typemultipart/form-data

Parameters

Generations (JSON body):

ParamTypeRequiredDescription
modelstringyesgpt-image-2
promptstringyesText description
nintnoNumber of images (default 1)
sizestringno1024x1024, 1536x1024, 1024x1536
qualitystringnolow, medium, high (default auto)
formatstringnopng, jpg, webp (default png)

Edits (form-data):

ParamTypeRequiredDescription
modelstringyesgpt-image-2
promptstringyesEdit instruction
imagefileyesSource image (PNG, max 4 images)
nintnoNumber of outputs (default 1)
sizestringno1024x1024, 1536x1024, 1024x1536, or auto
qualitystringnolow, medium, high (default auto)

Agent Integration Guide

This skill is designed to be agent-agnostic. Any AI agent can use it by:

  1. Locate the script: Find gpt_image2.py in the skill's scripts/ directory
  2. Call via shell: python3 <path>/gpt_image2.py generate "prompt" -o output.png
  3. Parse stdout: The script prints Saved: <path> (<size> KB) on success

Integration Examples

Hermes / Claude Code / Codex / OpenClaw:

python3 /path/to/gpt-image-2/scripts/gpt_image2.py generate "prompt" -o output.png --quality low

From Python (any agent):

import subprocess, json
result = subprocess.run(
    ["python3", script_path, "generate", prompt, "-o", output_path, "--quality", "low"],
    capture_output=True, text=True, timeout=600
)
# Parse result.stdout for "Saved: <path>"

From Node.js / TypeScript:

const { execSync } = require('child_process');
const output = execSync(`python3 ${scriptPath} generate "${prompt}" -o ${outputPath}`);
// Parse output.toString() for "Saved: ..."

Workflow: Agent Generates Images

  1. Always use the CLI script — handles config resolution, auth security, and response parsing
  2. Use low quality for drafts, high quality for final output
  3. For edits: --size auto preserves original dimensions (recommended)
  4. The script outputs: HTTP status, time elapsed, output file path and size
  5. Parse the output: look for Saved: <path> lines to find generated files

Workflow: Agent Edits Existing Images

  1. Save or locate the source image path
  2. Call gpt_image2.py edit <image_path> "<edit_prompt>" --output <output_path>
  3. Edit endpoint can accept up to 4 images via repeated --image flags
  4. Use --size auto to preserve original dimensions

Important Pitfalls

  1. --api-key flag is visible in shell history and ps aux — prefer config file (api_key_env) or environment variables.
  2. The edits endpoint does NOT support response_format — always returns b64_json regardless.
  3. gpt-image-2 generations may time out on some relay endpoints — use --timeout flag (default 600s).
  4. Prompt with special characters — the script writes prompts to temp files internally, avoiding shell escaping issues. No need to worry about quoting.
  5. Authorization header is never passed via -H — the script uses curl -K temp config file, deleted immediately after use. Keys never appear in ps aux.
  6. Config file permissions — the script warns if config has group/other read permissions. Run chmod 600 <config> to fix.
  7. Zero pip dependencies — the script only requires Python 3.8+ stdlib and curl. No installation step needed.
  8. Chinese text in prompts may not render correctly — gpt-image-2's Chinese rendering is unstable; it often ignores Chinese constraints and outputs English text in images. Consider using Gemini for Chinese text rendering.

适合场景

01

文本生成图片

02

图片风格化

03

产品图和创意图

04

需要 FLUX 模型时

能力概览

能力 1

调用 FLUX 图像模型

能力 2

支持文本生图和图像改写

能力 3

覆盖 LoRA 或风格适配

能力 4

适合创意视觉生成

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

77.25%
按下载量换算649

安全审计

VirusTotal

通过

ClawScan

可疑

Static analysis

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills