img-gen

img-gen is a skill for Claude Code, Codex from zztdandan/image-generate-mcp-remote. It costs 48 tokens per session (4,118 once invoked), scanned A, original, MIT.

An image-generation and image-editing tool that calls GPT Image 2 and Nano Banana 2 through direct web requests. It reads API keys from operating-system environment variables rather than relying on an intermediary service.

In plain words
What is it for?
Use it to generate images from text prompts, edit existing images, check API-key availability, and save the resulting files with selected sizes and aspect ratios.
Why use it?
It provides a defined command-line path for creating or changing images and checks whether the required API access is configured. It avoids adding an MCP middle layer for these requests.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it to generate images from text prompts, edit existing images, check API-key availability, and save the resulting files with selected sizes and aspect ratios.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/zztdandan/image-generate-mcp-remote/img-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 zztdandan/image-generate-mcp-remote --skill img-gen
Clone the repo
git clone --depth 1 https://github.com/zztdandan/image-generate-mcp-remote

Made for: Claude Code, Codex.

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 img-gen

README.md
[![agentmods](https://agentmods.dev/badge/skills/zztdandan/image-generate-mcp-remote/img-gen/github.svg)](https://agentmods.dev/skills/zztdandan/image-generate-mcp-remote/img-gen)
Your own site
<a href="https://agentmods.dev/skills/zztdandan/image-generate-mcp-remote/img-gen"><img src="https://agentmods.dev/badge/skills/zztdandan/image-generate-mcp-remote/img-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 img-gen

Your own site · 80×15
<a href="https://agentmods.dev/skills/zztdandan/image-generate-mcp-remote/img-gen"><img src="https://agentmods.dev/badge/skills/zztdandan/image-generate-mcp-remote/img-gen.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,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.00048 $0.04118
Opus 5.5 $0.00019 $0.01647
Sonnet 5.5 $0.00010 $0.00824
Haiku 4.5 $0.00005 $0.00412

Measured 12d ago against content hash 884ba81c9d03, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

img-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 29 executable files (scripts/check_env.py, scripts/img_gen.py, scripts/lib/__init__.py, …), 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.

skills/img-gen/SKILL.md · 258 lines

How it starts

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

img-gen — 直接图像生成

通过进程环境变量读取 API key,直接发起 HTTP 请求生成/编辑图片。 不依赖 MCP 中间层,也不读取任何 .env 文件。

适用范围

  • 用户要求生成图片(GPT-Image 2.5 / Nano Banana 2)
  • 用户要求编辑已有图片
  • gpt-icon-generate 等依赖生图能力的技能的下层实现

配置门禁(先读这一节)

技能只认进程环境变量。变量由宿主在启动时注入(DSH 启动时注入,见「环境配置」), 技能自身不解析文件、不落盘、不缓存 token。

每次任务开始先跑:

python3 scripts/check_env.py        # 或 python3 scripts/img_gen.py check
  • 两个 key 都是 ✗ → 停下,不要继续。 直接告诉用户缺哪个变量,并给出可复制的 export ...(或「启动 DSH 前注入」)做法,等用户补齐后再重跑本检查。 这一条优先于其它所有步骤:不要猜 key、不要去翻别人的配置文件、不要换 provider 硬试、不要因为「上次能用」就假设这次也有。
  • 至少一个 ✓ → 继续,默认走 --preset auto。
  • 只有 nano-banana 的 key 时,generate 仍可跑 Gemini 协议 preset(--preset 显式指定, 或 auto 链里只剩 banana 路线)。

计费模型与默认路线

路线 模型名 计费 定位
便宜路线 gpt-image-2.5-vip(别名 sunburst-vip)、-flare-vip、-sunburst-vip、gpt-image-2-vip $0.03/张,按次;1K/2K/4K 与 quality 都不加价 日常唯一默认
贵路线 gpt-image-2.5-flare / -sunburst、gpt-image-2(无 -vip) 官转,按输出 token 计费,明显更贵 最后手段

规则:

  1. 默认用 --preset auto(不写 --preset 即是 auto)。auto 只走 $0.03/张 的 -vip 路线,顺序为 apiyi → laozhang,同价互为备份。
  2. 不要主动用贵路线。 贵路线 preset 标记为 tier=last_resort,只有两种入口: 显式写 preset 名,或 auto 加 --allow-expensive。CLI 命中时会打印 [!] LAST-RESORT ROUTE 警告。
  3. 只有当所有 $0.03 路线都失败(配额不足、分组饱和、5xx、超时)时才考虑 --allow-expensive;用了必须在交付说明里写明「本次走了按 token 计费的官转路线」。
  4. 参数写错(HTTP 400)不换路线重试——所有路线都会同样失败,直接改参数。

当前实测状态(2026-10-26)

  • apiyi apiyi_gpt_image_2_5_vip(gpt-image-2.5-vip)实测可用: 1280×720 + low 生成 29.9 s,2048×1152 + low 编辑 29.8 s,1280×1280 + url 响应 39.6 s,返回尺寸与请求逐像素一致。
  • 同一 key 当天早些时候曾报 403 配额不足 / insufficient_quota,随后恢复——说明该错误 是账号配额波动。auto 链遇到 403 会自动落到下一条同价路线,无需改配置。
  • laozhang 网关在 02:11 可用(27 s 出图),02:20 起对本机 TLS 直接断连 (SSL: UNEXPECTED_EOF_WHILE_READING,openssl 握手同样被 reset)。这是 laozhang 侧 的可用性问题,不是技能代码问题;laozhang 的 -vip preset 仍保留为同价备份。
  • 环境变量 IMG_GEN_GPT_IMAGE_2_OFFICIAL_PRESET 现为 apiyi_gpt_image_2_5_vip ($0.03/张)。

技能文件

所有脚本为技能自包含:

scripts/
├── img_gen.py              ← 统一 CLI(check / generate / edit),--preset auto 链路
├── check_env.py            ← 环境变量检测(缺变量时给出具体设置指引)
├── lib/
│   ├── presets.py          ← preset 目录 + tier/计费/quality/size 校验 + auto 链
│   ├── openai_images.py    ← OpenAI Images 协议(360 s 超时、url/b64 双兜底)
│   └── gemini_gen.py       ← Gemini generateContent 协议
└── presets/
    ├── gpt/    (20 个)     ← 每个 preset 一个 Python 封装
    └── banana/ (3 个)

Read the full file on GitHub · 258 lines

Files

What ships with it

33 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 Changed · +121 lines · +14 tokens per session 884ba81c9d03
  2. 2mo ago First seen · 137 lines · 34 tokens per session scan A 9d1bbab62031

Subscribe to this mod's changes

img-gen is a skill published in the GitHub repository zztdandan/image-generate-mcp-remote (0 stars, last pushed 12d ago), licensed MIT. It adds 48 tokens to every session and 4,118 once invoked, about $0.0002 per session on Opus 5.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-09-05.

Related

img-gen compared with skills from other repositories

img-gen next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
img-genzztdandan/image-generate-mcp-remoteSkill012d agoMITA48Claude Code, Codex
imagegenopenai/codexSkill134ktodayApache-2.0A113Codex
local-ai-agentsmicrosoft/ai-agents-for-beginnersSkill79kyesterdayMITA200Claude Code, Codex
playwright-climicrosoft/playwrightSkill100kyesterdayApache-2.0A19Claude Code
browser-automationopenclaw/openclawSkill394ktodayMITA36Claude Code
systematic-debuggingobra/superpowersSkill315k5d agoMITA21Claude Code
next-cache-components-adoptionvercel/next.jsSkill143ktodayMITA95Claude Code