Sign In
I

Image Generation (imagegen)

@openai
Visit Skill
Share:

OpenAI's imagegen skill: generate or edit raster images (photos, mockups, sprites, cutouts) with GPT Image models via a bundled Python CLI.

Security Reviewed

Low risk: a single CLI that only calls the OpenAI Image API with your own key and writes images locally without overwriting by default.

Install Image Generation (imagegen) in Google Antigravity

Antigravity loads skills from .agents/skills/ in your project or ~/.gemini/config/skills/ for all projects (official docs). Full guide

EasiestOption 1: paste this to your Antigravity agent
Install the "Image Generation (imagegen)" skill for Google Antigravity.
Follow the steps at https://www.antigravityskills.org/install/image-generation.md (source: https://github.com/openai/skills/tree/main/skills/.system/imagegen).
Before running anything, show me what you will download and whether it includes scripts, and wait for my OK.
Install it into this project (.agents/skills/) unless I say global. When done, check that Antigravity lists it as an installed skill.

The agent reads the install file, shows you what it will download and waits for your OK.

Option 2: install it yourself
  1. 1. Clone the source repository
    git clone --depth 1 https://github.com/openai/skills /tmp/openai-skills

    Clone the repository to a temporary folder so you can copy the skill folder out of it.

  2. 2. Copy into your workspace (this project only)
    mkdir -p .agents/skills && cp -r /tmp/openai-skills/skills/.system/imagegen .agents/skills/imagegen

    Run this from your project root. Antigravity reads workspace skills from <project>/.agents/skills/<folder>/.

  3. 3. Or copy globally (all projects)
    mkdir -p ~/.gemini/config/skills && cp -r /tmp/openai-skills/skills/.system/imagegen ~/.gemini/config/skills/imagegen

    Use this instead of the workspace step if you want the skill available in every project. Antigravity reads global skills from ~/.gemini/config/skills/<folder>/.

  4. 4. Install the Python dependency
    pip install openai

    The SKILL.md prefers uv pip install openai; pillow is optional (downscaling only). Then export OPENAI_API_KEY in your shell; never paste the key into the chat.

  5. 5. Check that Antigravity sees it

    Start a new agent session and ask "What skills do you have?" (in the Antigravity CLI you can also run /skills). imagegen should be listed.

The openai/skills README does not mention Antigravity; these steps are the standard Antigravity skill folders. Antigravity has no Codex image_gen tool, so ask the agent to use the CLI fallback explicitly.

Using Claude Code, Cursor or Codex? See other assistants below.

What is Image Generation (imagegen)?

imagegen is OpenAI's skill for making or editing bitmap images from inside a coding agent, for developers who need real project assets (a landing-page hero, a game sprite, a product cutout) rather than SVG or CSS placeholders. In Codex it uses the built-in image_gen tool; in every other agent, including Antigravity and Claude Code, it works only through the bundled fallback CLI, scripts/image_gen.py, which calls the OpenAI Image API with your own OPENAI_API_KEY. What we counted in skills/.system/imagegen at commit 49f948f: 11 files (SKILL.md, 1 Python script, 5 reference docs, agents/openai.yaml, 2 icon files and the Apache-2.0 LICENSE.txt); image_gen.py is 926 lines; the SKILL.md defines 16 use-case slugs (8 for new images, 8 for edits), and references/sample-prompts.md holds a ready prompt for each of them plus templates for website assets, game assets, wireframes and logos. The CLI hard-limits what it will send (we counted these in image_gen.py): 1 to 10 images per call, 3 sizes (1024x1024, 1536x1024, 1024x1536) or auto, batches of at most 500 jobs, 1 to 25 parallel requests (default 5), and input images over 50 MB trigger a warning. Unlike pollinations-ai or comfyui-skill on this site, it only talks to OpenAI and only accepts model names starting with gpt-image-.

How to use Image Generation (imagegen)?

