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

# Qwen Image 3.0 画像生成

>  - 非同期処理モード、後続の照会用にタスク ID を返します
- テキストから画像、画像から画像（1-3 枚の参考画像による編集）をサポート
- 1K / 2K 解像度をサポート、1 リクエストあたり最大 6 枚
- 標準版と Pro 版（Pro は密集レイアウトと文字に強い） 

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.apimart.ai/v1/images/generations \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "qwen-image-3.0",
      "prompt": "A cafe poster with the title Autumn Limited, warm tones, refined layout",
      "size": "16:9",
      "resolution": "1K"
    }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.apimart.ai/v1/images/generations"

  payload = {
      "model": "qwen-image-3.0",
      "prompt": "A cafe poster with the title Autumn Limited, warm tones, refined layout",
      "size": "16:9",
      "resolution": "1K",
  }

  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json",
  }

  response = requests.post(url, json=payload, headers=headers)

  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const url = "https://api.apimart.ai/v1/images/generations";

  const payload = {
    model: "qwen-image-3.0",
    prompt: "A cafe poster with the title Autumn Limited, warm tones, refined layout",
    size: "16:9",
    resolution: "1K",
  };

  const headers = {
    Authorization: "Bearer <token>",
    "Content-Type": "application/json",
  };

  fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(payload),
  })
    .then((response) => response.json())
    .then((data) => console.log(data))
    .catch((error) => console.error("Error:", error));
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 200,
    "data": [
      {
        "status": "submitted",
        "task_id": "task_01JGXYZ1234567890ABCDEF"
      }
    ]
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": 400,
      "message": "リクエストパラメータが無効です",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "認証に失敗しました、APIキーを確認してください",
      "type": "authentication_error"
    }
  }
  ```

  ```json 402 theme={null}
  {
    "error": {
      "code": 402,
      "message": "残高不足です、チャージしてから再試行してください",
      "type": "payment_required"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "リクエストが多すぎます、しばらくしてから再試行してください",
      "type": "rate_limit_error"
    }
  }
  ```
</ResponseExample>

## サポートされているモデル

| モデル                  | 説明                                   | 最大枚数 | 解像度     |
| -------------------- | ------------------------------------ | ---- | ------- |
| `qwen-image-3.0`     | 指示追従が明確で、文字レンダリングが安定。一般用途でコスパが良い     | 6    | 1K / 2K |
| `qwen-image-3.0-pro` | 内容がより充実。新聞、絵コンテ、メニュー、試験問題など密集レイアウト向け | 6    | 1K / 2K |

<Tip>
  文字・レイアウトが密集する場合は `-pro` を推奨。一般的な画像は `qwen-image-3.0` を使用。プロンプト上限は約 **4.5k トークン**。モデル名は 2.0 シリーズと互換ではありません。
</Tip>

## Authorizations

<ParamField header="Authorization" type="string" required>
  すべてのエンドポイントは Bearer Token 認証が必要です

  [API Key 管理ページ](https://apimart.ai/keys) で API Key を取得してください：

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Body

<ParamField body="model" type="string" required>
  モデル名

  * `qwen-image-3.0` - 標準
  * `qwen-image-3.0-pro` - Pro（密集テキスト / レイアウト）
</ParamField>

<ParamField body="prompt" type="string" required>
  画像生成用のテキスト説明、最大約 **4.5k トークン**
</ParamField>

<ParamField body="image_urls" type="string[]">
  参考画像 URL 配列（画像から画像 / 編集）、**1-3 枚**

  * 公開 `http(s)://` URL または `data:image/png;base64,...`（base64 は先に再アップロードされます）
  * 形式：JPG / JPEG / PNG / BMP / TIFF / WEBP / GIF
  * 1 ファイルあたり ≤ 10MB、幅/高さは 384-2048 px を推奨
</ParamField>

<ParamField body="resolution" type="string" default="1K">
  解像度ティア（課金ティアに影響）

  * `1K`（デフォルト、小文字も可）
  * `2K`

  ティアを省略し、`size` にピクセルを指定することもできます（例：`1600x900`）。生ピクセル指定時、面積が **> 2.25M ピクセル** の場合は 2K として課金されます。
</ParamField>

<ParamField body="size" type="string" default="1:1">
  アスペクト比、または明示的なピクセルサイズ

  サポートされる比率：

  * `1:1`（デフォルト）
  * `4:3` / `3:4`
  * `16:9` / `9:16`
  * `3:2` / `2:3`

  `16x9` 形式、または `1024x1024` のようなピクセル指定も可。カスタムピクセルでは、**各辺**（幅・高さ）が **512 \~ 2048**、アスペクト 1:8 \~ 8:1。

  `size` も `resolution` も未設定の場合、出力は **1024×1024** 固定です。
</ParamField>

<ParamField body="n" type="integer" default="1">
  画像枚数、**1-6**。6 を超える値は 6 にクランプされます。
</ParamField>

