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

# 图片生成接口

>  为了方便开发者调用不同的图像生成模型，AIHubMix 提供了统一的图片生成接口

## 可用模型列表

<Tip>
  Nano  Banana 系列请参考：[https://docs.aihubmix.com/cn/api/Gemini-Guides](https://docs.aihubmix.com/cn/api/Gemini-Guides)
</Tip>

### OpenAI 模型

* [gpt-image-2](https://aihubmix.com/model/gpt-image-2) —— 已支持通过 OpenAI 兼容接口调用图片编辑，模型 ID 需要写完整为 `gpt-image-2`，不能简写为 `image2`。
* [gpt-image-1.5 ](https://aihubmix.com/model/gpt-image-1.5)—— OpenAI 最新的图像生成模型，它具有更好的指令遵循性和对提示的执行能力。
* [gpt-image-1](https://aihubmix.com/model/gpt-image-1) —— 多模态语言模型，它接受文本和图像输入，并生成图像输出。
* [gpt-image-1-mini](https://aihubmix.com/model/gpt-image-1-mini) —— gpt-image-1 的经济型版本。
* [dall-e-3](https://aihubmix.com/model/dall-e-3) —— 能够根据自然语言描述创建逼真的图像和艺术作品,支持根据提示创建指定尺寸的新图像。

### Imagen 模型

* [imagen-4.0-ultra-generate-001](https://aihubmix.com/model/imagen-4.0-ultra-generate-001)
* [imagen-4.0-generate-001](https://aihubmix.com/model/imagen-4.0-generate-001)
* [imagen-4.0-fast-generate-001](https://aihubmix.com/model/imagen-4.0-fast-generate-001)
* [imagen-4.0-fast-generate-preview-06-06](https://aihubmix.com/model/imagen-4.0-fast-generate-preview-06-06)
* [imagen-3.0-generate-002](https://aihubmix.com/model/imagen-3.0-generate-002)

### 阿里云模型

#### Wan（万相）系列

* [wan2.7-image-pro](https://aihubmix.com/model/wan2.7-image-pro) —— 万相 2.7 专业版，支持思考模式与最高 4K 分辨率
* [wan2.7-image](https://aihubmix.com/model/wan2.7-image) —— 万相 2.7 标准版，最高支持 2K 分辨率
* [wan2.6-t2i](https://aihubmix.com/model/wan2.6-t2i) —— 万相 2.6 文生图

#### Qwen-Image（千问图像）系列

* [qwen-image](https://aihubmix.com/model/qwen-image) —— 图像生成基础模型，在复杂文本渲染和精确图像编辑方面取得了显著进展
* [qwen-image-edit](https://aihubmix.com/model/qwen-image-edit) —— 图像编辑模型，单图编辑和多图融合
* [qwen-image-2.0-pro](https://aihubmix.com/model/qwen-image-2.0-pro) —— 2.0 专业版，文字渲染和语义理解更强，同时支持图片编辑
* [qwen-image-2.0](https://aihubmix.com/model/qwen-image-2.0) —— 2.0 加速版，兼顾质量和速度，同时支持图片编辑
* [qwen-image-max](https://aihubmix.com/model/qwen-image-max) —— Max 版，擅长工业设计和几何推理
* [qwen-image-plus](https://aihubmix.com/model/qwen-image-plus) —— Plus 版，支持多图和自定义分辨率
* [qwen-image-edit-plus](https://aihubmix.com/model/qwen-image-edit-plus) —— 编辑 Plus 版，支持多输出和自定义分辨率
* [qwen-image-edit-max](https://aihubmix.com/model/qwen-image-edit-max) —— 编辑 Max 版，擅长工业设计和几何推理

### GLM 模型

* [glm-image](https://aihubmix.com/model/glm-image) —— 智谱 AI 发布的图像生成模型，支持高清（hd）和标准（standard）两种质量模式。

### Doubao 模型

* [doubao-seedream-5.0-lite](https://aihubmix.com/model/doubao-seedream-5.0-lite) —— 字节跳动发布的最新图像创作模型，该模型首次搭载联网检索功能，能融合实时网络信息，提升生图时效性。
* [doubao-seedream-4-5](https://aihubmix.com/model/doubao-seedream-4-5) —— 字节跳动推出的图像多模态模型，整合了文生图、图生图、组图输出等能力。
* [doubao-seedream-4-0](https://aihubmix.com/model/doubao-seedream-4-0) —— 字节跳动SOTA级多模态图像创作模型，支持多图融合创作、图像编辑、组图生成等多样玩法。

### iRAG 模型

* [irag-1.0](https://aihubmix.com/model/irag-1.0) —— 百度自研生图模型，能够生成超真实图片。
* [ernie-irag-edit](https://aihubmix.com/model/ernie-irag-edit) —— 百度自研的图像编辑模型，支持基于图片进行 erase、repaint、variation 等操作。

### Ideogram 模型

* [V3](https://aihubmix.com/model/V3) —— Ideogram AI 生图模型，能够快速生成图片。

## API 接口

### zimage 接口

```shellscript theme={null}

POST https://aihubmix.com/v1/models/<model_path>/predictions
```

<Tip>
  \<model\_path> 为\<供应商/模型id>，如\<openai/gpt-image-1.5>，\<qianfan/qwen-image>。
</Tip>

### openai 兼容接口

**文生图**

```shellscript theme={null}
POST https://aihubmix.com/v1/images/generations
```

**图片编辑**

```shellscript theme={null}
POST https://aihubmix.com/v1/images/edits
```

### 请求头

```shellscript theme={null}
Authorization: Bearer $AIHUBMIX_API_KEY
Content-Type: application/json
```

### 请求参数

#### 通用参数

| 参数      | 类型      | 必填 | 说明                                                                                                                                      |
| ------- | ------- | -- | --------------------------------------------------------------------------------------------------------------------------------------- |
| prompt  | string  | 是  | 提示词                                                                                                                                     |
| size    | string  | 否  | 图像尺寸，支持`1K`(Doubao-4-5系列不支持)、`2K`、`4K`、`auto` (默认)。Qwen系列支持参数：`512*1024`、`768*512`、 `768*1024`、 `1024*576`、 `576*1024`、 `1024*1024`（默认） |
| image   | string  | 否  | 参考图片路径                                                                                                                                  |
| n       | integer | 否  | 生成图像数量，支持1-10，默认为 1。Imagen 模型该参数不生效                                                                                                     |
| quality | string  | 否  | 渲染质量，支持 `low` 、`medium` 和`high`，质量越高，耗时越长                                                                                               |

#### OpenAI 模型参数

| 参数              | 类型     | 必填 | 说明                                                    |
| --------------- | ------ | -- | ----------------------------------------------------- |
| input\_fidelity | string | 否  | 保真度，支`high`和 `low`（默认）                                |
| moderation      | string | 否  | 内容审核严格程度，支持 `auto` （默认，标准过滤）和 `low`（过滤限制较少），图生图模式下不支持 |
| output\_format  | string | 否  | 输出图片格式，支持 `png` 、 `jpeg`  （默认）  、`webp`               |

#### Imagen 模型参数

| 参数          | 类型      | 必填 | 说明           |
| ----------- | ------- | -- | ------------ |
| sampleCount | integer | 否  | 生成图像数量，默认为 4 |

#### Flux 模型参数

| 参数                | 类型      | 必填 | 说明                                     |
| ----------------- | ------- | -- | -------------------------------------- |
| safety\_tolerance | integer | 否  | 审核宽松度，数值越大越宽松。支持范围 `0<=x<=5` ，默认值为 `2` |
| aspect\_ratio     | string  | 否  | 图像所需的宽高比，支持`16:9`（默认）， `1:1` 、`4:3`    |
| seed              | integer | 否  | 随机数种子                                  |
| raw               | boolean | 否  | 是否启用原始模式，获得更自然的视觉效果，默认`false`          |

#### FLUX-1.1-pro 模型参数

| 参数                 | 类型      | 默认值       | 必填 | 说明                       |
| ------------------ | ------- | --------- | -- | ------------------------ |
| prompt             | string  | -         | 是  | 图像的文本描述                  |
| size               | string  | 1024x1024 | 否  | 图像尺寸（像素）                 |
| prompt\_upsampling | boolean | false     | 否  | 是否对提示词进行增强优化以获得更好的效果     |
| seed               | integer | null      | 否  | 随机数种子，用于结果复现，可填任意整数      |
| safety\_tolerance  | integer | 2         | 否  | 内容审核级别，范围 0（最严格）到 6（最宽松） |
| output\_format     | string  | jpeg      | 否  | 输出图片格式，支持 `jpeg` 和 `png` |

<Tip>
  `prompt_upsampling`、`safety_tolerance`、`seed` 需放在请求体的 `extra_body` 字段内传递。
</Tip>

#### 阿里云模型参数

阿里云模型支持两种调用方式：OpenAI 兼容接口和 zimage 原生接口。

**OpenAI 兼容接口 — 标准参数**

| 参数               | 类型      | 必填 | 默认值       | 说明                      |
| ---------------- | ------- | -- | --------- | ----------------------- |
| model            | string  | 是  | -         | 模型名称                    |
| prompt           | string  | 是  | -         | 图像描述提示词，最长 800 字符       |
| n                | integer | 否  | 1         | 生成图片数量，取值范围因模型而异        |
| size             | string  | 否  | 1024x1024 | 图片尺寸，格式 `宽x高`           |
| response\_format | string  | 否  | url       | 返回格式：`url` 或 `b64_json` |

**OpenAI 兼容接口 — 扩展参数（与 `model`、`prompt` 同级传递）**

| 参数               | 类型      | 默认值   | 支持模型                 | 说明                                              |
| ---------------- | ------- | ----- | -------------------- | ----------------------------------------------- |
| thinking\_mode   | boolean | true  | wan2.7 系列            | 思考模式，提升生成质量，增加耗时约 10-30s                        |
| negative\_prompt | string  | -     | qwen-image 系列、wan2.6 | 反向提示词，最长 500 字符。wan2.7 系列请在 prompt 中使用「不要出现 XX」 |
| prompt\_extend   | boolean | true  | qwen-image 系列、wan2.6 | 提示词智能改写，wan2.7 系列不支持                            |
| seed             | integer | 随机    | 全部                   | 随机种子，范围 `0`-`2147483647`                        |
| watermark        | boolean | false | 全部                   | 是否添加水印                                          |

**zimage 原生接口参数（位于 `input` 对象内）**

| 参数               | 类型        | 必填 | 说明                                   |
| ---------------- | --------- | -- | ------------------------------------ |
| prompt           | string    | 是  | 图像描述或编辑指令，最长 800 字符                  |
| images           | string\[] | 否  | 图片 URL 或 base64 数组（1-3 张），有值时为图片编辑模式 |
| n                | integer   | 否  | 生成图片数量，取值范围因模型而异                     |
| size             | string    | 否  | 输出分辨率，格式为 `宽*高` 或缩写 `1K`/`2K`/`4K`   |
| seed             | integer   | 否  | 随机种子，范围 `0`-`2147483647`             |
| negative\_prompt | string    | 否  | 反向提示词，最长 500 字符，wan2.7 系列不支持         |
| prompt\_extend   | boolean   | 否  | 提示词智能改写，默认 `true`，wan2.7 系列不支持       |
| thinking\_mode   | boolean   | 否  | 思考模式，仅 wan2.7 系列，默认 `true`           |
| watermark        | boolean   | 否  | 是否添加水印，默认 `false`                    |
| color\_palette   | array     | 否  | 自定义颜色主题，含 3-10 个颜色对象，仅 wan2.7 系列支持   |

**各模型 `n` 和 `size` 取值范围**

| 模型                                         | n 范围         | size 范围                                                           | 默认 size     |
| ------------------------------------------ | ------------ | ----------------------------------------------------------------- | ----------- |
| wan2.7-image-pro                           | 1（组图模式 1-12） | `1K`/`2K`/`4K`；自定义每边 768-4096px，宽高比 1:8\~8:1                      | 2K          |
| wan2.7-image                               | 1（组图模式 1-12） | `1K`/`2K`；自定义每边 768-2048px，宽高比 1:8\~8:1                           | 2K          |
| wan2.6-t2i                                 | 1-4          | 自定义每边 1280-1440px，宽高比 1:4\~4:1                                    | 1280x1280   |
| qwen-image-2.0-pro / qwen-image-2.0        | 1-6          | 自定义每边 512-2048px，总像素 ≤ 2048×2048                                  | 2048x2048   |
| qwen-image-max / qwen-image-plus           | 1-6          | 5 种固定规格：`1664x928`、`1472x1104`、`1328x1328`、`1104x1472`、`928x1664` | 1664x928    |
| qwen-image-edit                            | 固定 1         | 不可指定，由模型自动决定                                                      | -           |
| qwen-image-edit-plus / qwen-image-edit-max | 1-6          | 自定义每边 512-2048px                                                  | 约 1024x1024 |

#### GLM 模型参数

| 参数      | 类型     | 必填 | 说明                                                                                                                                                                |
| ------- | ------ | -- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| quality | string | 否  | 渲染质量，支持 `hd`（默认，细节更丰富，约 20 秒）和 `standard`（生成更快，约 5-10 秒）                                                                                                          |
| size    | string | 否  | 图像尺寸，默认 `1280x1280`。推荐值：`1280x1280`、`1568x1056`、`1056x1568`、`1472x1088`、`1088x1472`、`1728x960`、`960x1728`。自定义尺寸要求：宽高均在 1024px–2048px 之间，必须能被 32 整除，且总像素不超过 2²² px |

#### Doubao 模型参数

| 参数                                     | 类型      | 必填 | 说明                                                                                        |   |
| -------------------------------------- | ------- | -- | ----------------------------------------------------------------------------------------- | - |
| sequential\_image\_generation          | string  | 否  | 控制是否关闭组图功能                                                                                |   |
| sequential\_image\_generation\_options | object  | 否  | 组图功能配置，仅当 `sequential_image_generation` 为 `auto` 时生效。目前支`max_images`，取值范围\[1, 15]，默认值为 15 |   |
| watermark                              | boolean | 否  | 是否在生成的图片中添加水印，支持 `true` （默认）和 `false`                                                     |   |
| seed                                   | integer | 否  | 随机数种子，取值范围为 \[-1, 2147483647]，默认值为 -1                                                     |   |
| response\_format                       | string  | 否  | 生成图像的返回格式，支`url`（链接在图片生成后24小时内有效，请及时下载图片）`base64_json`                                    |   |

<Tip>
  实际可生成的图片数量，除受到 `max_images` 影响外，还受到输入的参考图数量影响。输入的参考图数量+最终生成的图片数量 ≤ 15 张。
</Tip>

## 使用示例

### OpenAI

<CodeGroup>
  ```shellscript 文生图 theme={null}
  curl https://aihubmix.com/v1/models/openai/gpt-image-1.5/predictions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
      -d '{
    "input": {
      "prompt": "A deer drinking in the lake, Sakura petals falling, green and clean water, japanese temple, dappled sunlight, cinematic lighting, expansive view, peace",
      "size": "1024x1024", 
      "n": 1,
      "quality": "high",
      "moderation": "low",
      "background": "auto"
    }
  }'
  ```

  ```shellscript 图生图 theme={null}
  curl https://aihubmix.com/v1/images/edits \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -F "model=gpt-image-1.5" \
    -F "prompt=Replace the background with a blue sky and white clouds" \
    -F "image=@test.png" \
    -F "size=1024x1024"
  ```
</CodeGroup>

#### gpt-image-2

这是 OpenAI 图片编辑模型，调用时请填写完整模型名 `gpt-image-2`，不能简写为 `image2`。该接口返回 `b64_json` 时，可按下面示例保存为 `edited.png`。

<CodeGroup>
  ```powershell PowerShell theme={null}
  curl.exe -sS -X POST "https://aihubmix.com/v1/images/edits" `
    -H "Authorization: Bearer YOUR_API_KEY" `
    -F "model=gpt-image-2" `
    -F "prompt=Replace the background with a blue sky and white clouds" `
    -F "image=@test.png" `
    -F "size=1024x1024" `
    -D headers.txt `
    -o response.json `
    -w "HTTP_CODE:%{http_code}`nTOTAL:%{time_total}`n"

  $b64 = (Get-Content .\response.json -Raw | ConvertFrom-Json).data[0].b64_json
  [IO.File]::WriteAllBytes(".\edited.png", [Convert]::FromBase64String($b64))
  ```

  ```typescript TypeScript theme={null}
  import { readFile, writeFile } from "node:fs/promises";

  const apiKey = process.env.AIHUBMIX_API_KEY;
  if (!apiKey) {
    throw new Error("Set AIHUBMIX_API_KEY first.");
  }

  const form = new FormData();
  form.append("model", "gpt-image-2");
  form.append("prompt", "Replace the background with a blue sky and white clouds");
  form.append("image", new Blob([await readFile("test.png")], { type: "image/png" }), "test.png");
  form.append("size", "1024x1024");

  const response = await fetch("https://aihubmix.com/v1/images/edits", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${apiKey}`,
    },
    body: form,
  });

  if (!response.ok) {
    throw new Error(`${response.status} ${await response.text()}`);
  }

  const result = (await response.json()) as {
    data: Array<{ b64_json: string }>;
  };

  await writeFile("edited.png", Buffer.from(result.data[0].b64_json, "base64"));
  ```
</CodeGroup>

### Google Imagen

<CodeGroup>
  ```shell Curl theme={null}
  curl https://aihubmix.com/v1/models/google/imagen-4.0-fast-generate-001/predictions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
      -d '{
    "input": {
      "prompt": "A deer drinking in the lake, Sakura petals falling, green and clean water, japanese temple, dappled sunlight, cinematic lighting, expansive view, peace",
      "numberOfImages": 1
    }
  }'
  ```
</CodeGroup>

### 阿里云模型

<Note>
  * 支持两种调用方式：OpenAI 兼容接口（`/v1/images/generations` 和 `/v1/images/edits`）和 zimage 原生接口（`/v1/models/bailian/:model/predictions`）
  * 返回的图片 URL 有效期 24 小时，请及时下载保存
</Note>

<CodeGroup>
  ```shellscript OpenAI兼容-文生图 theme={null}
  curl https://aihubmix.com/v1/images/generations \
    -H "Authorization: Bearer sk-***" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "wan2.7-image-pro",
      "prompt": "A serene lakeside cabin at sunset, watercolor style",
      "n": 1,
      "size": "1024x1024",
      "thinking_mode": true,
      "seed": 42
    }'
  ```

  ```shellscript OpenAI兼容-图片编辑 theme={null}
  curl https://aihubmix.com/v1/images/edits \
    -H "Authorization: Bearer sk-***" \
    -F "model=qwen-image-edit-plus" \
    -F "prompt=Replace the background with a blue sky and white clouds" \
    -F "image=@/path/to/photo.png" \
    -F "n=1" \
    -F "size=1024x1024" \
    -F "seed=42" \
    -F "watermark=false"
  ```

  ```shellscript zimage-文生图 theme={null}
  curl https://aihubmix.com/v1/models/bailian/wan2.7-image-pro/predictions \
    -H "Authorization: Bearer sk-***" \
    -H "Content-Type: application/json" \
    -d '{
      "input": {
        "prompt": "A serene lakeside cabin at sunset, watercolor style",
        "n": 1,
        "size": "2K",
        "thinking_mode": true,
        "seed": 42
      }
    }'
  ```

  ```shellscript zimage-图片编辑 theme={null}
  curl https://aihubmix.com/v1/models/bailian/qwen-image-edit-plus/predictions \
    -H "Authorization: Bearer sk-***" \
    -H "Content-Type: application/json" \
    -d '{
      "input": {
        "prompt": "Replace the background with a blue sky and white clouds",
        "images": ["https://example.com/photo.png"],
        "n": 1,
        "size": "1024*1024",
        "watermark": false
      }
    }'
  ```
</CodeGroup>

### GLM

<CodeGroup>
  ```shellscript glm-image theme={null}
  curl https://aihubmix.com/v1/models/openai/glm-image/predictions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
      -d '{
    "input": {
      "prompt": "A deer drinking in the lake, Sakura petals falling, green and clean water, japanese temple, dappled sunlight, cinematic lighting, expansive view, peace",
      "size": "1024x1024",
      "quality": "hd"
    }
  }'
  ```
</CodeGroup>

### Doubao

<CodeGroup>
  ```shellscript 文生图 theme={null}
  curl https://aihubmix.com/v1/models/doubao/doubao-seedream-4-0/predictions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d '{
      "input": {
        "prompt": "Interstellar, black hole, a vintage train bursting out of a black hole, vying for visual impact, cinematic blockbuster, apocalyptic feel, dynamic, contrasting colors, oc rendering, ray tracing, motion blur, depth of field, surrealism, deep blue, the scene is shaped by delicate rich color layers creating the subject and scene, realistic texture, the lighting effects of a dark background create an atmosphere, combining artistic fantasy, exaggerated wide-angle perspective, glare, reflection, extreme light and shadow, strong gravity, devouring",
        "size": "2K",
        "sequential_image_generation": "disabled",
        "stream": false,
        "response_format": "url",
        "watermark": true
      }
    }'
  ```

  ```shellscript 图生图 theme={null}
  curl https://aihubmix.com/v1/models/doubao/doubao-seedream-4-5/predictions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d '{
      "input": {
          "model": "doubao-seedream-4-5",
          "prompt": "Keep the model's pose and the flowing shape of the liquid clothing unchanged. Change the clothing material from silver metal to completely transparent clear water (or glass). Through the liquid flow, the model's skin details can be seen. The light and shadow change from reflection to refraction.",
          "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imageToimage.png",
          "size": "2K",
          "watermark": false
      }
    }'
  ```

  ```shellscript 多图融合 theme={null}
  curl https://aihubmix.com/v1/models/doubao/doubao-seedream-4-5/predictions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d '{
      "input": {
          "model": "doubao-seedream-4-5",
          "prompt": "Change the clothing in image 1 to the clothing in image 2",
          "image": ["https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imagesToimage_2.png"],
          "sequential_image_generation": "disabled",
          "size": "2K",
          "watermark": false
      }
    }'
  ```

  ```shellscript 多参考图生组图 theme={null}
  curl https://aihubmix.com/v1/models/doubao/doubao-seedream-4-5/predictions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d '{
      "input": {
          "model": "doubao-seedream-4-5",
          "prompt": "Generate 3 images of a girl and a cow toy happily riding a roller coaster in an amusement park, covering morning, noon, and evening",
          "image": ["https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimages_1.png", "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimages_2.png"],
          "sequential_image_generation": "auto",
          "sequential_image_generation_options": {
              "max_images": 3
          },
          "size": "2K",
          "watermark": false
      }
    }'
  ```
</CodeGroup>

### Flux

<Note>
  * `flux-2-flex` 和 `flux-2-pro` 为异步端口，需要分 2 步请求。该系列速度极快，几乎秒出。
  * `FLUX.1-Kontext-pro` 使用通用接口，一步到位
  * Azure 渠道的`FLUX-1.1-pro` 等 BFL 模型均为同步绘图，而非异步。
</Note>

#### **FLUX 一步绘图**

```shellscript FLUX-1.1-pro theme={null}
curl https://aihubmix.com/v1/models/bfl/FLUX-1.1-pro/predictions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-***" \
  -d '{
    "input": {
      "prompt": "A serene deer drinking from a crystal-clear lake, sakura petals gently falling, traditional Japanese temple in the background, warm dappled sunlight, cinematic lighting, ultra-wide composition, peaceful atmosphere, highly detailed",
      "size": "1024x1024",
      "output_format": "jpeg",
      "extra_body": {
        "prompt_upsampling": true,
        "safety_tolerance": 6,
        "seed": 1
      }
    }
  }'
```

#### **Flux 异步绘图**

**第一步：发出绘图请求**

<CodeGroup>
  ```shell 文生图 theme={null}
  curl https://aihubmix.com/v1/models/bfl/flux-kontext-max/predictions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
      -d '{
    "input": {
      "prompt": "A deer drinking in the lake, Sakura petals falling, green and clean water, japanese temple, dappled sunlight, cinematic lighting, expansive view, peace. reference style as the given image:",
      "aspect_ratio": "2:3",
      "safety_tolerance": 6
    }
  }'
  ```

  ```shell 图生图 theme={null}
  curl https://aihubmix.com/v1/models/bfl/flux-kontext-max/predictions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
      -d '{
    "input": {
      "prompt": "A deer drinking in the lake, Sakura petals falling, green and clean water, japanese temple, dappled sunlight, cinematic lighting, expansive view, peace. reference style as the given image:",
      "aspect_ratio": "2:3",
      "safety_tolerance": 2,
      "input_image": "https://assets.aihubmix.com/docs/ghibli.png"
    }
  }'
  ```
</CodeGroup>

输出结果示例：

```shell theme={null}
{
  "output": [
    {
      "taskId": "api.us1.***",
      "polling_url": "https://api.us1.bfl.ai/v1/get_result?id=f9821dbf-f134-41c2-aaa8-5405fb665c76"
    }
  ]
}
```

**第二步：获取生成的图片链接**

```shell 获取图片 theme={null}
curl https://api.aihubmix.com/v1/tasks/<taskId> \
    -H "Authorization: Bearer sk-***" \
    -X GET
```

### Ideogram V3

<Note>
  1. V3 以下版本（V\_2、V\_1 等）为旧接口，暂不支持
  2. 返回的链接需要打开代理网络才能获取
</Note>

<CodeGroup>
  ```shell Curl theme={null}
  curl https://aihubmix.com/v1/models/ideogram/V3/predictions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
      -d '{
    "input": {
      "prompt": "A deer drinking in the lake, Sakura petals falling, green and clean water, japanese temple, dappled sunlight, cinematic lighting, expansive view, peace, in the style of Pixar 3D",
      "rendering_speed": "QUALITY",
      "aspect_ratio": "2x1"
    }
  }'
  ```
</CodeGroup>

### iRAG

<CodeGroup>
  ```bash ERNIE iRAG theme={null}
  curl https://aihubmix.com/v1/models/qianfan/irag-1.0/predictions\
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
    -d '{
      "input": {
        "prompt": "A beautiful sunset over a calm ocean",
        "refer_image": "",
        "n": 1,
        "size": "1024x1024",
        "guidance": 7.5,
        "watermark": false
      }
    }'
  ```

  ```bash ERNIE iRAG Edit theme={null}
  curl https://aihubmix.com/v1/models/qianfan/ernie-irag-edit/predictions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-***" \
      -d '{
    "input": {
      "prompt": "Add a flying pig",
      "image": "http://***"
    }
  }'
  ```
</CodeGroup>

***

更新时间：2026-06-01
