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

# 将 Ideogram V3 与 Comfy Router 配合使用

> 通过 Comfy Router 调用 ideogram/ideogram-v3：endpoint、请求结构与 Router 返回的响应。

`ideogram/ideogram-v3` 的 API 参考，由 Comfy Router 提供，来源于 Ideogram。

## 快速开始

在[你的 Comfy 工作区](https://platform.comfy.org/profile/api-keys)中创建一个密钥，并将其导出为 `COMFY_API_KEY`。Python 和 TypeScript 代码片段使用 Comfy SDK（`pip install comfy-sdk`、`npm install @comfyorg/sdk`）；cURL 代码片段则是通过原始 HTTP 执行的同一调用。

**模型 ID：** `ideogram/ideogram-v3`

**端点：** `POST https://api.comfy.org/v2/models/ideogram/ideogram-v3`

<Tabs>
  <Tab title="Wait for the result">
    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # Reads COMFY_API_KEY from the environment.
      # The SDK automatically creates an idempotency key and reuses it for automatic retries.
      with Comfy() as client:
          result = client.models.run(
              "ideogram/ideogram-v3",
              {
                  "prompt": "A beautiful mountain landscape",
                  "rendering_speed": "TURBO",
              },
          )

      print(result)
      ```

      ```typescript TypeScript theme={null}
      import { comfy } from "@comfyorg/sdk";

      // Reads COMFY_API_KEY from the environment.
      // The SDK automatically creates an idempotency key and reuses it for automatic retries.
      const { data } = await comfy.models.run("ideogram/ideogram-v3", {
        prompt: "A beautiful mountain landscape",
        rendering_speed: "TURBO",
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/ideogram/ideogram-v3 \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"prompt\": \"A beautiful mountain landscape\", \"rendering_speed\": \"TURBO\"}"
      ```
    </CodeGroup>
  </Tab>

  <Tab title="Queue and collect later">
    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # Reads COMFY_API_KEY from the environment.
      # Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.
      with Comfy() as client:
          handle = client.models.submit(
              "ideogram/ideogram-v3",
              {
                  "prompt": "A beautiful mountain landscape",
                  "rendering_speed": "TURBO",
              },
          )
          print("request_id:", handle.request_id)  # with the model ID, all another process needs

          # Poll until the request completes, waiting the Retry-After the server names.
          for update in handle.iter_events():
              print(update.status, update.queue_position)

          # The provider's own payload, the same value models.run() returns.
          # A request that failed or was cancelled raises the typed Router error here.
          result = handle.get()

      print(result)
      ```

      ```typescript TypeScript theme={null}
      import { comfy } from "@comfyorg/sdk";

      // Reads COMFY_API_KEY from the environment.
      // Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.
      const handle = await comfy.models.submit("ideogram/ideogram-v3", {
        prompt: "A beautiful mountain landscape",
        rendering_speed: "TURBO",
      });
      console.log("requestId:", handle.requestId); // with the model ID, all another process needs

      // Poll until the request completes, waiting the Retry-After the server names.
      for await (const update of handle.events()) {
        console.log(update.status, update.queuePosition);
      }

      // The same result models.run() returns. A request that failed or was cancelled rejects here.
      const result = await handle.get();

      console.log(result.data);
      ```

      ```bash cURL theme={null}
      # 1. Submit. Router answers 201 with request_id, status_url, response_url and cancel_url.
      curl https://api.comfy.org/v2/models/ideogram/ideogram-v3/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"prompt\": \"A beautiful mountain landscape\", \"rendering_speed\": \"TURBO\"}"

      # 2. Poll until status is COMPLETED, waiting the Retry-After seconds each response names.
      REQUEST_ID="<request_id from the 201 body>"
      curl -i https://api.comfy.org/v2/models/ideogram/ideogram-v3/requests/$REQUEST_ID/status \
        -H "X-API-Key: $COMFY_API_KEY"

      # 3. Collect. 200 with the model's native output, 202 with the status body while it is still running.
      curl https://api.comfy.org/v2/models/ideogram/ideogram-v3/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## Schema

### 输入

<ParamField body="aspect_ratio" type="string">
  宽高比，格式为 WxH
</ParamField>

<ParamField body="color_palette" type="object" />

<ParamField body="color_palette.members" type="object[]">
  显式指定的颜色，可带可选权重
</ParamField>

<ParamField body="color_palette.members[].color" type="string">
  十六进制颜色代码
</ParamField>

<ParamField body="color_palette.members[].weight" type="number">
  该颜色的可选权重（0-1）

  范围：`0` 到 `1`
</ParamField>

<ParamField body="color_palette.name" type="string">
  调色板的名称
</ParamField>

<ParamField body="magic_prompt" type="string">
  是否启用 magic prompt 增强

  可选值：`AUTO`、`ON`、`OFF`
</ParamField>

<ParamField body="negative_prompt" type="string">
  用于指定生成时应避免出现内容的文本提示词
</ParamField>

<ParamField body="num_images" type="integer">
  要生成的图像数量

  范围：`1` 到 `…`
</ParamField>

<ParamField body="prompt" type="string" required>
  用于图像生成的文本提示词
</ParamField>

<ParamField body="rendering_speed" type="string" required default="&#x22;DEFAULT&#x22;">
  渲染速度设置，用于控制生成速度与质量之间的权衡

  可选值：`DEFAULT`、`TURBO`、`QUALITY`
</ParamField>

<ParamField body="resolution" type="string">
  图像分辨率，格式为 WxH
</ParamField>

<ParamField body="seed" type="integer">
  用于可复现生成的种子值
</ParamField>

<ParamField body="style_codes" type="string[]">
  十六进制格式的风格代码数组
</ParamField>

<ParamField body="style_type" type="string" default="&#x22;GENERAL&#x22;">
  可选值：`AUTO`、`GENERAL`、`REALISTIC`、`DESIGN`、`FICTION`
</ParamField>

根据 Router 在 `GET /v2/models/ideogram/ideogram-v3/openapi.json` 提供的 schema 生成，该文档与 Router 在请求抵达提供商之前用于校验调用的文档相同。

### 输出

<ResponseField name="created" type="string (date-time)">
  生成创建时的时间戳。

  格式：`date-time`
</ResponseField>

<ResponseField name="data" type="object[]">
  已生成图像的信息数组。
</ResponseField>

<ResponseField name="data[].is_image_safe" type="boolean">
  表示该图像是否被视为安全。
</ResponseField>

<ResponseField name="data[].prompt" type="string">
  用于生成此图像的提示词。
</ResponseField>

<ResponseField name="data[].resolution" type="string">
  已生成图像的分辨率（例如 '1024x1024'）。
</ResponseField>

<ResponseField name="data[].seed" type="integer">
  此次生成所使用的种子值。
</ResponseField>

<ResponseField name="data[].style_type" type="string">
  生成所使用的风格类型（例如 'REALISTIC'、'ANIME'）。
</ResponseField>

<ResponseField name="data[].url" type="string">
  已生成图像的 URL。
</ResponseField>

## 示例

### 输入

```json theme={null}
{
  "prompt": "A beautiful mountain landscape",
  "rendering_speed": "TURBO"
}
```

### 输出

```json theme={null}
{
  "created": "2026-01-01T00:00:00Z",
  "data": [
    {
      "is_image_safe": true,
      "prompt": "A poster for a jazz festival, bold typography, warm colours",
      "resolution": "1024x1024",
      "seed": 918273645,
      "style_type": "REALISTIC",
      "url": "https://example.invalid/ideogram/ideogram-v3/generated.png"
    }
  ]
}
```

## 发布前须知

SDK 会生成 `Idempotency-Key` 并在自动重试中复用它。手动重试时，请复用原始 key。Router 最长可保持连接 10 分钟。

请求失败时，Router 会发送 `X-Comfy-Error-Type` 响应头说明原因。`422` 表示 Router 在调用提供商之前就拒绝了输入。生成的资源请及时下载，因为[结果链接会过期](/zh/development/comfy-router/reference#结果资产)。

<CardGroup cols={3}>
  <Card title="请求头" icon="list" href="/zh/development/comfy-router/quickstart">
    身份验证、幂等性、请求 ID、错误分类、重试节奏、消费限额。
  </Card>

  <Card title="使用 Router API" icon="code" href="/zh/development/comfy-router/quickstart">
    模型发现、校验错误、重试与计费。
  </Card>

  <Card title="限制" icon="triangle-exclamation" href="/zh/development/comfy-router/limitations">
    Router 目前不支持的功能，以及替代方案。
  </Card>
</CardGroup>
