你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

ImageGenTool interface

一个利用GPT图像模型生成图像的工具。

扩展

属性

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"