> ## 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.

# Qwen Image Edit LoRA API：使用參考圖編輯影像

> 提示引導影像編輯 API 與 1–3 輸入影像：使用最多兩個可選參考影像編輯主影像。

## 概覽

Qwen Image Edit LoRA 是非同步圖生圖編輯模型。發送一張主影像 URL、最多兩個可選參考影像 URL 與文字提示，然後輪詢任務，直到編輯的影像準備就緒。輸出組成和尺寸遵循主影像。

| 功能 | 值 |
| - | - |
| 模型 ID | `qwen-image-edit-LoRA` |
| 模式 | `image-to-image` |
| 輸入影像 | 1–3 公用影像 URL：一張主影像與最多兩張參考影像 |
| 提示詞 | 必填 |
| 可選種子 | 非負整數 |
| 結果交付 | 非同步輪詢 |

## 端點與身分驗證

API 基底網址：

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

| 方法 | 端點 | 用途 |
| - | - | - |
| `POST` | `/generateTask/qwen-image-edit-LoRA` | 提交影像編輯任務 |
| `GET` | `/statusTask/qwen-image-edit-LoRA?taskId={taskId}` | 查詢任務狀態並取得結果 |

每個請求都必須附上 APIXO API 金鑰：

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

送出任務時，還需設定以下請求標頭：

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

## 非同步請求範例

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/qwen-image-edit-LoRA" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "image-to-image",
      "prompt": "change the jacket color to deep red while keeping the background unchanged",
      "image_urls": [
        "https://example.com/source-image.png"
      ],
      "seed": 12345
    }
  }'
```

成功回應：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
```

## 輪詢結果

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

任務處理中的回應範例：

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678",
    "state": "processing",
    "createTime": 1767965610929
  }
}
```

成功回應：

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

等 `state` 變為 `success` 後，再解析 `resultJson`：

```javascript theme={null}
const payload = JSON.parse(data.resultJson);
const imageUrls = payload.resultUrls;
```

## 請求體

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-image",
    "prompt": "replace the sky with a soft sunset",
    "image_urls": [
      "https://example.com/source-image.jpg"
    ],
    "seed": 42
  }
}
```

## 參數

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

結果交付方式。使用 `async` 並使用 `statusTask` 進行輪詢。

**input** `object` *required*

Qwen Image Edit LoRA 的輸入參數。

**屬性**

**mode** `string` *required*

生成模式。此模型僅支援 `image-to-image`。

**prompt** `string` *required*

編輯說明。必須是非空字串。

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

必須包含 1–3 非空白且可公開存取的影像 URL。第一個影像是主影像；第二個和第三個為可選的參考影像，依陣列順序使用。輸出的組成與尺寸遵循第一張影像。

**seed** `integer`

選填的隨機種子。若要讓實驗結果更容易重現，請指定固定的非負整數。

### 使用參考影像進行編輯

首先放置主影像，接著依提示中描述的順序放置參考影像。現有單一影像請求仍受支援。

```json theme={null}
{
  "request_type": "async",
  "input": {
    "mode": "image-to-image",
    "prompt": "Edit the person in image 1 using the outfit from image 2 and the background from image 3",
    "image_urls": [
      "https://example.com/source-image.png",
      "https://example.com/outfit-reference.png",
      "https://example.com/background-reference.png"
    ],
    "seed": 42
  }
}
```

## 回應格式

當任務被接受時，`POST /generateTask/qwen-image-edit-LoRA` 會傳回任務 ID。

**code** `integer`

API 狀態碼。`200` 表示任務已受理。

**message** `string`

狀態說明。

**data.taskId** `string`

任務的唯一 ID，用於查詢任務狀態。

### 狀態回應欄位

**taskId** `string`

任務的唯一識別碼。

**state** `string`

目前的任務狀態，可能的值為 `pending`、`processing`、`success`、`failed`。

**resultJson** `string`

JSON 字串，包含 `resultUrls` 中已編輯的影像 URL。當 `state` 為 `success` 時會出現。

**failCode** `string`

供程式判讀的錯誤碼，僅在 `state` 為 `failed` 時傳回。

**failMsg** `string`

失敗原因說明，僅在 `state` 為 `failed` 時傳回。

**createTime** `integer`

任務建立時的 Unix 時間戳記，單位為毫秒。

**completeTime** `integer`

任務完成時間戳記（以 Unix 毫秒為單位）。完成後可用時呈現。

**costTime** `integer`

處理時間，以毫秒為單位。有計時資料時才會傳回。

## 計費

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

Qwen Image Edit LoRA 依生成的影像計費。基本價格為 `$0.048`，包含一張主要輸入影像。每增加一個參考影像，將額外收取 `$0.003`；輸入數量來自 `image_urls`。

`Price = $0.048 + (image_urls.length - 1) × $0.003`

| 輸入影像 | APIXO 每個生成影像的價格 |
| - | -: |
| 1 主影像 | `$0.048` |
| 1 主影像 + 1 參考影像 | `$0.051` |
| 1 主影像 + 2 參考影像 | `$0.054` |

有關當前公開價格，請參閱 [API 定價](https://apixo.ai/pricing/api)。

## 耗時與輪詢

該端點是異步的。實際延遲因影像複雜性和當前佇列負載而異。

| 使用案例 | 建議首次查詢時間 | 輪詢間隔 |
| - | - | - |
| 標準影像編輯 | 任務建立 10 秒後 | 5s-10s |

## 錯誤與排查

| 條件 | 處理方式 |
| - | - |
| 無效或缺失 `mode` | 將 `input.mode` 設定為 `image-to-image` |
| 缺失或為空 `prompt` | 發送非空編輯指令 |
| `image_urls` 無效 | 傳送 1–3 個非空白可公開存取的影像 URL，先傳送主影像 |
| `seed` 無效 | 使用非負整數 |
| 任務停留在 `processing` | 繼續輪詢並進行退避 |
| 任務傳回`failed` | 檢查`failCode`和`failMsg`，然後調整輸入或重試 |

完整列表見[錯誤碼](https://apixo.ai/docs/zh-hant/api-reference/errors.md)。

## MCP 整合

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

## 相關連結

* [生成 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)
* [錯誤碼](https://apixo.ai/docs/zh-hant/api-reference/errors.md)
* [參數規範](https://apixo.ai/docs/zh-hant/api-reference/parameters.md)
* [API定價](https://apixo.ai/pricing/api)


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