> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vidgo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Ideogram 4.6 图像编辑

> Ideogram 4.6 图像编辑 API 根据文字指令编辑一张图片，支持 2K 或 4K、可选蒙版、最多 4 张参考图以及 regular 或 high 编辑精度。

> [!TIP]
>
> 1. 提交后会返回 `task_id`。如果提供了 `callback_url`，当任务状态变为 `finished` 或 `failed` 时，系统会向 `callback_url` 发送 POST 请求。
> 2. 无论是否提供 `callback_url`，都可以通过统一的[查询任务状态](https://docs.vidgo.ai/zh/api-manual/task-management/status.md)接口获取结果。

Ideogram 4.6 图像编辑根据文字指令修改一张已有图片。可以用蒙版把编辑限定在某个区域，用最多 4 张参考图引导结果；需要其余部分保持原样时选择 `high` 编辑精度。典型用途包括替换商品或招牌文字、修饰背景，以及以 2K 或 4K 生成设计稿的不同版本。

Ideogram 4.6 是 Ideogram 的图像模型。Ideogram 文档写明它“可生成最高 4K 的图片”，并提供 Very low、Low、Medium、High 四档质量。Vidgo 提供两个模型 ID：[文生图](https://docs.vidgo.ai/zh/api-manual/image-series/ideogram-v4-6-text-to-image.md)和[图像编辑](https://docs.vidgo.ai/zh/api-manual/image-series/ideogram-v4-6-edit.md)。

## 模型

* **ideogram/v4.6/edit** — Ideogram 4.6 图像编辑：一张原图，可选蒙版和参考图，每次 1–8 个结果。

## 功能

* 用自然语言指令编辑图片，包括替换图中的文字。
* 可选蒙版，把编辑限定在一个区域内。
* 最多 4 张参考图引导风格或内容（使用蒙版时最多 3 张）。
* `edit_precision: high` 用于精确编辑，蒙版高精度编辑可配合 `context_window: auto`。
* 四档质量、每次 1–8 个结果、透明背景和 `seed`。

## 输入模式

* **指令编辑**：`image_urls` + `prompt`，由模型决定修改哪个区域。
* **蒙版编辑**：加上 `mask_url`（黑色 = 编辑，白色 = 保留），`size` 保持 `auto`。需要精确的蒙版编辑时加上 `edit_precision: high`，并可设置 `context_window: auto`。
* 两种模式都可以加 `reference_image_urls`。

## 必填参数

* `prompt` (string)：要修改什么、怎么修改，1–10,000 个字符，至少包含一个非空白字符。
* `image_urls` (string\[])：恰好一张待编辑的图片。公开可访问的 HTTP(S) URL 或 `data:image/...;base64,...` 数据 URI。

## 可选参数

* `mask_url` (string)：与原图同尺寸的蒙版，黑色为编辑区域，白色为保留区域。公开 HTTP(S) URL 或图片数据 URI。使用时 `size` 保持 `auto`。
* `reference_image_urls` (string\[])：最多 4 张参考图，使用 `mask_url` 时最多 3 张。参考图用于引导结果，本身保持不变。URL 或图片数据 URI。
* `edit_precision` (string)：`regular` 或 `high`。默认 `regular`。`high` 让其余部分保持原样，使用 `size: auto`。
* `context_window` (string)：`none` 或 `auto`。默认 `none`。`auto` 要求 `edit_precision: high` 和 `mask_url`。
* `quality` (string)：`very_low`、`low`、`medium` 或 `high`。默认 `medium`。`very_low` 用于 2K 档。
* `size` (string)：输出尺寸。默认 `auto`。参见[尺寸](#尺寸)。
* `background` (string)：`transparent` 或 `opaque`，用于 `edit_precision: regular`。省略时由模型自动选择背景。
* `n` (integer)：结果数量，`1`–`8`。默认 `1`。
* `seed` (integer)：`0`–`2147483647`。

## 尺寸

* `auto`（默认）沿用原图尺寸，是带 `mask_url` 或 `edit_precision: high` 的请求所用的尺寸。
* 使用 `edit_precision: regular` 且未设置 `mask_url` 时，也可以选择预设（`1:1`、`1:1 HD`、`4:3`、`3:4`、`16:9`、`9:16`）或自定义尺寸。
* 自定义 `WIDTHxHEIGHT` 使用小写 `x`（例如 `2048x1152`）：每边 256–4096 像素且为 32 的倍数，长边最多为短边的 6 倍。
* 档位：预设和面积不超过 4,194,304 像素（2048x2048）的自定义尺寸为 2K 档，更大的自定义尺寸为 4K 档。`size: auto` 时，`very_low` 为 2K 档，其他质量按原图像素面积确定档位。

## 输出

任务完成后，[查询任务状态](https://docs.vidgo.ai/zh/api-manual/task-management/status.md)和回调内容的 `files` 数组中按生成的图片数量返回文件，每张图片一个。

## 示例

* **仅用指令编辑**：修改面包店招牌上的文字，`size: auto`，`low` 质量。
* **带参考图的蒙版高精度编辑**：花瓶蒙版加茶壶参考图，`edit_precision: high`、`context_window: auto`、`quality: high`，并设置 `callback_url`。
* **方形透明背景版本**：把吉祥物做成贴纸，`size: 1:1`、`background: transparent`、`n: 2`。

## 注意事项

* `input` 接收上文列出的字段，其他字段返回 400。`model` 和 `callback_url` 放在请求根级，与 `input` 并列。只用提示词生成图片时，请使用 [Ideogram 4.6 文生图](https://docs.vidgo.ai/zh/api-manual/image-series/ideogram-v4-6-text-to-image.md)。
* 以下组合返回 400：`size` 为 `auto` 以外的值，同时设置了 `mask_url` 或 `edit_precision: high`；`background` 与 `edit_precision: high` 同时使用；`context_window: auto` 但未同时满足 `edit_precision: high` 和 `mask_url`；蒙版搭配 4 张参考图；`very_low` 搭配面积超过 4,194,304 像素的自定义尺寸。
* 按张计费，费率由 `quality` 和输出档位（2K 或 4K）决定，再乘以 `n`。显式指定 `size` 时按该尺寸确定档位。`size: auto` 时，`very_low` 按 2K 档计费；其他质量在提交时按原图像素面积估算档位（读取不到图片尺寸时按 4K 档预扣），任务完成后按最终实际费用结算并退还差额，例如按 4K 预扣但实际输出为 2K 时。任务失败会全额退还。当前费率见[定价页](https://vidgo.ai/apis/api-pricing)。


## OpenAPI

````yaml zh/api-manual/image-series/ideogram-v4-6-edit.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Vidgo API - Ideogram 4.6 图像编辑
  description: >-
    Ideogram 4.6 图像编辑 API 根据文字指令编辑一张图片，支持 2K 或 4K、可选蒙版、最多 4 张参考图以及 regular 或
    high 编辑精度。
  version: 1.0.0
servers:
  - url: https://api.vidgo.ai
    description: 生产环境服务器
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - Ideogram 4.6 Edit
      summary: 提交 Ideogram 4.6 图像编辑 任务
      operationId: submitIdeogram46EditTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitRequest'
            examples:
              instruction:
                summary: 仅用指令编辑
                value:
                  model: ideogram/v4.6/edit
                  input:
                    prompt: >-
                      Change the bakery sign text to "MIGA & CO" and keep
                      everything else the same
                    image_urls:
                      - https://example.com/bakery-front.jpg
                    quality: low
              masked-high:
                summary: 带参考图的蒙版高精度编辑
                value:
                  model: ideogram/v4.6/edit
                  callback_url: https://your-domain.com/callback
                  input:
                    prompt: >-
                      Replace the empty vase on the table with the ceramic
                      teapot from the reference image
                    image_urls:
                      - https://example.com/kitchen-table.jpg
                    mask_url: https://example.com/kitchen-table-mask.png
                    reference_image_urls:
                      - https://example.com/teapot.png
                    edit_precision: high
                    context_window: auto
                    quality: high
              resize-transparent:
                summary: 方形透明背景版本
                value:
                  model: ideogram/v4.6/edit
                  input:
                    prompt: >-
                      Turn the mascot into a clean sticker with a thick white
                      outline
                    image_urls:
                      - https://example.com/mascot.png
                    size: '1:1'
                    background: transparent
                    'n': 2
                    quality: medium
      responses:
        '200':
          description: 任务提交结果。任务 ID 标识一项异步任务；生成可能仍在进行中。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
        '400':
          description: 请求参数无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: 未授权
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SubmitRequest:
      type: object
      required:
        - model
        - input
      additionalProperties: false
      properties:
        model:
          type: string
          example: ideogram/v4.6/edit
        callback_url:
          type: string
          format: uri
          description: 可选的 Webhook URL，用于接收完成或失败通知。
          example: https://your-domain.com/callback
        input:
          type: object
          required:
            - prompt
            - image_urls
          additionalProperties: false
          properties:
            prompt:
              type: string
              minLength: 1
              maxLength: 10000
              description: 要修改什么、怎么修改。1–10,000 个字符，至少包含一个非空白字符。
            image_urls:
              type: array
              minItems: 1
              maxItems: 1
              items:
                type: string
                format: uri
                description: 公开可访问的 HTTP(S) URL，或 `data:image/...;base64,...` 数据 URI。
              description: 必填，恰好一张待编辑的图片。
            mask_url:
              type: string
              format: uri
              description: >-
                可选蒙版，与原图同尺寸，黑色为编辑区域、白色为保留区域。公开可访问的 HTTP(S) URL，或
                `data:image/...;base64,...` 数据 URI。


                使用蒙版时 `size` 保持 `auto`。
            reference_image_urls:
              type: array
              maxItems: 4
              items:
                type: string
                format: uri
                description: 公开可访问的 HTTP(S) URL，或 `data:image/...;base64,...` 数据 URI。
              description: 可选参考图，用于引导风格或内容，本身不会被编辑。最多 4 张；同时使用 `mask_url` 时最多 3 张。
            edit_precision:
              type: string
              enum:
                - regular
                - high
              default: regular
              description: >-
                编辑精度。`high` 用于需要其余部分保持原样的精确编辑，搭配 `size: auto` 使用。`background` 用于
                `regular` 精度。
            context_window:
              type: string
              enum:
                - none
                - auto
              default: none
              description: '蒙版高精度编辑的上下文设置。`auto` 要求同时设置 `edit_precision: high` 和 `mask_url`。'
            quality:
              type: string
              enum:
                - very_low
                - low
                - medium
                - high
              default: medium
              description: >-
                渲染质量，按张计费的档位之一。`very_low` 用于 2K 档（输出面积不超过 4,194,304 像素）；4K 档支持
                `low`、`medium`、`high`。
            size:
              type: string
              default: auto
              description: >-
                输出尺寸。`auto` 沿用原图尺寸。


                预设（`1:1`、`1:1 HD`、`4:3`、`3:4`、`16:9`、`9:16`）和自定义尺寸用于
                `edit_precision: regular` 且未设置 `mask_url` 的请求。


                自定义 `WIDTHxHEIGHT` 使用小写 `x`（例如 `2048x1152`）：每边 256–4096 像素且为 32
                的倍数，长边最多为短边的 6 倍。


                面积不超过 4,194,304 像素（2048x2048）为 2K 档，更大为 4K 档；预设属于 2K 档。
            background:
              type: string
              enum:
                - transparent
                - opaque
              description: >-
                背景类型，用于 `edit_precision: regular`。`transparent`
                输出带透明通道的图片。省略时由模型自动选择背景。
            'n':
              type: integer
              minimum: 1
              maximum: 8
              default: 1
              description: 生成结果数量。
            seed:
              type: integer
              minimum: 0
              maximum: 2147483647
              description: 随机种子。固定种子并保持其他参数不变，可以复现相近的结果。
    SubmitResponse:
      type: object
      required:
        - code
        - data
      properties:
        code:
          type: integer
          example: 200
        data:
          type: object
          required:
            - task_id
            - status
            - created_time
          properties:
            task_id:
              type: string
              example: task-example-001
            status:
              type: string
              example: not_started
            created_time:
              type: string
              format: date-time
              example: '2026-11-25T10:30:00'
    ErrorResponse:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
          description: 错误信息。参见[错误码](/zh/api-manual/error-codes)。
          example: prompt is required
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: '使用 `Authorization: Bearer VIDGO_API_KEY`。'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.