@@ -1007,18 +1014,23 @@ puts(response.output_text)
| Patch and resizing behavior |
- | GPT-5.6 family |
+
+ `gpt-5.6-sol`, `gpt-5.6-terra`,
+ `gpt-5.6-luna`
+ |
`low`, `high`, `original`,
`auto`
|
- `low` and `high` can resize images under their
- finite limits. `original` preserves the input dimensions and
- does not resize the image to a pixel-dimension or patch-budget limit.
- `auto` and omitted `detail` use the same sizing
- behavior as `original`. Request payload and other image-input
- limits still apply.
+ `low` fits within 512 × 512 pixels. `high` fits
+ within 2048 × 2048 pixels and 2,500 patches. `original`
+ preserves the image's dimensions, except that images larger than 65,535
+ pixels on either side are scaled down to fit that limit. If the resulting
+ image requires more than
+ [30,000 patches](#image-input-requirements), the API rejects
+ the request; the image is not resized to fit the patch limit.
+ `auto` uses the same sizing behavior as `original`.
|
@@ -1030,88 +1042,80 @@ puts(response.output_text)
`auto`
|
- `high` allows up to 2,500 patches or a 2048-pixel maximum
- dimension. `original` allows up to 10,000 patches or a
- 6000-pixel maximum dimension. If either limit is exceeded, we resize the
- image while preserving aspect ratio to fit within the lesser of those two
- constraints for the selected detail level. `auto` and omitted
- `detail` use the same sizing behavior as
- `original`. [Full resizing details
- below.](#patch-based-image-tokenization)
+ `low` fits within 512 × 512 pixels. `high` allows up
+ to 2,500 patches and a 2048-pixel maximum dimension. `original`
+ allows up to 10,000 patches and a 6000-pixel maximum dimension. Both
+ limits apply. `auto` uses the same sizing behavior as
+ `original`.
|
|
- `gpt-5.4`
+ `gpt-5.4`, `gpt-5.4-mini`, `gpt-5.4-nano`
|
`low`, `high`, `original`,
`auto`
|
- `high` allows up to 2,500 patches or a 2048-pixel maximum
- dimension. `original` allows up to 10,000 patches or a
- 6000-pixel maximum dimension. If either limit is exceeded, we resize the
- image while preserving aspect ratio to fit within the lesser of those two
- constraints for the selected detail level. `auto` and omitted
- `detail` use the same sizing behavior as
- `high`. [Full resizing details
- below.](#patch-based-image-tokenization)
+ `low` uses a 2048-pixel maximum dimension and a 6,144-patch
+ budget, so it can use more tokens than `high`.
+ `high` allows up to 2,500 patches and a 2048-pixel maximum
+ dimension. `original` allows up to 10,000 patches and a
+ 6000-pixel maximum dimension. Both limits apply. `auto` uses
+ the same sizing behavior as `high`.
|
|
- `gpt-5.4-mini`, `gpt-5.4-nano`,
- `gpt-5-mini`, `gpt-5-nano`, `gpt-5.2`,
- `gpt-5.3-codex`, `gpt-5-codex-mini`,
- `gpt-5.1-codex-mini`, `gpt-5.2-codex`,
- `gpt-5.2-chat-latest`, `o4-mini`, and the
- `gpt-4.1-mini` and `gpt-4.1-nano` 2025-04-14
- snapshot variants
+ `gpt-5.2`, `gpt-4.1-mini`
|
`low`, `high`, `auto`
|
- `high` allows up to 1,536 patches or a 2048-pixel maximum
- dimension. If either limit is exceeded, we resize the image while
- preserving aspect ratio to fit within the lesser of those two constraints.
- [Full resizing details below.](#patch-based-image-tokenization)
+ These detail levels use the same sizing limits: a 2048-pixel maximum
+ dimension and a 6,144-patch budget. `original` is not
+ supported.
|
|
- `GPT-4o`, `GPT-4.1`, `GPT-4o-mini`,
- `computer-use-preview`, and o-series models except
- `o4-mini`
+ `gpt-5.1`, `gpt-4.1`, `gpt-4o`,
+ `gpt-4o-mini`
|
`low`, `high`, `auto`
|
- Use tile-based resizing behavior. See
- [the detailed behavior below](#gpt-4o-gpt-41-gpt-4o-mini-cua-and-o-series-except-o4-mini)
+ `low` uses a fixed token count. `high` and
+ `auto` use the
+ [tile-based sizing rules](#tile-based-image-tokenization).
|
-## 计算费用
+## 计算成本
+
+视觉模型将图像输入转换为可计费的输入 token。本节 [图像输入成本计算器](https://developers.openai.com/api/docs/guides/image-cost-calculator) 和 patch/tile 规则仅适用于视觉模型输入,不适用于 GPT Image 生成或编辑。有关 [GPT Image 模型输入](#gpt-image-model-inputs) 的单独计费方式,请参阅。
-图像输入按 token 单位计量和计费,与文本输入类似。图像转换为文本 token 输入的方式因模型而异。你可以在 [定价页面](https://openai.com/api/pricing/).
+图像 token 同样计入你的 [每分钟 token 数 (TPM) 限制](https://developers.openai.com/api/docs/guides/rate-limits)。该计算器仅按标准输入费率估算单张图像的费用,不包含你提示词中的其他内容或模型输出。
-### 基于补丁的图像令牌化
+### 图像输入成本计算器
-有些模型通过用 32px x 32px 的补丁覆盖图像来对图像进行分词。许多模型和细节级别的组合定义了最大补丁预算。图像的分词成本按以下方式确定:
+使用 [图像输入成本计算器](https://developers.openai.com/api/docs/guides/image-cost-calculator) 按模型、图像尺寸和细节级别估算单张图片的输入 token 数和成本。
-A. 计算覆盖原始图像所需的 32px x 32px 补丁数量。补丁可以延伸到图像边界之外。
+### 基于分块的图像分词
+
+一些模型通过 32px x 32px 的图像块来对图像进行分词。许多模型和细节级别的组合定义了调整大小的图像块预算。首先,API 会将图像适配所选细节级别的像素尺寸限制之内,保持原始长宽比,并将尺寸取整为整数像素,且不会放大较小的图像。随后按如下方式确定 token 消耗量:
+
+A. 计算在应用像素尺寸限制后覆盖图像所需的 32px x 32px 图像块数量。一个图像块可以延伸到图像边界之外。
```
-original_patch_count = ceil(width/32)×ceil(height/32)
+patch_count = ceil(width/32)×ceil(height/32)
```
-对于 GPT-5.6 模型,当 `detail` 设置为 `original` 或 `auto`,时,服务使用原始补丁计数,而不会将图像调整为补丁预算或像素尺寸限制。这意味着大图像可能比早期模型消耗更多的输入令牌。为了控制令牌使用和延迟,在发送图像前调整其大小,或选择 `low` 或 `high` 细节。
-
-B. 如果原始图像会超过模型的补丁预算,则按比例缩小图像,直到它适合该预算。然后调整缩放比例,使得最终调整大小后的图像在转换为整数像素尺寸并计算补丁覆盖率后仍保持在预算内。
+B. 当所选模型和细节级别指定了调整大小的图像块预算时,如果图像超出该预算,则按比例缩小图像。否则,跳过此步骤。在转换为整数像素尺寸并计算图像块覆盖范围后,再调整缩放比例以保持在预算范围内。在计算最终尺寸之前保留完整的精度。
```
shrink_factor = sqrt((32^2 * patch_budget) / (width * height))
@@ -1121,95 +1125,96 @@ adjusted_shrink_factor = shrink_factor * min(
)
```
-C. 将调整后的缩放比例转换为整数像素尺寸,然后计算覆盖调整大小后图像所需的补丁数量。这个调整大小后的补丁计数是应用模型乘数之前的图像令牌数量,并受模型的补丁预算限制。
+C. 如果步骤 B 对图像进行了缩放,则将最终缩放后的宽度和高度向下取整为整数像素。然后计算覆盖所得图像所需的图像块数量。这是应用模型乘数之前的图像 token 计数。当存在图像块预算时,该数量应保持在预算范围内。
```
resized_patch_count = ceil(resized_width/32)×ceil(resized_height/32)
```
-D. 根据模型应用乘数来获取总令牌数:
+如果该数量超过 30,000 个图像块,API 将拒绝该请求。请在应用 token 乘数之前检查此限制。
-| 模型 | 倍率 |
-| --------------- | ---------- |
-| `gpt-5.4-mini` | 1.62 |
-| `gpt-5.4-nano` | 2.46 |
-| `gpt-5-mini` | 1.62 |
-| `gpt-5-nano` | 2.46 |
-| `gpt-4.1-mini*` | 1.62 |
-| `gpt-4.1-nano*` | 2.46 |
-| `o4-mini` | 1.72 |
+D. 将图像块数量乘以模型的乘数并向上取整,以得到计费的图像输入 token 数。对这些 token 仅应用一次模型的输入价格;该乘数不适用于其他 prompt token,也不会再次计入价格。
-_对于 `gpt-4.1-mini` 和 `gpt-4.1-nano`,这适用于 2025-04-14 快照变体。_
+| 模型 | 倍率 |
+| -------------------------------------- | ---------- |
+| `gpt-5.6-sol` | 1.2 |
+| `gpt-5.6-terra` | 1.2 |
+| `gpt-5.6-luna` | 1.2 |
+| `gpt-5.5` | 1.2 |
+| `gpt-5.4` | 1.2 |
+| `gpt-5.4-mini` | 1.2 |
+| `gpt-5.4-nano` | 1.2 |
+| `gpt-5.2` | 1.2 |
+| `gpt-5-mini`\* | 1.2 |
+| `gpt-5-nano`\* | 1.5 |
+| `gpt-4.1-mini` | 1.62 |
+| `gpt-4.1-nano`\* (2025-04-14 快照) | 2.46 |
+| `o4-mini`\* | 1.72 |
-**预算为 1,536 个补丁的模型的成本计算示例**
+_对于 `gpt-4.1-mini`,这适用于 2025-04-14 快照。_
-- 1024 × 1024 图像在调整大小后的补丁数量为 **1024**
- - A. `original_patch_count = ceil(1024 / 32) * ceil(1024 / 32) = 32 * 32 = 1024`
- - B. `1024` 低于 `1,536` 补丁预算,因此无需调整大小。
- - C. `resized_patch_count = 1024`
- - 模型乘数之前的调整后补丁数量: `1024`
- - 乘以模型的令牌乘数以获得计费令牌单位。
-- 1800 × 2400 图像在调整大小后的补丁数量为 **1452**
- - A. `original_patch_count = ceil(1800 / 32) * ceil(2400 / 32) = 57 * 75 = 4275`
- - B. `4275` 超过 `1,536` 补丁预算,因此我们首先计算 `shrink_factor = sqrt((32^2 * 1536) / (1800 * 2400)) = 0.603`.
- - 然后我们调整该比例,使最终整数像素尺寸在计算补丁后保持在预算内: `adjusted_shrink_factor = 0.603 * min(floor(1800 * 0.603 / 32) / (1800 * 0.603 / 32), floor(2400 * 0.603 / 32) / (2400 * 0.603 / 32)) = 0.586`.
- - 调整大小后的图像尺寸: `1056 × 1408`
- - C. `resized_patch_count = ceil(1056 / 32) * ceil(1408 / 32) = 33 * 44 = 1452`
- - 模型乘数之前的调整后补丁数量: `1452`
- - 乘以模型的令牌乘数以获得计费令牌单位。
+\* 已弃用并计划下线。请参阅 [弃用时间表](https://developers.openai.com/api/docs/deprecations) 以了解日期和替代方案。这些模型未包含在上述计算器或模型规模表中。
-### 基于图块的图像分词
+**成本计算示例 `gpt-5.4` 使用 `detail: high`**
-#### GPT-4o、GPT-4.1、GPT-4o-mini、CUA 和 o 系列(除 o4-mini 外)
+此组合使用 2048 像素的最大尺寸、2,500 个图像块的预算以及 1.2× 倍率。
-图像的成本由两个因素决定:尺寸和详细程度。
+- 一张 1024 × 1024 的图像需要 `32 × 32 = 1024` 个 patch。无需调整大小。可计费的图像输入为 `ceil(1024 × 1.2) = 1229` 个 token。
+- 一张 2048 × 2048 的图像最初需要 `64 × 64 = 4096` 个 patch。patch 预算将其缩小到 1600 × 1600 像素,即 `50 × 50 = 2500` 个 patch。估算值为 `ceil(2500 × 1.2) = 3000` 个 token。
-任何尺寸为 `"detail": "low"` 的图像都会消耗固定的基础 token 数量。该数量因模型而异。要计算尺寸为 `"detail": "high"`,的图像的成本,我们执行以下操作:
+计费中的浮点取整可能导致最终计数与预估相差一个 token。
-- 缩放以适应 2048px x 2048px 的正方形,保持原始宽高比
-- 缩放使图像的短边长度为 768px
-- 计算图像中 512px 正方形的数量。每个正方形消耗固定数量的令牌,如下所示。
-- 将基础令牌添加到总数中
+### 基于块的图像分词
-| 模型 | 基础令牌 | 平铺令牌 |
-| ------------------------------ | ----------- | ----------- |
-| `gpt-5`, `gpt-5-chat-latest` | 70 | 140 |
-| `gpt-4o`, `gpt-4.1`, `gpt-4.5` | 85 | 170 |
-| `gpt-4o-mini` | 2833 | 5667 |
-| `o1`, `o1-pro`, `o3` | 75 | 150 |
-| `computer-use-preview` | 65 | 129 |
+