generate_image
Generate images from text prompts using OpenAI's Images API, save output locally, and switch to fallback models when an upstream request fails.
Instructions
Generate images with POST /v1/images/generations (OpenAI Images API). Use for gpt-image-2 and other Images-only models. Do not send those models to chat completions.
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>",
"output_path": "<output_path>"
},
"name": "generate_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | No | Number of images, 1-4. Default 1. | |
| size | No | Output size, e.g. auto or 1024x1024. Defaults to auto. | |
| model | No | Configured model to start with. Defaults to the first model configured for this tool. | |
| prompt | Yes | Text prompt for image generation | |
| quality | No | Image quality | |
| filename | No | Optional AI-chosen basename (Unicode allowed, up to 200 UTF-8 bytes, optional extension). Requires output_path to be a directory. Existing names get numbered suffixes instead of being overwritten. Unsafe names are rejected before generation, not rewritten. | |
| output_path | Yes | File or directory to write. Relative paths resolve against process.cwd(). | |
| auto_fallback | No | Try the next configured model after an upstream failure. Overrides GEN_IMAGE_AUTO_FALLBACK. | |
| output_format | No | Output encoding. Omit to let the upstream service decide the format. |