gemini-image-gen

gemini-image-gen is a skill for Claude Code from Jxin-Cai/jxin-skills. It costs 76 tokens per session (1,513 once invoked), scanned A, original, Apache-2.0.

An image-generation tool that turns a written description and optional style instructions into an image using Google Gemini. It can be used directly or by other add-ons.

In plain words
What is it for?
Use it to create illustrations, covers, posters, flowcharts, mind maps, or other images from text, including Chinese prompts.
Why use it?
It removes the need to create images manually or handle the image-generation service yourself. It can also turn supplied content into a suitable image prompt.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

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

Good fit Use it to create illustrations, covers, posters, flowcharts, mind maps, or other images from text, including Chinese prompts.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jxin-cai/jxin-skills/gemini-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 gemini-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 gemini-image-gen

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/jxin-cai/jxin-skills/gemini-image-gen"><img src="https://agentmods.dev/badge/skills/jxin-cai/jxin-skills/gemini-image-gen.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 76 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,513 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.00076 $0.01513
Opus 5 $0.00038 $0.00757
Sonnet 5 $0.00015 $0.00303
Haiku 4.5 $0.00008 $0.00151

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

Security

Grade A, and why

gemini-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 28 executable files (scripts/gemini-webapi/client.ts, scripts/gemini-webapi/components/gem-mixin.ts, scripts/gemini-webapi/components/index.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/gemini-image-gen/SKILL.md · 143 lines

How it starts

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

Gemini 图片生成器

通过 Gemini Web API 生成高质量图片的专用技能。设计为既可被用户直接调用,也可被其他技能(如叙事分镜技能)程序化调用。

核心能力

  • 接收提示词 + 样式要求,调用 Gemini 生成图片
  • 内置频率控制,防止 API 被风控
  • 自动处理 Google 账号登录(首次使用弹浏览器,后续自动复用;显式 profile 时优先使用指定 profile)
  • 完美支持中文提示词

执行流程

Step 1: 确认输入

需要两个关键输入:

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

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

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

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

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

不要把提示词或图片写到 gemini-image-gen 技能自身目录里;技能目录只用于读取脚本和参考资料。

Step 2: 构建完整提示词

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

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

Step 3: 展示提示词并确认

直接用户调用时:展示提示词预览,等用户确认或修改后再生成。

被其他技能调用时(批量模式):跳过逐个确认,由调用方技能统一管理确认流程。

Step 4: 生成图片

调用 Gemini 生成图片:

cd <gemini-image-gen 技能目录>
bun scripts/generate-image.ts \
  --prompt-file <提示词文件路径> \
  --output <输出图片路径>

参数说明

  • --prompt-file / -p:提示词文件路径(必需)
  • --output / -o:输出图片路径(可选,默认根据提示词文件位置自动推断;如果调用方未提供目录,则落到当前会话根目录下的 image_output/images/,并兼容 smart-image-generator-output 旧目录约定)

Step 5: 频率控制(重要)

Gemini API 有频率限制,连续调用会被风控。执行频率控制策略:

  • 单次生成:直接调用,无需等待
  • 批量生成(2张以上):每张图片之间等待 5 秒 + 1-5 秒随机秒数
  • 大批量生成(5张以上):每 5 张额外等待 30 秒
  • 如果遇到 429 或生成失败,等待 60 秒后重试,最多重试 2 次

频率控制的具体执行方式:在调用 generate-image.ts 之间插入等待。示例:

# 第1张
bun scripts/generate-image.ts -p prompts/page-01.md -o images/01.png

# 等待 5 秒 + 1-5 秒随机秒数
sleep $((5 + RANDOM % 5 + 1))

# 第2张
bun scripts/generate-image.ts -p prompts/page-02.md -o images/02.png

Step 6: 返回结果

生成完成后返回:

  • 图片文件路径
  • 生成状态(成功/失败/重试次数)

首次使用:自动登录

首次使用时脚本会自动:

  1. 打开 Chrome 浏览器(只1个窗口)
  2. 跳转到 gemini.google.com
  3. 等待用户登录 Google 账号(最多5分钟)
  4. 登录成功后自动保存状态,浏览器关闭
  5. 后续使用自动复用登录状态
  6. 如果显式指定 profile,则优先使用指定 profile,不复用外部已运行 Chrome 会话
  7. 如果 Gemini Web 当前账号/IP/地区不支持图片生成,脚本会直接报出 Gemini 返回的业务错误,而不是长时间卡住

Read the full file on GitHub · 143 lines

Files

What ships with it

42 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 First seen · 143 lines · 76 tokens per session scan A 43d9cb272b65

Subscribe to this mod's changes

gemini-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 76 tokens to every session and 1,513 once invoked, about $0.0004 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