Python CLI + Claude Code plugin

Codex image generation without defaulting to API-key billing.

Generate and edit raster images through Codex CLI built-in $imagegen, attach reference images, inspect dry runs, and use a Claude Code slash command or model-invoked skill.

Built for Codex-native image workflows

The bridge keeps the implementation small: no runtime dependencies, no direct OpenAI Images API client, and tests that verify command construction without spending image-generation quota.

Standalone CLI

Run codex-imagegen from a Python virtualenv and save exactly one output image path.

Claude Code plugin

Install codex-image as a local marketplace plugin and invoke /codex-image:generate.

Safer defaults

Dry-run diagnostics, output validation, reference-image checks, and default stripping of Codex/OpenAI API-key variables.

Install the CLI from a checkout

The Python package installs the standalone CLI. The Claude Code plugin installs from the repository marketplace layout.

  • Python 3.11+ on Linux or macOS.
  • Codex CLI installed and authenticated with codex login.
  • Optional Claude Code plugin support for slash-command usage.
git clone https://github.com/pablopda/codex-imagegen-bridge.git
cd codex-imagegen-bridge
python3 -m venv .venv
. .venv/bin/activate
pip install .
codex-imagegen --help

Generate or edit an image

Reference images are attached with repeatable -i flags. The bridge passes the generated prompt through stdin so image paths and instructions stay separate.

Live generation spends Codex image-generation quota. Use --dry-run to inspect the command and prompt first.
codex-imagegen \
  -p "Restyle this logo as a minimal app icon" \
  -i logo.png \
  -f outputs/logo-icon.png \
  --size square \
  --quality high

Use it from Claude Code

The bundled plugin is self-contained for Claude Code's plugin cache and can be installed from this repository as a local marketplace.

  • Slash command: /codex-image:generate.
  • Model-invocable when the user explicitly asks for Codex Image generation.
  • Plugin-local diagnostics through scripts/doctor.
/plugin marketplace add https://github.com/pablopda/codex-imagegen-bridge.git
/plugin install codex-image@codex-imagegen-bridge
/reload-plugins

/codex-image:generate square app icon,
save to outputs/icon.png

Security and quota posture

Codex ImageGen Bridge is designed to reduce accidental direct API-key-backed execution, not to become a general secret-isolation sandbox.

API-key stripping

OPENAI_API_KEY and CODEX_API_KEY are removed from the codex exec subprocess by default.

Dry-run first

--dry-run prints the exact command, generated prompt, and stripped env var names without invoking $imagegen.

Output checks

The CLI treats missing, stale, and empty output files as failed generation instead of reporting success.