Skip to content

OpenAI Image Generation

IDgpt_image_gen
CategoryMedia
FeaturesNone
Dependenciessession_file_system, session_storage

Generate new raster images and edit existing ones with OpenAI’s gpt-image-1 model.

This capability resolves credentials server-side, persists durable image artifacts, and can also write generated outputs into the session filesystem under /workspace/.outputs/images/.

The tool layer never reads provider environment variables directly. Resolution order:

  1. Session secret OPENAI_API_KEY (or openai_api_key)
  2. Session secret OPENAI_BASE_URL (or openai_base_url) for endpoint override
  3. Default OpenAI provider credentials from the control plane

Use secret_store for per-session overrides.

Generate one or more images from a prompt.

ParameterTypeRequiredDescription
promptstringyesImage generation prompt
sizeenumno1024x1024, 1536x1024, 1024x1536, auto
qualityenumnolow, medium, high, auto
backgroundenumnotransparent, opaque, auto
formatenumnopng, jpeg, webp
countintegernoNumber of images to generate (1-10)
save_to_session_fsbooleannoSave images into the session filesystem
output_dirstringnoFilesystem output directory (default /workspace/.outputs/images)
filename_prefixstringnoPrefix for artifact and file names
persist_artifactbooleannoPersist into durable image storage (default true)

Edit one or more existing images using a prompt.

ParameterTypeRequiredDescription
promptstringyesEditing prompt
image_idstringconditionalDurable image artifact ID to use as an edit source
pathstringconditionalSession filesystem path to use as an edit source
sizeenumno1024x1024, 1536x1024, 1024x1536, auto
qualityenumnolow, medium, high, auto
backgroundenumnotransparent, opaque, auto
formatenumnopng, jpeg, webp
countintegernoNumber of images to produce (1-10)
save_to_session_fsbooleannoSave outputs into the session filesystem
output_dirstringnoFilesystem output directory (default /workspace/.outputs/images)
filename_prefixstringnoPrefix for artifact and file names
persist_artifactbooleannoPersist into durable image storage (default true)

At least one of image_id or path is required. When both are present, both source images are sent to the edit request.

Both tools return:

  • Native image blocks for direct model consumption
  • Structured JSON with:
    • artifact_id when durable storage is enabled
    • session_file when workspace save is enabled
    • media_type, filename, size_bytes
    • revised_prompt when OpenAI returns one
  • Transparent background requires png or webp output
  • Session file edits must be png, jpg, jpeg, or webp
  • Edit sources larger than 50 MB are rejected before the API call
  • Saved workspace files are written as base64-encoded binary files