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

# Z-Image-Turbo 画像生成

>  - 非同期処理モード、後続のクエリ用にタスクIDを返します
- 軽量高速な画像生成、中国語と英語をサポート
- 1K/2K解像度レベルをサポート、スマートプロンプト書き換えをサポート 

<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": "z-image-turbo",
      "prompt": "水墨画風の山水風景"
    }'
  ```

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

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

  payload = {
      "model": "z-image-turbo",
      "prompt": "水墨画風の山水風景"
  }

  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: "z-image-turbo",
    prompt: "水墨画風の山水風景",
  };

  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"
    }
  }
  ```
</ResponseExample>

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

| モデル名            | 説明                    | 生成枚数 | 課金方式 |
| --------------- | --------------------- | ---- | ---- |
| `z-image-turbo` | 軽量高速な画像生成、中国語と英語をサポート | 固定1枚 | 固定価格 |

## 認証

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

  API Keyの取得：

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

  リクエストヘッダーに追加：

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

## Body

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

  * `z-image-turbo` - 軽量高速な画像生成、中国語と英語をサポート
</ParamField>

<ParamField body="prompt" type="string" required>
  画像生成のテキスト説明、最大800文字
</ParamField>

<ParamField body="size" type="string" default="1:1">
  画像のアスペクト比

  サポートされているアスペクト比：

  * `1:1` - 正方形（デフォルト）
  * `4:3` - 横向き 4:3
  * `3:4` - 縦向き 3:4
  * `16:9` - 横向きワイドスクリーン
  * `9:16` - 縦向き
  * `3:2` - 横向き 3:2
  * `2:3` - 縦向き 2:3
</ParamField>

<ParamField body="resolution" type="string" default="1K">
  解像度レベル

  * `1K` - 標準解像度（デフォルト）
  * `2K` - 高精細解像度
</ParamField>

<ParamField body="prompt_extend" type="boolean" default="false">
  スマートプロンプト書き換え

  有効にすると、AIが自動的にプロンプトを最適化し、より良い結果を生成し、費用が増加します。

  * `false` - 無効（デフォルト）
  * `true` - 有効
</ParamField>

## 解像度対照表

`size`（比率）+ `resolution`（解像度レベル）の組み合わせで出力サイズを制御します。

| 比率     | 1Kレベル     | 2Kレベル     |
| ------ | --------- | --------- |
| `1:1`  | 1024×1024 | 2048×2048 |
| `4:3`  | 1152×864  | 2048×1536 |
| `3:4`  | 864×1152  | 1536×2048 |
| `16:9` | 1280×720  | 2048×1152 |
| `9:16` | 720×1280  | 1152×2048 |
| `3:2`  | 1248×832  | 2048×1360 |
| `2:3`  | 832×1248  | 1360×2048 |

## 使用例

**基本テキストから画像（最小リクエスト）**

```json theme={null}
{
  "model": "z-image-turbo",
  "prompt": "水墨画風の山水風景"
}
```

**比率と解像度を指定**

```json theme={null}
{
  "model": "z-image-turbo",
  "prompt": "ミニマリストスタイルのカフェインテリアデザイン",
  "size": "16:9",
  "resolution": "2K"
}
```

**スマートプロンプト書き換えを有効化**

```json theme={null}
{
  "model": "z-image-turbo",
  "prompt": "猫",
  "prompt_extend": true
}
```

## Response

<ResponseField name="code" type="integer">
  レスポンスステータスコード
</ResponseField>

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

  <Expandable title="属性">
    <ResponseField name="status" type="string">
      タスクステータス

      * `submitted` - 送信済み
    </ResponseField>

    <ResponseField name="task_id" type="string">
      タスク一意識別子
    </ResponseField>
  </Expandable>
</ResponseField>

## 注意事項

1. **非同期処理**：送信後に`task_id`が返されます、結果を取得するには`/v1/tasks/{task_id}`をポーリングしてください
2. **画像保存**：生成された画像はプラットフォームCDNにミラーリングされ、長期間有効です
3. **課金ルール**：正常に生成された画像の枚数に応じて課金、失敗した場合は課金されません
4. **固定枚数**：Z-Image-Turboは1リクエストにつき固定1枚生成、`n`パラメータはサポートされていません