Ask for the image and say where it will be used (for example "a hero image for the pricing page"). Outside Codex the agent has no built-in image_gen tool, and the SKILL.md forbids switching to the CLI on its own, so say explicitly that you want the CLI fallback. The agent then runs python scripts/image_gen.py generate, edit or generate-batch with OPENAI_API_KEY set in your shell, and writes finals under output/imagegen/ (intermediate JSONL batches go in tmp/imagegen/). Try --dry-run first: it prints the API payload and output paths without a key, network or the openai package. For edits, name what must stay unchanged; the SKILL.md tells the agent to repeat those invariants on every iteration.

Key features of Image Generation (imagegen)

  • ✓Two modes: built-in image_gen tool (Codex only) or the bundled scripts/image_gen.py CLI fallback (any agent)
  • ✓CLI subcommands generate, edit and generate-batch (JSONL file, up to 500 jobs, retries with backoff up to 60 s)
  • ✓Edits with up to 16 input images and an optional mask (references/image-api.md), plus --input-fidelity low|high
  • ✓16 use-case slugs (product-mockup, ui-mockup, logo-brand, background-extraction, style-transfer, compositing and more) with one shared prompt schema
  • ✓--dry-run prints the API payload without a network call, an API key or the openai package
  • ✓Refuses to overwrite an existing file unless --force is passed; optional downscaled -web copies with --downscale-max-dim (needs pillow)

When to use Image Generation (imagegen)

  1. 1Create a hero image or product mockup for a landing page
  2. 2Generate game sprites or textures as project assets
  3. 3Replace the background of a product photo while keeping the product unchanged
  4. 4Produce a transparent-background cutout
  5. 5Batch-generate many asset variants from a JSONL prompt file

Installation & Setup Guide

Agent Rules / Prompt Setup

Follow these steps (taken from the project's own docs) to configure Image Generation (imagegen) in your development environment.

Step 1: Codex: already includedcodex

Source: openai/skills README, "Installing a skill": skills in skills/.system, including imagegen, are installed automatically in the latest version of Codex. The skill-installer SKILL.md adds that .system skills are preinstalled in $CODEX_HOME/skills (default ~/.codex/skills).

Step 2: Claude Code (manual copy)claude
git clone --depth 1 https://github.com/openai/skills /tmp/openai-skills && mkdir -p ~/.claude/skills && cp -r /tmp/openai-skills/skills/.system/imagegen ~/.claude/skills/imagegen

Not documented by the repo. Source for the path: Claude Code skills docs (https://code.claude.com/docs/en/skills), which read personal skills from ~/.claude/skills/ and project skills from .claude/skills/. Set OPENAI_API_KEY and ask for the CLI fallback when generating.

Step 3: Cursor: not documentedcursor

The openai/skills README and the skill folder say nothing about Cursor, so we do not list a Cursor command.

Usage Example & Verification

Prompt / Request Example
1) README example (SKILL.md, Generation example):
Use case: product-mockup
Asset type: landing page hero
Primary request: a minimal hero image of a ceramic coffee mug
Style/medium: clean product photography
Constraints: no logos, no text, no watermark
-> What happens: outside Codex, after you ask for the CLI fallback, the agent runs image_gen.py generate with this spec as the prompt and saves a 1024x1024 PNG under output/imagegen/.

2) README example (SKILL.md, Edit example):
Use case: precise-object-edit
Primary request: replace only the background with a warm sunset gradient
Constraints: change only the background; keep the product and its edges unchanged
-> What happens: the agent runs image_gen.py edit --image <your file> and writes a new file; the original is kept because the CLI will not overwrite without --force.

3) Our example: "Use the imagegen CLI fallback with --dry-run to show me the payload for a transparent 1024x1024 PNG game coin icon."
-> What happens: the script prints the request JSON and the output path only; nothing is sent to OpenAI and no image is created.
Installation Confirmation Method

Ask "What skills do you have?" in Antigravity (Antigravity CLI: /skills) and look for imagegen, then ask: "Run the imagegen CLI with --dry-run for a test prompt." A working setup prints the payload and the computed output path without contacting OpenAI.

Security Review

