| name | imgg |
| description | Generate finished raster images from text prompts through the fixed HaoduoToken relay using gpt-image-2. Use when Codex needs to create a poster, cover, key visual, illustration, concept art, infographic-style image, wallpaper, thumbnail, social image, or any other text-to-image asset through the bundled relay helper. This skill does not edit existing images or accept masks/reference images. |
imgg
Generate images only through the bundled helper and the fixed relay endpoint:
- Endpoint:
https://byte.haoduotoken.com/v1/images/generations
- Model:
gpt-image-2
- Credential:
HAODUOTOKEN_API_KEY
Do not use this skill for image editing, inpainting, masks, reference-image transforms, Responses API image tools, or other models/endpoints.
Workflow
- Convert the request into one self-contained image prompt covering subject, composition, visual hierarchy, palette, lighting, materials, atmosphere, negative space, and intended aspect ratio.
- Avoid asking follow-up questions when the prompt already provides enough creative direction. State any material assumption briefly.
- Use an explicit absolute output path, especially in Codex desktop.
- Run
scripts/image_gen_api.py. Never reproduce the HTTP request manually when the helper is available.
- Keep waiting while heartbeat messages continue. Do not reduce quality merely because generation is slow.
- After success, show the generated image with its absolute path. If the result needs improvement, revise the prompt and generate a new file; do not silently overwrite the first result.
Credential setup
Read the API key only from the environment:
export HAODUOTOKEN_API_KEY="..."
Never place the key in a prompt, CLI argument, file, log, or response. If a key was pasted into chat or committed anywhere, require rotation before use.
Quick start
python3 "${CODEX_HOME:-$HOME/.codex}/skills/imgg/scripts/image_gen_api.py" \
"A cinematic orange tabby cat riding a bicycle through Shanghai at sunrise" \
--out /absolute/path/to/cat.png
Generate several independent alternatives:
python3 "${CODEX_HOME:-$HOME/.codex}/skills/imgg/scripts/image_gen_api.py" \
"A premium editorial cover about sustainable cities, strong visual hierarchy, no watermark" \
--out /absolute/path/to/city-cover.png \
--num 4
Prompt construction
For design-heavy outputs, include only the applicable elements:
- Subject and required objects.
- Composition and focal hierarchy.
- Art direction, era, medium, materials, and texture.
- Palette, lighting, atmosphere, and emotional tone.
- Text content and typography feel when text is necessary.
- Framing, negative space, and aspect ratio.
- Constraints such as
no watermark, no mockup, or avoid clutter.
Use image generation end to end for posters, covers, relationship maps, and infographic-style visuals unless the user explicitly requests an editable or deterministic source artifact. Fine typography may be approximate; mention this when exact small text is critical.
CLI
- Positional
prompt: Required text prompt.
--out: Output PNG path; defaults to generated.png.
--size: Defaults to 1024x1024; common values include 1536x1024, 1024x1536, and 2048x2048.
--quality: low, medium, high, or auto; defaults to high.
--num: Number of separate requests; suffixes filenames when greater than one.
--timeout: Request timeout in seconds; defaults to 1800.
--status-interval: Heartbeat interval; defaults to 20 seconds.
--quiet: Disable progress and heartbeat output.
The helper intentionally has no --api-key, --api-base, --model, --image, --mask, or edit options.
Python API
from image_gen_api import generate_image
paths = generate_image(
"A quiet watercolor landscape with misty mountains",
save_path="/absolute/path/to/landscape.png",
size="1024x1024",
quality="high",
)
The function returns a list of saved absolute paths and raises a concise error on failure. It never returns or stores credentials.
Failure handling
- Report the HTTP status and fixed endpoint without exposing the Authorization header.
- Accept base64 JSON, URL JSON, data URLs, and raw image responses from the relay.
- Treat missing image data, invalid image bytes, timeouts, and HTTP errors as failures.
- Preserve the original prompt and parameters when retrying after an actual transport failure.