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

# GPT Image 2.5 Flare API：影像生成與編輯

> 在 APIXO 使用 GPT Image 2.5 Flare API 產生和編輯影像，提供多層品質選項、自訂尺寸與 Webhook 支援。

## 概覽

GPT Image 2.5 Flare 是一個非同步影像生成 API，支援文生圖與參考引導的影像編輯。

| 功能 | 值 |
| - | - |
| 模型 ID | `gpt-image-2.5-flare` |
| 模式 | `text-to-image`, `image-to-image` |
| 提示詞長度 | 1-32,000 個字元 |
| 參考圖片 | 1-16 個 `image-to-image` 的 URL |
| 遮罩編輯 | 支援選用的 `mask_url` 用於 `image-to-image` |
| 縱橫比 | `auto`, `1:1`, `1:2`, `2:1`, `2:3`, `3:2`, `4:3`, `3:4`, `4:5`, `5:4`, `16:9`, `9:16`, `21:9` |
| 輸出控制 | `aspect_ratio` 或 `size`（支援的比率或自訂 `WIDTHxHEIGHT`） |
| 背景 | `auto`, `transparent`, `opaque` |
| 輸出格式 | `png`, `jpeg`, `webp` |
| 解析度級距 | `1k`, `2k`, `4k` |
| 品質等級 | `low`, `medium`, `high`, `xhigh`, `max` |

## 端點與身分驗證

API 基底網址：

```text theme={null}
https://api.apixo.ai/api/v1
```

| 方法 | 端點 | 用途 |
| - | - | - |
| `POST` | `/generateTask/gpt-image-2.5-flare` | 送出生成任務 |
| `GET` | `/statusTask/gpt-image-2.5-flare?taskId={taskId}` | 查詢任務狀態並取得結果 |

```http theme={null}
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```

## 快速入門

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/gpt-image-2.5-flare" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-image",
      "prompt": "A premium minimalist perfume bottle on dark green marble, soft studio lighting, luxury commercial photography, no text",
      "aspect_ratio": "1:1",
      "background": "transparent",
      "output_format": "webp",
      "resolution": "1k",
      "quality": "medium"
    }
  }'
```

接受的回應包括 `data.taskId`。儲存並輪詢，直到 `state` 變為 `success` 或 `failed`。

## 請求體

### 文生圖

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "text-to-image",
    "prompt": "A cinematic aerial view of a coastal city at sunrise, warm golden light, realistic clouds and ocean, no text",
    "aspect_ratio": "16:9",
    "resolution": "2k",
    "quality": "high"
  }
}
```

### 圖生圖

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-image",
    "prompt": "Transform the supplied product photo into a clean premium e-commerce hero image with a white studio background. Preserve the product shape and logo.",
    "image_urls": [
      "https://your-domain.com/images/product-source.png"
    ],
    "mask_url": "https://your-domain.com/images/product-mask.png",
    "size": "1536x1024",
    "background": "opaque",
    "output_format": "png",
    "resolution": "2k",
    "quality": "xhigh"
  }
}
```

## 參數

**request\_type** `string` *required* (default: async)

取得結果的方式。選擇 `async` 時，透過 `statusTask` 輪詢結果；選擇 `callback` 時，透過 Webhook 接收結果。

**callback\_url** `string`

當`request_type`為`callback`時需要。它必須是可以接收最終任務負載的公共HTTPS URL。請參閱 [Webhooks](https://apixo.ai/docs/zh-hant/api-reference/webhooks.md)。

**input** `object` *required*

GPT Image 2.5 Flare 的輸入參數。

**屬性**

**mode** `string` *required*

生成模式。可用值為 `text-to-image`、`image-to-image`。

**prompt** `string` *required*

描述所要求的影像或編輯的文字提示。支援1-32,000字元。

**image\_urls** `string[]`

可公開存取的參考圖 URL。`image-to-image` 模式必填，可提供 1 至 16 個。

**aspect\_ratio** `string` (default: auto)

輸出縱橫比。支援的值：`auto`、`1:1`、`1:2`、`2:1`、`2:3`、`3:2`、`4:3`、`3:4`、`4:5`、`5:4`、`16:9`、`9:16`、`21:9`。`1:2` 和 `2:1` 要求 `resolution` 為 `2k` 或 `4k`。當提供 `size` 時被忽略。

**size** `string`

可選輸出尺寸。使用支援的寬高比或自訂 `WIDTHxHEIGHT`，例如 `1536x1024`。它優先於 `aspect_ratio`。自訂 `WIDTHxHEIGHT`、`1:2` 和 `2:1` 要求 `resolution` 為 `2k` 或 `4k`。

**resolution** `string` (default: 1k)

輸出解析度級距。可用值為 `1k`、`2k`、`4k`。

**quality** `string` (default: medium)

品質和計費等級。支援的值：`low`、`medium`、`high`、`xhigh`、`max`。每個等級都有自己的標價。

**background** `string` (default: auto)

輸出背景。支援的值：`auto`、`transparent`、`opaque`。使用 `transparent` 時，將 `output_format` 設定為 `png` 或 `webp`。

**output\_format** `string` (default: png)

輸出影像格式。支援的值：`png`、`jpeg`、`webp`。`jpeg` 不能與 `background=transparent` 一起使用。

**mask\_url** `string`

選填的公開 HTTP(S) 掩模影像 URL。僅適用於 `image-to-image`，並且需要 `image_urls`。

## 輪詢結果

```bash theme={null}
curl -X GET "https://api.apixo.ai/api/v1/statusTask/gpt-image-2.5-flare?taskId=task_12345678" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

