image-gen
Generate or edit images via Codex with ChatGPT login and no API key; build structured prompts, then return saved file paths.
Instructions
Generate or edit images with Codex's built-in image_gen tool (ChatGPT login, no API key). Builds a structured prompt from use case, style, composition, exact text, reference roles and edit invariants, then returns the saved file paths. The image model and pixel size are chosen by Codex; aspect ratio and transparency are requested through the prompt.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"prompt": "<prompt>"
},
"name": "image-gen"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | Exact in-image text, rendered verbatim | |
| avoid | No | Things that must not appear | |
| model | No | Host model that relays the call (not the image model). Known: gpt-6.1-sol, gpt-6-astra, gpt-6.1-terra, gpt-6-sol, gpt-6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna. Omit to use the Codex default. | |
| style | No | Medium and style, e.g. "35mm film photo", "flat vector" | |
| aspect | No | Aspect ratio: square, landscape (3:2), portrait (2:3), wide (16:9), tall (9:16), or W:H. Requested via the prompt; exact pixel size is chosen by Codex. | |
| prompt | Yes | What to create, or for edits, what to change. Be concrete about the subject. | |
| enhance | No | Let the Codex host model enrich generic prompts with composition/lighting detail (never adds new subjects or text). false = pass the spec verbatim. | |
| palette | No | Color palette | |
| presets | No | Guidance blocks: photoreal, portrait, likeness, product, thumbnail, no-text, exact-text, brand-style | |
| timeout | No | Timeout in ms. Default 10 min; each image takes roughly 30-90s. | |
| useCase | No | Task category from the Codex imagegen taxonomy; sets the polish level | |
| lighting | No | Lighting and mood | |
| preserve | No | Edit invariants, e.g. ["person and pose", "all text outside the sign"] | |
| variants | No | Number of images; each is a separate image_gen call | |
| assetType | No | Where the image will be used, e.g. "landing page hero", "app store screenshot" | |
| editImage | No | Image to edit (absolute or relative to workingDir). Switches to edit mode. | |
| materials | No | Materials and textures | |
| overwrite | No | Overwrite an existing outputPath instead of writing a -v2 sibling | |
| outputPath | No | Copy results here (relative to workingDir). A path ending in / is a directory. Without it, images stay in $CODEX_HOME/generated_images. | |
| references | No | Reference images with roles. Up to 5 images including editImage. | |
| typography | No | Font style, size, color and placement for `text` | |
| workingDir | No | Working directory for relative paths | |
| composition | No | Framing, viewpoint, placement, negative space | |
| reasoningEffort | No | Host model reasoning. Default low: the host only relays the prepared spec. | low |
| transparentBackground | No | Ask for a transparent (alpha) background; check `hasAlpha` in the result |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spec | Yes | ||
| error | No | ||
| images | Yes | ||
| status | Yes | ||
| threadId | No | ||
| warnings | Yes | ||
| requested | Yes | ||
| durationMs | Yes |