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

一个包含 `resultUrls` 字段的 JSON 字符串，其中包含已编辑的图像 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/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/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/models.md)
* [提交生成任务](https://apixo.ai/docs/zh/api-reference/generate-task.md)
* [查询任务状态](https://apixo.ai/docs/zh/api-reference/status-task.md)
* [错误码](https://apixo.ai/docs/zh/api-reference/errors.md)
* [参数规范](https://apixo.ai/docs/zh/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.