當成功時，`data.resultJson` 是一個 JSON 字串包含 `resultUrls`：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://file.apixo.ai/xxx.png\"]}",
    "createTime": 1767965610929,
    "completeTime": 1767965652317,
    "costTime": 41388
  }
}
```

對於失敗的任務，`state` 為 `failed`，回應包括 `failCode` 和 `failMsg`。

## 計費

新提交的非 LLM 請求按 **1 點 = `$0.001`** 計費。先依用量和加購項目計算總額，再套用帳戶折扣，最後將請求總額無條件進位至整數點數。若已約定固定單價，則保留該單價的精度，不再使用標準價或另行打折；最終點數仍須進位。詳見[積分換算與進位](https://apixo.ai/docs/zh-hant/pricing.md#credit-conversion-and-rounding)。

按成功產生的影像計費。以下標準單價以 USD 為單位，保留小數點後三位。文生圖和圖生圖使用相同的輸出層價格；參考影像不收取額外費用。

| 品質 | `1k` | `2k` | `4k` |
| - | -: | -: | -: |
| `low` | `$0.010` | `$0.020` | `$0.030` |
| `medium` | `$0.024` | `$0.040` | `$0.070` |
| `high` | `$0.090` | `$0.150` | `$0.270` |
| `xhigh` | `$0.160` | `$0.270` | `$0.480` |
| `max` | `$0.360` | `$0.600` | `$1.000` |

有關即時價格目錄，請參閱 [API 定價](https://apixo.ai/pricing/api)。

## 耗時與輪詢

生成時間取決於提示複雜度、參考影像、所選解析度和目前佇列負載。在 30-60 秒後開始輪詢，然後每 10 秒輪詢一次。對於生產工作負載，更喜歡回呼模式。

## MCP 整合

[完整模型 Schema](https://apixo.ai/docs/models/schemas/image/gpt-image-2-5-flare.json) 中的 `mcp.result` 指定結果的解析方式，`mcp.attachments` 列出可繫結檔案的欄位。這些中繼資料供用戶端整合使用，無須當作生成參數提交。附件欄位為 `image_urls`, `mask_url`。請保留使用者指定的檔案順序。模型參數由 API 驗證。

## 相關連結

* [影像模型](https://apixo.ai/docs/zh-hant/models/image)
* [生成 API 總覽](https://apixo.ai/docs/zh-hant/models.md)
* [送出生成任務](https://apixo.ai/docs/zh-hant/api-reference/generate-task.md)
* [查詢任務狀態](https://apixo.ai/docs/zh-hant/api-reference/status-task.md)
* [Webhook](https://apixo.ai/docs/zh-hant/api-reference/webhooks.md)
* [API定價](https://apixo.ai/pricing/api)


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