> ## 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 入力画像: 最大 2 つのオプションの参照画像を使用してプライマリ画像を編集します。

## 概要

Qwen Image Edit LoRA は、非同期の画像間編集モデルです。1 つのプライマリ画像 URL、最大 2 つのオプションの参照画像 URL、およびテキストプロンプトを送信し、編集された画像の準備ができるまでタスクをポーリングします。出力の構成と寸法は主画像に従います。

| 機能 | 値 |
| - | - |
| モデル ID | `qwen-image-edit-LoRA` |
| モード | `image-to-image` |
| 入力画像 | 1～3 公開画像 URL: 1 つのプライマリ画像と最大 2 つの参照画像 |
| プロンプト | 必須 |
| オプションのシード | 負でない整数 |
| 結果配信 | 非同期ポーリング |

## エンドポイントと認証

ベース URL：

```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 の入力パラメータです。

**HTTP ステータスコードです。**

**mode** `string` *required*

生成モード。このモデルは`image-to-image`のみに対応しています。

**prompt** `string` *required*

編集指導。空ではない文字列である必要があります。

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

1～3 個の空でない公開画像 URL を含める必要があります。最初の画像がプライマリ画像です。2 番目と 3 番目は、配列の順序で使用されるオプションの参照画像です。出力の構成と寸法は最初の画像に従います。

**seed** `integer`

乱数シード（任意）。実験の再現性を高めるには、0 以上の整数に固定してください。

### 参考画像を使って編集する

最初にプライマリ イメージを配置し、次にプロンプトに示された順序で参照イメージを配置します。既存の単一イメージ リクエストは引き続きサポートされます。

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

タスクを一意に識別する ID です。

**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/ja/pricing.md#credit-conversion-and-rounding)を参照してください。

Qwen Image Edit LoRA は生成されたイメージごとに課金されます。基本価格は、1 つのプライマリ入力イメージを含めて `$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/ja/api-reference/errors.md)を参照してください。

## MCP 連携

[モデルの完全なスキーマ](https://apixo.ai/docs/models/schemas/image/qwen-image-edit-lora.json)では、`mcp.result` に結果のデコード方法、`mcp.attachments` にファイルを割り当てられるフィールドを定義しています。いずれもクライアント実装用のメタデータで、生成リクエストの入力パラメータには含めません。添付先は `image_urls` です。ユーザーが指定したファイルの順序を維持してください。モデルのパラメータは API 側で検証します。

## 関連リンク

* [生成 API の概要](https://apixo.ai/docs/ja/models.md)
* [生成タスクを送信](https://apixo.ai/docs/ja/api-reference/generate-task.md)
* [タスクステータス](https://apixo.ai/docs/ja/api-reference/status-task.md)
* [エラーコード](https://apixo.ai/docs/ja/api-reference/errors.md)
* [パラメーター仕様](https://apixo.ai/docs/ja/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.