gpt-image-gen

gpt-image-gen is a skill for Claude Code from Jxin-Cai/jxin-skills. It costs 102 tokens per session (2,118 once invoked), scanned A, original, Apache-2.0.

A tool for generating PNG images from written prompts through OpenAI's image API, with a fallback API route if the first one fails. It can save project-level settings and generated files.

In plain words
What is it for?
Use it to create illustrations, covers, posters, or presentation images from a prompt and optional style requirements. It can write the result to a chosen output path.
Why use it?
It provides one configured entry point for image generation and avoids exposing the full API key in logs. It also reuses valid settings for later requests in the same project.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: names the AskUserQuestion tool.

Part of the jxin-writing plugin — 7 skills, 6 commands shipped together

Good fit Use it to create illustrations, covers, posters, or presentation images from a prompt and optional style requirements. It can write the result to a chosen output path.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jxin-cai/jxin-skills/gpt-image-gen
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Jxin-Cai/jxin-skills --skill gpt-image-gen
Clone the repo
git clone --depth 1 https://github.com/Jxin-Cai/jxin-skills

Made for: Claude Code.

Or install jxin-writing, the plugin that ships this one along with the rest of its 7 skills, 6 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for gpt-image-gen

README.md
[![agentmods](https://agentmods.dev/badge/skills/jxin-cai/jxin-skills/gpt-image-gen/github.svg)](https://agentmods.dev/skills/jxin-cai/jxin-skills/gpt-image-gen)
Your own site
<a href="https://agentmods.dev/skills/jxin-cai/jxin-skills/gpt-image-gen"><img src="https://agentmods.dev/badge/skills/jxin-cai/jxin-skills/gpt-image-gen/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for gpt-image-gen

Your own site · 80×15
<a href="https://agentmods.dev/skills/jxin-cai/jxin-skills/gpt-image-gen"><img src="https://agentmods.dev/badge/skills/jxin-cai/jxin-skills/gpt-image-gen.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 102 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,118 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00102 $0.02118
Opus 5 $0.00051 $0.01059
Sonnet 5 $0.00020 $0.00424
Haiku 4.5 $0.00010 $0.00212

Measured 12d ago against content hash 8db17f670cfd, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

gpt-image-gen scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/config.ts, scripts/generate-image.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

writing/skills/gpt-image-gen/SKILL.md · 231 lines

How it starts

The opening of the file, as written. The whole thing — 231 lines — stays where its author put it; the contents beside it link to each section on GitHub.

GPT 图片生成器

通过 OpenAI API 调用 gpt-image-2 生成图片。优先走 Images API(/v1/images/generations),不可用时自动 fallback 到 Responses API(/v1/responses)。设计为既可被用户直接调用,也可被其他技能(如 PPT 叙事分镜技能)程序化调用。

核心能力

  • 接收提示词 + 样式要求,调用 GPT 图片模型生成 PNG
  • 双协议支持:优先 Images API,自动 fallback Responses API
  • 首次使用时保存项目级 host/key 配置
  • 后续同一项目自动复用配置
  • 支持指定输出路径,默认写入当前会话根目录的 image_output/
  • 不向日志输出完整 key

执行流程

Step 1: 检查项目配置

配置保存于调用该技能的项目/会话根目录下:

.gpt-image-gen/
├── config.json        # host、模型、默认尺寸等非敏感配置
├── credentials.json   # API key
└── .gitignore         # 忽略本目录内所有内容

先检查配置:

cd <gpt-image-gen 技能目录>
bun scripts/config.ts --check --workspace <项目根目录绝对路径>

如果配置存在且可读取,继续生成图片。

如果配置不存在,必须引导用户提供:

  1. host:API 服务地址,例如 https://api.openai.comhttps://example.com/v1
  2. key:API key

拿到 host/key 后,先验证再保存(验证时优先尝试 Images API,失败后自动尝试 Responses API):

bun scripts/config.ts \
  --set \
  --workspace <项目根目录绝对路径> \
  --host <host> \
  --key <key> \
  --image-model gpt-image-2

验证失败时不要保存配置,向用户报告脱敏后的错误原因。

Step 2: 明确生成意图

需要两个关键输入:

  1. 图片提示词(必需):描述要生成什么图片的详细文本
  2. 样式要求(可选):视觉风格、配色、布局等要求

如果用户没给提示词而是给了一段内容或文件,先把内容转化为适合图片生成的提示词。转化时:

  • 提取核心主题和关键视觉元素
  • 用英文描述视觉构图,中文只出现在标题/具体内容引用中
  • 指定比例(默认 16:9)
  • 结合用户指定的样式要求

如果用户只给了很短的模糊需求,先用 AskUserQuestion 补齐最影响结果的选项:

  • 用途:封面 / 插图 / 海报 / PPT 配图
  • 画幅:16:9 / 1:1 / 3:4 / 自定义
  • 风格:现代简约 / 商务科技 / 手绘插画 / 自定义

如果用户已经给出清晰提示词,不要为了形式强行追问。

如果用户既没有显式指定提示词文件保存目录,也没有显式指定图片输出目录,则默认使用调用该技能的会话当前根目录下的 image_output/ 作为工作目录,并在其中创建:

  • prompts/:保存生成或整理后的提示词文件
  • images/:保存最终生成的图片

不要把提示词、图片或配置写到 gpt-image-gen 技能自身目录里;技能目录只用于读取脚本。

Step 3: 构建完整提示词

将用户的图片描述和样式要求组合成一份完整提示词。如果是从其他技能调用(如 ppt-storyboard),提示词已经准备好,直接使用。

提示词保存为 .md 文件,路径由调用方指定;如果调用方未指定,则默认保存到当前会话根目录下 image_output/prompts/。图片默认保存到当前会话根目录下 image_output/images/

直接用户调用时,提示词应组织成便于预览的结构:

Generate an image based on the following description:

## Subject
...

## Composition
...

## Style
...

## Constraints
- Aspect ratio: 16:9
- No unwanted text unless explicitly requested

Read the full file on GitHub · 231 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 231 lines · 102 tokens per session scan A 8db17f670cfd

Subscribe to this mod's changes

gpt-image-gen is a skill published in the GitHub repository Jxin-Cai/jxin-skills (5 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 102 tokens to every session and 2,118 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

insight-error-page

Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…

vercel/next.js · 83 tokens