ImageGenTool interface

一個利用 GPT 影像模型生成影像的工具。

Extends

屬性

action

是要產生新圖片還是編輯現有圖片。 預設值:auto

background

所產生影像的背景類型。 transparentopaqueauto 的其中之一。 預設值:auto

description

Deprecated. 此屬性已廢止,未來版本將被移除。

input_fidelity

輸入影像處理的保真度等級。

input_image_mask

選擇性遮罩以進行貼圖。 包含 image_url (字串,選擇性) 和 file_id (字串,選擇性)。

model

用於影像產生的模型。

moderation

生成影像的審核層級。 預設值:auto

name

Deprecated. 此屬性已廢止,未來版本將被移除。

output_compression

輸出影像的壓縮層級。 預設值 = 100。

output_format

產生的影像輸出格式。 pngwebpjpeg 的其中之一。 預設值:png

partial_images

在串流模式中產生的部分影像數目,從 0(預設值)到 3。

quality

產生的影像品質。 lowmediumhighauto 的其中之一。。 預設值:auto

size

產生的影像大小。 對於 gpt-image-2gpt-image-2-2026-04-21,支持任意解析作為 WIDTHxHEIGHT 字串,例如 1536x864。 寬度與高度必須皆可被16整除,且要求的長寬比必須介於1:3至3:1之間。 上述 2560x1440 解析度為實驗性解析度,最大支援解析度為 3840x2160。 所請求的尺寸也必須符合模型目前的像素與邊緣限制。 標準尺寸1024x1024、、、1024x1536均由GPT影像模型支援;auto支援自動調整1536x1024尺寸的模型。 對於 dall-e-2,請使用其中 256x256之一 、 512x5121024x1024。 對於 dall-e-3,請使用其中 1024x1024之一 、 1792x10241024x1792

tool_configs

Deprecated. 此屬性已廢止,未來版本將被移除。

type

影像產生工具的類型。 一律為 image_generation

屬性詳細資料

action

是要產生新圖片還是編輯現有圖片。 預設值:auto

action?: ImageGenAction

屬性值

background

所產生影像的背景類型。 transparentopaqueauto 的其中之一。 預設值:auto

background?: "auto" | "transparent" | "opaque"

屬性值

"auto" | "transparent" | "opaque"

description

Deprecated. 此屬性已廢止,未來版本將被移除。

description?: string

屬性值

string

input_fidelity

輸入影像處理的保真度等級。

input_fidelity?: InputFidelity

屬性值

input_image_mask

選擇性遮罩以進行貼圖。 包含 image_url (字串,選擇性) 和 file_id (字串,選擇性)。

input_image_mask?: ImageGenToolInputImageMask

屬性值

model

用於影像產生的模型。

model?: "gpt-image-1" | "gpt-image-1-mini" | "gpt-image-1.5"

屬性值

"gpt-image-1" | "gpt-image-1-mini" | "gpt-image-1.5"

moderation

生成影像的審核層級。 預設值:auto

moderation?: "auto" | "low"

屬性值

"auto" | "low"

name

Deprecated. 此屬性已廢止,未來版本將被移除。

name?: string

屬性值

string

output_compression

輸出影像的壓縮層級。 預設值 = 100。

output_compression?: number

屬性值

number

output_format

產生的影像輸出格式。 pngwebpjpeg 的其中之一。 預設值:png

output_format?: "png" | "webp" | "jpeg"

屬性值

"png" | "webp" | "jpeg"

partial_images

在串流模式中產生的部分影像數目,從 0(預設值)到 3。

partial_images?: number

屬性值

number

quality

產生的影像品質。 lowmediumhighauto 的其中之一。。 預設值:auto

quality?: "auto" | "low" | "medium" | "high"

屬性值

"auto" | "low" | "medium" | "high"

size

產生的影像大小。 對於 gpt-image-2gpt-image-2-2026-04-21,支持任意解析作為 WIDTHxHEIGHT 字串,例如 1536x864。 寬度與高度必須皆可被16整除,且要求的長寬比必須介於1:3至3:1之間。 上述 2560x1440 解析度為實驗性解析度,最大支援解析度為 3840x2160。 所請求的尺寸也必須符合模型目前的像素與邊緣限制。 標準尺寸1024x1024、、、1024x1536均由GPT影像模型支援;auto支援自動調整1536x1024尺寸的模型。 對於 dall-e-2,請使用其中 256x256之一 、 512x5121024x1024。 對於 dall-e-3,請使用其中 1024x1024之一 、 1792x10241024x1792

size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024"

屬性值

"auto" | "1024x1024" | "1024x1536" | "1536x1024"

tool_configs

Deprecated. 此屬性已廢止,未來版本將被移除。

tool_configs?: Record<string, ToolConfig>

屬性值

Record<string, ToolConfig>

type

影像產生工具的類型。 一律為 image_generation

type: "image_generation"

屬性值

"image_generation"