by SnowSky1
把 Codex imagegen 的工作流与提示词库带到任意智能体;支持 npm/pnpm 一键安装、配套 skill、独立 API 与 Qwen-Image 兼容网关。
Available after the catalog security scan passes.
⚠️ Third-Party Software Notice
This skill is third-party open-source software developed and hosted independently on GitHub. SkillsLLM is an informational directory and does not control or maintain the underlying repository.
Any security checks, ratings, or warnings displayed by SkillsLLM are automated and limited in scope. They do not constitute a security certification or guarantee that the software is safe, error-free, or free from malicious code, vulnerabilities, compromised dependencies, or prompt-injection risks.
Review the source code, permissions, dependencies, and configuration before installing or running any third-party skill. Use is at your own risk. To the maximum extent permitted by applicable law, SkillsLLM is not liable for losses arising from third-party software.
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
# Add to your Claude Code skills
git clone https://github.com/SnowSky1/universal-imagegen-agentGuides for using ai agents skills like universal-imagegen-agent.
Adapted on 2026-09-24 from the OpenAI Codex
imagegenskill. The unmodified source snapshot is preserved underupstream/imagegen/.
This skill does not assume a host-specific built-in image tool.
imagegen-agent CLI.npx -y universal-imagegen-agent or
pnpm dlx universal-imagegen-agent as the command prefix.--json.--dry-run before a costly or destructive retry.--force is supplied.Install the CLI and this skill together:
npm install --global universal-imagegen-agent
imagegen-agent install-skill
Or install only the skill without keeping a global package:
npx universal-imagegen-agent install-skill
Restart or reload the host agent after installation. The installer defaults to
$CODEX_HOME/skills/universal-imagegen, or
~/.codex/skills/universal-imagegen when CODEX_HOME is unset. Use
--target for another compatible agent's skill directory.
Classify the request independently along two axes:
generate: create a new image; reference images guide style,
composition, mood, or subject.edit: preserve an existing image while changing specified parts.--n);batch with one JSONL record per asset).Assume generate unless the user explicitly asks to modify an existing image.
For edits, label each input image by index and role in the prompt.
imagegen-agent config --json.change only X; keep Y unchanged.--dry-run --json.Use only the useful lines:
Use case: <taxonomy slug>
Asset type: <where the asset will be used>
Primary request: <user's request>
Input images: <Image 1: role; Image 2: role>
Scene/backdrop: <environment>
Subject: <main subject>
Style/medium: <photo, illustration, 3D, etc.>
Composition/framing: <viewpoint, crop, placement>
Lighting/mood: <lighting and mood>
Color palette: <palette notes>
Materials/textures: <surface details>
Text (verbatim): "<exact text>"
Constraints: <must keep and must avoid>
Avoid: <negative constraints>
If the user prompt is already specific, normalize it without adding creative requirements. If it is generic, add only details that materially improve composition, intended use, or production quality.
Generate:
photorealistic-naturalproduct-mockupui-mockupinfographic-diagramscientific-educationalads-marketingproductivity-visuallogo-brandillustration-storystylized-concepthistorical-sceneEdit:
text-localizationidentity-preserveprecise-object-editlighting-weatherbackground-extractionstyle-transfercompositingsketch-to-renderConfiguration:
imagegen-agent config --json
Generate:
imagegen-agent generate "A minimal ceramic mug product photo" \
--use-case product-mockup \
--composition "wide composition with usable negative space" \
--constraints "no logos; no text; no watermark" \
--out output/imagegen/mug.png \
--json
Edit:
imagegen-agent edit \
--image input.png \
--prompt "Replace only the background with a warm sunset" \
--constraints "keep the product, its edges, framing, and labels unchanged" \
--out output/imagegen/sunset.png \
--json
Batch:
imagegen-agent batch jobs.jsonl \
--out-dir output/imagegen/batch \
--concurrency 4 \
--json
Request an actually transparent background and use PNG or WebP. API capability varies by provider and model. If native transparency is unsupported, explain the limitation and ask before switching models or using chroma-key extraction. Never silently change the selected model.
Use direct SVG, HTML/CSS, canvas, or repository-native editing instead when the task is deterministic vector work, a small change to an editable source asset, or an extension of an established icon/logo system.
references/prompting.md: runtime-neutral prompting guidance.references/integration.md: configuration and agent integration.references/sample-jobs.jsonl: batch examples.upstream/imagegen/: complete original skill snapshot.See how universal-imagegen-agent compares with popular alternatives.
开始验证: 完整 generate → edit 案例 · 更新记录 · English · 作者展示页:Agent 与 AI
v0.1.1 修复了 Node.js 将 n=0 静默变成 n=1 的行为,并为
Node.js/Python CLI 加入共享的数量边界用例。未指定数量时仍默认生成一张。
这是一个从 OpenAI Codex imagegen skill 改造而来的、面向通用智能体的独立项目。它把 Codex 生图能力中已经沉淀下来的任务决策流程、提示词工程、用例分类、编辑不变量和提示词范例库抽离出来,使任意具备 shell 或 Python 调用能力的智能体,都能直接复用这套成熟方法来生成和编辑图片,而不必依赖 Codex 专有的内置图片工具。
随着 Qwen-Image、Qwen-Image-2.1 等开放图像模型快速发展,智能体已经拥有越来越多可选择的生图后端。本项目不绑定某个模型:既可以连接 OpenAI Images API,也可以连接实现兼容接口的第三方服务;将 Qwen-Image 部署到本地或推理服务后,还可以通过 OpenAI-compatible 网关或新增适配器,把 Qwen 的开放模型能力与本项目继承自 Codex 的提示词库、工作流和质量约束组合起来,让不同智能体获得更稳定、更专业的生图体验。
当前内置的是 OpenAI-compatible Images API 适配层。Qwen 本地 Diffusers、ComfyUI 或 SGLang 推理后端尚未直接内置,需要通过兼容网关接入或新增 provider adapter。
项目提供:
imagegen-agent CLI;universal-imagegen skill;--json 机器可读输出和稳定的退出码;base_url、模型、请求头和扩展请求参数;upstream/imagegen/。当前改造日期为 2026-09-24。新配置默认使用
gpt-image-2.5-sunburst,但模型不是硬编码限制,任何部署都可以通过
环境变量、TOML 或命令行替换。
图像模型本身决定画面生成能力,而智能体侧的任务理解、提示词组织、输入图片角色标注、编辑不变量和结果检查同样决定最终质量。这个项目负责后半部分:
imagegen skill 中的 use-case taxonomy 和提示词范例;因此,接入 Qwen-Image 并不意味着每个智能体都要重新设计提示词系统。只要部署端提供兼容 API,智能体就可以继续使用本项目的 SKILL.md、提示词库和执行协议;如果部署端接口不同,也只需新增 provider adapter,而不需要重写上层智能体工作流。
.
├── SKILL.md # 适用于通用智能体的技能说明
├── agents/openai.yaml # Skill 的 UI 与自动发现元数据
├── bin/ # npm/pnpm 安装后的 CLI 入口
├── node/ # Node.js CLI、API 与 skill 安装器
├── node-tests/ # Node.js 测试
├── src/universal_imagegen/ # CLI、配置、提示词与 API 适配层
├── tests/ # 不调用真实 API 的单元测试
├── references/ # 通用提示词与集成说明
├── upstream/imagegen/ # 未修改的原始 skill 快照
├── imagegen.example.toml # 非敏感配置示例
└── .env.example # API 环境变量示例
v0.1.2 已发布到 npm,可固定版本安装:
npm install --global universal-imagegen-agent@0.1.2
imagegen-agent --version
本版本修复了数量校验和 npm CLI 入口,并通过 GitHub Actions 可信发布。 需要直接下载安装包、Python wheel 或源码包时,可查看 v0.1.2 Release。
npm install --global universal-imagegen-agent
pnpm add --global universal-imagegen-agent
安装后可直接运行:
imagegen-agent --version
imagegen-agent config --json
也可以不进行全局安装:
npx universal-imagegen-agent generate "A ceramic mug" --dry-run --json
pnpm dlx universal-imagegen-agent generate "A ceramic mug" --dry-run --json
如果 npm registry 版本尚未发布或需要测试最新的 main:
npm install --global github:SnowSky1/universal-imagegen-agent
pnpm add --global github:SnowSky1/universal-imagegen-agent
全局安装 CLI 后:
imagegen-agent install-skill
不全局安装:
npx universal-imagegen-agent install-skill
pnpm dlx universal-imagegen-agent install-skill
默认安装位置为:
$CODEX_HOME/skills/universal-imagegen
未设置 CODEX_HOME 时使用:
~/.codex/skills/universal-imagegen
可通过 --target 安装到其他智能体的技能目录:
imagegen-agent install-skill --target /path/to/agent/skills
已有同名 skill 时默认不覆盖;确认替换时添加 --force。安装完成后重启或重新加载智能体,使其发现 $universal-imagegen。
需要 Python 3.11 或更高版本:
uv sync --extra dev
复制环境变量示例:
Copy-Item .env.example .env
在本机 .env 中填写密钥:
IMAGEGEN_API_KEY=your-local-secret
IMAGEGEN_BASE_URL=https://api.openai.com/v1
IMAGEGEN_MODEL=gpt-image-2.5-sunburst
.env 已被 Git 忽略。请勿把真实密钥提交到仓库。
如需项目级非敏感配置:
Copy-Item imagegen.example.toml .imagegen.toml
配置优先级从高到低为:
IMAGEGEN_* 环境变量及 .env;--config、IMAGEGEN_CONFIG 或当前目录 .imagegen.toml;为了避免 shell 历史和进程列表泄密,CLI 故意不提供 --api-key 参数。
TOML 中只写 api_key_env,密钥本身放在环境变量。
只要服务实现兼容的 Images API,即可配置:
IMAGEGEN_API_KEY=provider-secret
IMAGEGEN_BASE_URL=https://example.com/v1
IMAGEGEN_MODEL=provider-image-model
IMAGEGEN_HEADERS_JSON={"X-Project":"demo"}
自定义服务会收到提示词、输入图像及请求头,请只使用可信端点。
检查配置,输出会自动隐藏密钥:
imagegen-agent config
imagegen-agent config --json
仅验证请求,不联网:
imagegen-agent generate "一只放在石桌上的陶瓷杯" `
--use-case product-mockup `
--style "clean product photography" `
--constraints "no logo; no watermark" `
--dry-run --json
生成:
imagegen-agent generate "A quiet alpine cabin at dawn" `
--size 1536x1024 `
--quality high `
--out output/imagegen/alpine-cabin.png
编辑:
imagegen-agent edit `
--image input.png `
--prompt "Change only the background to a warm sunset" `
--constraints "keep the subject, framing, and edges unchanged" `
--out output/imagegen/sunset-edit.png
批处理:
{"prompt":"A gray wolf in snow","out":"wolf.png","size":"1024x1024"}
{"prompt":"A matte ceramic mug","out":"mug.png","quality":"high"}
imagegen-agent batch jobs.jsonl `
--out-dir output/imagegen/batch `
--concurrency 4 --json
智能体应优先执行 dry-run,确认提示词、模型与输出路径后再进行真实请求。
真实执行时建议使用 --json,其标准输出只包含结果对象,进度和错误写入
标准错误。成功退出码为 0,配置或输入错误为 2,API/网络/写入失败为
1。
完整的行为约束、决策树和提示词分类见 SKILL.md。
import {
ImageGenClient,
loadSettings,
} from "universal-imagegen-agent";
const settings = await loadSettings();
const client = new ImageGenClient(settings);
const result = await client.generate({
prompt: "A minimal ceramic mug product photo",
out: "output/imagegen/mug.png",
});
console.log(result.outputs);
from universal_imagegen import ImageGenClient, GenerateRequest, load_settings
settings = load_settings()
client = ImageGenClient(settings)
result = client.generate(
GenerateRequest(
prompt="A minimal ceramic mug product photo",
out="output/imagegen/mug.png",
)
)
print(result.outputs)
从源码目录运行 node examples/verify-workflow.mjs,可以实际走通本地
HTTP 请求、PNG 文件保存和 multipart 编辑上传,并得到 verification.json。
该案例返回明确标注的单像素测试图片,用于验证集成链路;真实模型的运行说明和
验证边界见 案例文档。
如已接入自己的服务,欢迎通过 GitHub Issues 中的 Provider compatibility feedback 表单提供成功记录或错误复现。 请包含版本、运行环境、provider/model 名称和脱敏命令,不要提交密钥。
项目使用 Apache License 2.0。原始 skill 未经修改保存在
upstream/imagegen/,改造说明见 NOTICE。根目录代码与文档是为通用
智能体重新组织的派生实现。
如果这个项目帮助你把 Codex 的提示词能力带到了更多智能体或开放模型中,欢迎给仓库点一个 Star,并分享你接入的模型或 provider adapter。
universal-imagegen-agent is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by SnowSky1. 把 Codex imagegen 的工作流与提示词库带到任意智能体;支持 npm/pnpm 一键安装、配套 skill、独立 API 与 Qwen-Image 兼容网关。. It has 61 GitHub stars.
universal-imagegen-agent's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/SnowSky1/universal-imagegen-agent" and add it to your Claude Code skills directory (see the Installation section above). universal-imagegen-agent ships a SKILL.md manifest, so compatible agents can discover and load it automatically.
universal-imagegen-agent is primarily written in Python. It is open-source under SnowSky1 on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh universal-imagegen-agent against similar tools.
No comments yet. Be the first to share your thoughts!