Monoize
Transforms

Image: enable OpenAI generation tool

Ensure the OpenAI Responses image_generation tool exists on the request.

What it does

This transform adds the OpenAI Responses image_generation tool descriptor to the request when it is missing. It can also force streaming and force the tool choice.

Configure this transform when an Images API route uses a Responses upstream. Without a compatible image tool, the route returns an explicit error.

Images API request values override tool defaults for size, quality, background, output_format, output_compression, moderation, partial_images, and input_fidelity. This also applies to an existing image tool. Image background stays inside the tool configuration. It does not replace the Responses top-level boolean background.

An edit mask becomes the tool's input_image_mask, not an ordinary input image. URL, inline Base64, and file-reference masks are supported. File references must be accessible with the selected upstream credentials. Responses routes reject image style and response_format="url" because this tool cannot represent them.

With force_stream=true, the transform defaults partial_images to 3 only when both the request and tool omit it. Explicit values, including 0, remain unchanged.

Reference

PropertyValue
Type IDimage_enable_openai_generation_tool
Phaserequest
ScopesProvider, API key

When to use

  • Clients send plain text prompts but the route should produce images through the Responses image tool.
  • A client cannot configure tools itself.

Configuration

OptionTypeRequiredDefaultDescription
output_formatstringNo"png"png, webp, or jpeg. Default format when the image request omits it.
actionstringNo—Optional action value written into the tool descriptor.
force_streambooleanNofalseForce the upstream request to stream with partial images.
force_tool_choicebooleanNofalseForce tool choice to the image generation tool.
extraobjectNo{}Additional tool defaults. Explicit image request values take precedence.

Example rule

{
  "transform": "image_enable_openai_generation_tool",
  "enabled": true,
  "phase": "request",
  "models": [
    "gpt-image*"
  ],
  "config": {
    "output_format": "webp",
    "force_tool_choice": true
  }
}

On this page