Skip to content

Syngnat/codex-skill-provider-imagegen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Codex Skill: Provider Image Generation

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.json for OPENAI_API_KEY
  • ${CODEX_HOME:-$HOME/.codex}/config.toml for the active model_provider and provider base_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.

Usage

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 \
  --force

Streaming 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-run

Synchronous fallback for providers that do not support streaming:

python scripts/generate_image.py \
  --prompt-file work/prompt.txt \
  --out outputs/pandanotes-poster.png \
  --sync

Files

  • SKILL.md: Codex Skill instructions.
  • scripts/generate_image.py: deterministic helper script using only Python standard library plus curl.

Security

The script never prints the API key. Do not commit auth.json, raw response files containing base64 payloads, or generated private assets unless intended.

About

Codex Skill for provider-based image generation via configured OpenAI-compatible gateway.

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages