OpenAI Image Generation
| ID | gpt_image_gen |
| Category | Media |
| Features | None |
| Dependencies | session_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/.
Credential Resolution
Section titled “Credential Resolution”The tool layer never reads provider environment variables directly. Resolution order:
- Session secret
OPENAI_API_KEY(oropenai_api_key) - Session secret
OPENAI_BASE_URL(oropenai_base_url) for endpoint override - Default OpenAI provider credentials from the control plane
Use secret_store for per-session overrides.
generate_image
Section titled “generate_image”Generate one or more images from a prompt.
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | yes | Image generation prompt |
size | enum | no | 1024x1024, 1536x1024, 1024x1536, auto |
quality | enum | no | low, medium, high, auto |
background | enum | no | transparent, opaque, auto |
format | enum | no | png, jpeg, webp |
count | integer | no | Number of images to generate (1-10) |
save_to_session_fs | boolean | no | Save images into the session filesystem |
output_dir | string | no | Filesystem output directory (default /workspace/.outputs/images) |
filename_prefix | string | no | Prefix for artifact and file names |
persist_artifact | boolean | no | Persist into durable image storage (default true) |
edit_image
Section titled “edit_image”Edit one or more existing images using a prompt.
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | yes | Editing prompt |
image_id | string | conditional | Durable image artifact ID to use as an edit source |
path | string | conditional | Session filesystem path to use as an edit source |
size | enum | no | 1024x1024, 1536x1024, 1024x1536, auto |
quality | enum | no | low, medium, high, auto |
background | enum | no | transparent, opaque, auto |
format | enum | no | png, jpeg, webp |
count | integer | no | Number of images to produce (1-10) |
save_to_session_fs | boolean | no | Save outputs into the session filesystem |
output_dir | string | no | Filesystem output directory (default /workspace/.outputs/images) |
filename_prefix | string | no | Prefix for artifact and file names |
persist_artifact | boolean | no | Persist 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.
Result Shape
Section titled “Result Shape”Both tools return:
- Native image blocks for direct model consumption
- Structured JSON with:
artifact_idwhen durable storage is enabledsession_filewhen workspace save is enabledmedia_type,filename,size_bytesrevised_promptwhen OpenAI returns one
- Transparent background requires
pngorwebpoutput - Session file edits must be
png,jpg,jpeg, orwebp - Edit sources larger than 50 MB are rejected before the API call
- Saved workspace files are written as base64-encoded binary files
See Also
Section titled “See Also”- File System — read and reuse workspace images
- Storage — store per-session OpenAI overrides
- Capabilities Overview