Skip to content
Agentmart
Submit a tool

codex-image-gen

Generate or edit an image by delegating to the user's Codex CLI subscription.

Skill by techfreakworm

IndexedMIT★ 5
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/techfreakworm-codex-image-gen

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Generate or edit an image by delegating to the user's Codex CLI subscription. Use when the user requests "draw / render / generate / create / sketch / design an image of X" or similar. Returns a local PNG path which the Telegram channel will upload as a photo.

Use cases: design, writing, agent-building

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/codex-image-gen

Tools it pre-approves 5

From allowed-tools in SKILL.md: the agent may use these without asking you each time.

  • Bash(codex
  • *),
  • Bash(ls
  • Bash(file
  • Read

What's inside

Skill name
codex-image-gen
Description
Generate or edit an image by delegating to the user's Codex CLI subscription. Use when the user requests "draw / render / generate / create / sketch / design an image of X" or similar. Returns a local PNG path which the Telegram channel will upload as a photo.
License
MIT
Allowed tools
Bash(codex, *),, Bash(ls, *),, Bash(file, *),, Read
Instructions
82 lines in SKILL.md · view on GitHub

Before installing

  • Pre-approves some shell commands

Files (1)

  • SKILL.md

SKILL.md (first lines)

# codex-image-gen

When invoked, you have a `prompt` describing the desired image.

## How Codex CLI handles image generation

Codex CLI does NOT have a direct `--image-out` flag. Codex is an agentic
coding assistant authed via the user's ChatGPT subscription. To generate
an image, you instruct codex agentically — it then calls OpenAI's image
model on your behalf using its own ChatGPT auth (no API key needed).

`codex login status` should report "Logged in using ChatGPT" before this
skill runs; if it doesn't, fail fast with the explanation that auth is
missing — DO NOT assume the failure is anything else (e.g. missing
OPENAI_API_KEY is a wrong inference; codex doesn't use API keys for the
ChatGPT subscription path).

## Process

1. Pick an output path: `OUT=/tmp/codex_img_$(uuidgen | cut -c1-8).png`.

2. Invoke codex non-interactively with workspace-write sandbox so it can
   actually save the file:

   ```bash
   setsid timeout --kill-after=10 120 codex exec --skip-git-repo-check --sandbox workspace-write --cd /tmp \
     "Generate an image: <THE USER'S PROMPT, single line>.
     Save the PNG to $OUT and reply with only the absolute file path."
   ```

   **Why the wrapper:** GNU `timeout` alone sends SIGTERM at the deadline but never
   escalates — a Node CLI that traps SIGTERM can run indefinitely in cleanup, and any
   setsid'd child helpers escape a killpg. `setsid` places timeout + codex + all initial
   descendants into a new session so the outer process group contains everything launched
   before codex itself calls setsid. The `--kill-after=10` flag fires SIGKILL 10 seconds
   after SIGTERM if the process is still alive, giving a hard wall-clock ceiling of 130 s.
   Exit code 124 signals the SIGTERM path; exit code 137 signals the SIGKILL path.

   Notes on the flags:
   - `--skip-git-repo-check` lets codex run outside a git repo (the bot
     usually runs from `/opt/claude-soma`, but we're writing to `/tmp`).
   - `--sandbox workspace-write` permits file writes inside `--cd`.
     The default `read-only` blocks codex from saving the PNG.
   - `--cd /tmp` makes `/tmp` codex's working root for this run.

3. Verify the file exists and looks like a real image:

   ```bash
   ls -lh "$OUT" && file "$OUT"
   ```

   Expect size 100 KB – 4 MB and `file` to say `PNG image data, ...`.
   If size is < 5 KB or file type is wrong, codex likely returned a
   description instead of saving — re-run with a more explicit save
   instruction or fail with that diagnostic.

4. Reply to the user with the absolute `$OUT` path. The Telegram channel's
   `mcp__plugin_telegram_telegram__reply` tool accepts a `files: [path]`
   parameter and uploads PNGs as photos with inline preview (not as voice
   notes, even if the request originated as a voice memo).

## Sanitization

- Strip newlines from the user's prompt before interpolating into the
  codex exec instruction (a literal newline can break the shell quoting).
- If the user's prompt contains content-policy-likely terms (nudity,
  violence, real-person likenesses, etc.), pass it through but be ready
  to surface codex's policy refusal verbatim — don't paraphrase.

## Notes

- Codex uses the user's separate ChatGPT subscription — does NOT count
  against Claude Max credits.
- For aspect-ratio / style / composition control, embed it in the prompt
  (e.g. "16:9 cinematic, soft rim light, painterly").
- If codex returns text without writing the file, the most common cause
  is the sandbox flag being wrong — verify `--sandbox workspace-write`
  is present.
- ChatGPT Plus / Pro subscribers have limited image-gen quota; sustained
  bursts may rate-limit.

From techfreakworm/claude-soma, MIT.

More from techfreakworm/claude-soma

Signals

Stars
5
Forks
1
Open issues
0
Last commit (this folder)
Jun 2, 2026 (4 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from techfreakworm

Cite this page

codex-image-gen skill. Agent Mart. https://agentmart.dev/skills/techfreakworm-codex-image-gen (last updated 2026-10-24)