<ParamField body="negative_prompt" type="string">
  ネガティブプロンプト：避けたい内容
</ParamField>

<ParamField body="prompt_extend" type="boolean" default="false">
  インテリジェントなプロンプト書き換え

  デフォルトは **オフ**（結果を予測可能にするため）。スマート書き換えを使う場合は `true` を指定してください。
</ParamField>

<ParamField body="prompt_extend_mode" type="string">
  書き換えモード（3.0 シリーズのみ、`prompt_extend: true` が必要）

  * `direct` - テキストから画像、画像から画像の両方で有効
  * `agent` - **テキストから画像のみ**、より積極的な書き換え

  無効な値は無視されます。
</ParamField>

## サイズ対照表

`resolution`（ティア）+ `size`（比率）を組み合わせます：

| 解像度    | 1:1       | 4:3       | 3:4       | 16:9      | 9:16      | 3:2       | 2:3       |
| ------ | --------- | --------- | --------- | --------- | --------- | --------- | --------- |
| **1K** | 1024×1024 | 1152×864  | 864×1152  | 1280×720  | 720×1280  | 1248×832  | 832×1248  |
| **2K** | 2048×2048 | 2048×1536 | 1536×2048 | 2048×1152 | 1152×2048 | 2048×1360 | 1360×2048 |

## 使用例

### テキストから画像（複数）

```json theme={null}
{
  "model": "qwen-image-3.0",
  "prompt": "Flat illustration of a city skyline at dusk, warm orange tones",
  "size": "16:9",
  "resolution": "1K",
  "n": 4
}
```

### 密集レイアウト + 書き換え

```json theme={null}
{
  "model": "qwen-image-3.0-pro",
  "prompt": "A Western restaurant menu with appetizers, mains, and desserts columns, five dishes each with prices, serif font, cream background",
  "size": "3:4",
  "resolution": "2K",
  "prompt_extend": true,
  "prompt_extend_mode": "agent"
}
```

### 画像から画像（編集）

```json theme={null}
{
  "model": "qwen-image-3.0-pro",
  "prompt": "Change the sign text to Open, keep everything else the same",
  "image_urls": ["https://example.com/shop.jpg"],
  "size": "1:1"
}
```

### ネガティブプロンプト

```json theme={null}
{
  "model": "qwen-image-3.0",
  "prompt": "Photorealistic mountain cabin in morning mist",
  "negative_prompt": "text, watermark, people, low resolution",
  "size": "3:2"
}
```

## 制限

| 項目    | 制限                                         |
| ----- | ------------------------------------------ |
| プロンプト | ≤ 4.5k トークン                                |
| 出力サイズ | カスタムピクセル時は各辺 512 \~ 2048；アスペクト 1:8 \~ 8:1  |
| 画像枚数  | 1-6（超過分はクランプ）                              |
| 参考画像  | 1-3                                        |
| 参考形式  | JPG / JPEG / PNG / BMP / TIFF / WEBP / GIF |
| 参考サイズ | ≤ 10MB、幅/高さは 384-2048 px を推奨               |

## Response

<ResponseField name="code" type="integer">
  ステータスコード、成功時は 200
</ResponseField>

<ResponseField name="data" type="array">
  レスポンスデータ配列

  <Expandable title="プロパティ">
    <ResponseField name="status" type="string">
      タスクステータス、作成時は `submitted`
    </ResponseField>

    <ResponseField name="task_id" type="string">
      結果ポーリング用のタスク ID
    </ResponseField>
  </Expandable>
</ResponseField>

## 2.0 との違い

|                      | 2.0 シリーズ | 3.0 シリーズ                 |
| -------------------- | -------- | ------------------------ |
| プロンプト長               | 短い       | 約 4.5k トークン              |
| `prompt_extend_mode` | 非対応      | `direct` / `agent`       |
| 解像度                  | 1K / 2K  | 1K / 2K（Pro の 2K は料金が高い） |
| 参考画像                 | 対応       | 1-3 枚                    |

## 注意事項

1. **非同期**：送信後に `task_id` が返ります。[タスク状態の取得](/ja/api-reference/tasks/status) を **3\~5 秒**ごとにポーリング。クライアントタイムアウトは約 **3 分**（2K + 複数枚はより遅い）。
2. **ストレージ**：画像はプラットフォーム CDN にミラーされ、長期アクセス可能です。
3. **課金**：納品画像枚数 × 解像度ティア。**実際のピクセル面積**で判定（> 2.25M ピクセル = 2K）。`qwen-image-3.0` は 1K/2K 同額、`-pro` の 2K は 1K の 2 倍。失敗時は全額返金、参考画像は無料。
4. **エラー**：無効な size/比率、画像から画像での `agent`、到達不可/過大な参考画像 → 400、レート制限 → 429。

<Note>
  **結果の照会**

  進捗と `result.images` は [タスク状態の取得](/ja/api-reference/tasks/status) を使用してください。
</Note>
