/ask-llm:ask-llm-codex-imagefrom ask-llm
Generates images via OpenAI's gpt-image-2 model by delegating to the Codex CLI's image_generation tool. Saves output to disk and reports the path. Useful for creating pictures, graphics, or visual content on demand.
Ships in ask-llm. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Refine the requested image prompt without changing intent, select an explicit output path, invoke ask-codex-write with sandbox: "workspace-write" so its image tool may create the file, verify the resulting file on disk, and report the path and provider response. Surface feature, policy, timeout, and filesystem failures verbatim.
Call native ask-codex-write with sandbox: "workspace-write". After it returns, use Pi's read-only filesystem tools to verify the output file. Do not claim automatic inline rendering in print mode.
Codex, Cursor Agent, Antigravity, Grok Build, Gemini CLI and OpenCode get this skill from their skills folder, not from a plugin. Use the writable Codex call from ../ask-llm-review/transport.md with sandbox: "workspace-write" and the exact model the user named (gpt-6.2-sol otherwise), then read the output file to confirm it exists.
The existing detailed workflow below is the Claude Code adapter. Its Agent, MCP, hook, CLAUDE_PLUGIN_ROOT, and AskUserQuestion mechanics apply only on Claude Code; they do not override the Pi adapter above.
Generate an image by delegating to the ask-codex-write MCP tool with a prompt-engineered template that triggers Codex's built-in image_generation tool. The result is saved to disk and the path is returned to the user.
Codex's image_generation tool selects the image model server-side; as of 2026-04-21 that is gpt-image-2. Three capabilities are worth accounting for when building prompts:
codex-cli >= 0.125.0 installed and authenticatedimage_generation feature flag enabled (default: stable + true). Verify with codex features list | grep image_generationask-codex-write MCP tool available (from the Claude plugin's bundled codex server) or the unified mcp__ask-llm__ask-llm tool (from @ask-llm/mcp) whose schema includes sandboxTake the user's natural-language ask and prepare it for image generation. Rules:
If you significantly enrich the prompt, briefly tell the user what you added and let them push back before dispatching.
Convention:
/tmp/codex-images/$(date +%Y-%m-%d)/<slug>.png where <slug> is a short kebab-case derivation from the user's prompt (max 40 chars).mkdir -p <parent> before dispatching. Codex's image tool will fail if the directory doesn't exist.Example slug derivation:
dark-terminal-with-two-reviewers.pngcat-picture.pngCall an exact ask-codex-write leaf when exposed (NOT raw codex exec — that bypasses ADR-044 quota fallback, ADR-042 stdin handling, and ADR-047 PATH resolution). If only unified mcp__ask-llm__ask-llm is exposed, use that instead with provider: "codex". If the unified schema lacks sandbox, stop and tell the user to upgrade @ask-llm/mcp (npx -y @ask-llm/mcp@latest or npm install -g @ask-llm/mcp); do not omit sandbox to make the call succeed. Use this prompt template:
Use your image_generation tool to create the following image and save it as a PNG file.
Image description:
<the user's prompt, refined per Phase 1>
Save the file to this absolute path: <path from Phase 2>
After saving, confirm the absolute path of the created file and its byte size in your reply. If image_generation fails or the file cannot be written, explain what went wrong and do not invent a fake path.
Sandbox: pass sandbox: "workspace-write" on this ask-codex-write or fully pinned ask-llm({ provider: "codex", ... }) call. Codex defaults to the read-only review sandbox (ADR-136), under which it cannot write the PNG to disk; image generation is the sanctioned exception that needs Codex to write the output file itself. The unified server will not silently strip sandbox; an older @ask-llm/mcp that cannot honor it must fail closed.
Default model: let ask-codex-write use its default (gpt-6.2-sol). The image_generation tool is invoked by the model regardless of which Codex chat model is selected — model selection here is about the orchestrating agent, not the image model itself.
Wall time expectation: with gpt-image-2, simple images typically render in under a minute end-to-end; complex prompts or high-resolution (up to 4K) renders can take a few minutes because gpt-image-2's thinking mode plans layout and self-checks before generating. This is normal; do not retry assuming a hang. The first call in a session is slowest because the image_generation tool definitions aren't cached yet; subsequent calls in the same session are faster (Codex CLI prompt-caches aggressively).
After ask-codex-write returns:
ls -la <path> to confirm the file was created. Do not trust the agent's textual claim alone.image_generation flag disabled: codex features list | grep image_generation shows false. Tell the user to enable it: codex features enable image_generation or codex --enable image_generation [PROMPT].codex --version < 0.125.0. Tell the user to update: npm i -g @openai/codex (or whichever install method they use).outputPath.User: /codex-image generate a minimalist illustration of a cat reading a book
Phase 1 — refined prompt: minimalist illustration of a cat reading a book, flat vector style, two-tone palette, no human figures, square framing, transparent background
Phase 2 — output: /tmp/codex-images/2026-04-24/cat-reading-a-book.png
Phase 3 — ask-codex-write is called with the prompt template above.
Phase 4 — ls -la /tmp/codex-images/2026-04-24/cat-reading-a-book.png shows a 248KB file. Skill returns:
Generated /tmp/codex-images/2026-04-24/cat-reading-a-book.png (248 KB) via gpt-image-2. Used Codex (gpt-6-sol) as orchestrator. Refined prompt: minimalist illustration of a cat reading a book, flat vector style, two-tone palette, no human figures, square framing, transparent background. Reading inline below.
[image renders]
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub lykhoyda/ask-llm --plugin ask-llm40 skills in this plugin
/antigravity-reviewEarlier name of the ask-llm-antigravity-review skill; use when the user invokes /antigravity-review./ask-llm-antigravity-reviewGet a second opinion from Google Antigravity (agy) on your current code changes. Analyzes staged/unstaged diffs and returns prioritized findings. Use when the user asks to "review with Antigravity", "Antigravity code review", or "ask agy to check my code"./ask-llm-astra-reviewReview the current code changes or a plan specifically with OpenAI GPT-6.2 Astra. Use when the user asks for an Astra review, says "review with Astra", wants a flagship-pinned Codex review, or invokes /astra-review./ask-llm-brainstormConsult a multi-model panel, the fixed Fable + Astra + Carbon frontier panel with --frontier, or one exact Codex model with --external-only. Usage /brainstorm [--external-only | --frontier] [--no-fallback] [participants] <topic>. The default panel uses antigravity,codex./ask-llm-brainstorm-allSend a topic to all external providers (Gemini, Codex, Grok, Ollama, Antigravity) concurrently after the current host model forms an independent view. Use when the user wants an all-provider brainstorm with synthesis and explicit unavailable-provider reporting./ask-llm-carbon-reviewReview the current code changes or a plan specifically with Google Gemini 4 Carbon (High) through Antigravity. Use when the user asks for a Carbon review, says "review with Carbon", wants an Antigravity review pinned to gemini-4-carbon-high, or invokes /carbon-review.Other plugins' skills for the same job