This repository contains a reusable Codex Skill for image generation through the currently configured OpenAI-compatible third-party provider.
It reads:
${CODEX_HOME:-$HOME/.codex}/auth.jsonforOPENAI_API_KEY${CODEX_HOME:-$HOME/.codex}/config.tomlfor the activemodel_providerand providerbase_url
It then calls:
<base_url>/v1/images/generations
with curl in streaming mode, decodes streamed image events, and writes the image to outputs/.
It does not use local Pillow compositing or OpenAI SDK fallback behavior.
mkdir -p work outputs
cat > work/prompt.txt <<'EOF'
Use case: ads-marketing
Asset type: vertical promotional poster
Primary request: Create a polished PandaNotes promotional poster.
Scene/backdrop: clean modern workspace with subtle bamboo paper texture
Subject: a friendly panda mascot beside a sleek notes app interface
Style/medium: premium 3D illustration mixed with crisp product UI mockup
Composition/framing: vertical poster, centered product interface, balanced hierarchy
Text (verbatim): "PandaNotes" and "Capture ideas. Connect knowledge."
Constraints: render text exactly; no extra text; no watermark
EOF
python scripts/generate_image.py \
--prompt-file work/prompt.txt \
--out outputs/pandanotes-poster.png \
--size 1024x1536 \
--quality high \
--forceStreaming is the default. The request includes:
{
"stream": true,
"partial_images": 2
}The script saves preview frames as *-partial-N.png and the final completed image at the --out path.
Dry-run without calling the provider:
python scripts/generate_image.py \
--prompt-file work/prompt.txt \
--out outputs/pandanotes-poster.png \
--dry-runSynchronous fallback for providers that do not support streaming:
python scripts/generate_image.py \
--prompt-file work/prompt.txt \
--out outputs/pandanotes-poster.png \
--syncSKILL.md: Codex Skill instructions.scripts/generate_image.py: deterministic helper script using only Python standard library pluscurl.
The script never prints the API key. Do not commit auth.json, raw response files containing base64 payloads, or generated private assets unless intended.