image_gen: support generating multiple images per call (optional n)

Open 💬 0 comments Opened Jul 17, 2026 by soichisumi

Context

Variant-generation pipelines have to issue N separate image_gen calls even though the underlying Images API supports n up to 10. The per-call process/orchestration overhead adds up.

Findings

  • ImagegenArgs (codex-rs/ext/image-generation/src/tool.rs) exposes no count field and uses deny_unknown_fields.
  • The backend call passes n: None, and only the first returned image is saved.
  • The bundled sample image_gen.py supports --n, but that uses the API-key path, not the subscription-backed built-in tool.

Prior art

  • #18944 (closed as duplicate of #18636)
  • #18636 (open, does not explicitly track a count parameter)

Ask

An optional bounded n (1–10) on image_gen, saving all returned images.

View original on GitHub ↗