Static review
Reviewed Date
2026-10-13
Audited Ref / Commit
49f948faa9258a0c61caceaf225e179651397431 (2026-06-23)
Reviewer
antigravityskills.org (static code review)

Low risk: a single CLI that only calls the OpenAI Image API with your own key and writes images locally without overwriting by default.

Full review: scope, findings, risks
Audit Scope:skills/.system/imagegen/ at commit 49f948f (still HEAD on 2026-10-13): SKILL.md, agents/openai.yaml, references/*.md, scripts/image_gen.py (all 926 lines), LICENSE.txt; repository README.md; skills/.system/skill-installer/SKILL.md (install paths). Static review only; nothing was executed.
Key Findings:One Python script (scripts/image_gen.py) plus Markdown instructions. Network access only through the openai SDK (images.generate / images.edit). Reads OPENAI_API_KEY. Writes image files to --out/--out-dir (default output/imagegen/output.png) and optional downscaled copies; refuses to overwrite without --force. No subprocess, eval or exec calls.
Identified Operational Risks & Permissions:Prompts and input images are uploaded to OpenAI and usage is billed to your key. references/codex-network.md discusses loosening Codex sandbox/approval settings, which it flags itself as increasing risk.

The skill is instructions plus one script, scripts/image_gen.py. The script imports only standard-library modules and the openai SDK (and pillow when downscaling) and contains no subprocess, os.system, eval or exec calls. It reads OPENAI_API_KEY from the environment and sends requests to the OpenAI Image API endpoints listed in references/image-api.md (/v1/images/generations and /v1/images/edits). Output images are base64-decoded and written to the paths given by --out or --out-dir; _decode_and_write and _decode_write_and_downscale stop with an error if a file already exists unless --force is passed. SKILL.md instructs the agent never to modify image_gen.py, never to switch to the CLI automatically, and never to ask for the key in chat. references/codex-network.md explains enabling network access in Codex and notes that reducing approvals increases risk in untrusted repositories.

Operational Notes & Known Limitations

Known Limitations

  • •The preferred built-in image_gen tool exists only in Codex; in Antigravity, Claude Code or Cursor you must explicitly ask for the CLI fallback (the SKILL.md forbids switching automatically)
  • •The CLI fallback needs OPENAI_API_KEY, network access and the openai Python package (pillow only for downscaling); usage is billed to your OpenAI account
  • •Only GPT Image models are accepted (the script rejects any model name not starting with gpt-image-; default gpt-image-1.5)
  • •Transparent backgrounds need PNG or WebP output; the script stops with an error for JPEG (we read this in image_gen.py)
  • •Paths in references/cli.md assume Codex ($CODEX_HOME/skills/.system/imagegen); adjust them to where you copied the folder
  • •The openai/skills README marks the whole repository as deprecated in favour of openai/plugins; this skill folder still exists at the reviewed commit

Frequently Asked Questions

Is the Image Generation (imagegen) skill safe?

In our static review of commit 49f948f, scripts/image_gen.py only imports the standard library, the openai SDK and (for downscaling) pillow, with no subprocess, eval or exec calls. It reads OPENAI_API_KEY from the environment, sends prompts and input images to OpenAI, and writes images only to the paths you give it, refusing to overwrite without --force.

How do I install imagegen in Antigravity?

Clone https://github.com/openai/skills, copy skills/.system/imagegen into .agents/skills/imagegen (one project) or ~/.gemini/config/skills/imagegen (all projects), pip install openai, export OPENAI_API_KEY and check by asking "What skills do you have?" (Antigravity CLI: /skills). Or paste the one-line agent prompt above.

Does it work without an OpenAI API key?

Only inside Codex, where the built-in image_gen tool is used. Everywhere else it needs OPENAI_API_KEY; --dry-run works without a key but creates no image.

Which models and sizes does it support?

GPT Image models only (default gpt-image-1.5; gpt-image-1 and gpt-image-1-mini are named), sizes 1024x1024, 1536x1024, 1024x1536 or auto, quality low, medium, high or auto.

Supported Platforms

antigravityclaudecodex