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

# wan2.7 이미지 생성 및 편집

>  - Wan2.7 이미지 시리즈: 텍스트-이미지, 이미지 편집, 인터랙티브 편집, 연속 생성, 다중 이미지 참조 지원
- 비동기 처리 모드 — 작업 제출 후 반환된 task_id로 결과를 폴링
- 1K / 2K / 4K 해상도 지원; wan2.7-image-pro 텍스트 생성은 최대 4K
- 과금은 성공적으로 생성된 이미지 수를 기준으로 하며, 해상도 및 비율은 요금에 영향 없음 

<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": "wan2.7-image-pro",
      "prompt": "정교한 창문이 있는 꽃집, 아름다운 나무 문, 꽃이 진열된"
    }'
  ```

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

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

  payload = {
      "model": "wan2.7-image-pro",
      "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: "wan2.7-image-pro",
    prompt: "정교한 창문이 있는 꽃집, 아름다운 나무 문, 꽃이 진열된"
  };

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

  fetch(url, { method: "POST", headers, body: JSON.stringify(payload) })
    .then(r => r.json()).then(console.log).catch(console.error);
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "io/ioutil"
      "net/http"
  )

  func main() {
      url := "https://api.apimart.ai/v1/images/generations"
      payload := map[string]interface{}{
          "model":  "wan2.7-image-pro",
          "prompt": "정교한 창문이 있는 꽃집, 아름다운 나무 문, 꽃이 진열된",
      }
      jsonData, _ := json.Marshal(payload)
      req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
      req.Header.Set("Authorization", "Bearer <token>")
      req.Header.Set("Content-Type", "application/json")
      resp, err := (&http.Client{}).Do(req)
      if err != nil { panic(err) }
      defer resp.Body.Close()
      body, _ := ioutil.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```

  ```java Java theme={null}
  import java.net.http.HttpClient;
  import java.net.http.HttpRequest;
  import java.net.http.HttpResponse;
  import java.net.URI;

  public class Main {
      public static void main(String[] args) throws Exception {
          String payload = """
          {
            "model": "wan2.7-image-pro",
            "prompt": "정교한 창문이 있는 꽃집, 아름다운 나무 문, 꽃이 진열된"
          }
          """;
          HttpRequest request = HttpRequest.newBuilder()
              .uri(URI.create("https://api.apimart.ai/v1/images/generations"))
              .header("Authorization", "Bearer <token>")
              .header("Content-Type", "application/json")
              .POST(HttpRequest.BodyPublishers.ofString(payload))
              .build();
          System.out.println(HttpClient.newHttpClient()
              .send(request, HttpResponse.BodyHandlers.ofString()).body());
      }
  }
  ```

  ```php PHP theme={null}
  <?php
  $payload = ["model" => "wan2.7-image-pro", "prompt" => "정교한 창문이 있는 꽃집, 아름다운 나무 문, 꽃이 진열된"];
  $ch = curl_init("https://api.apimart.ai/v1/images/generations");
  curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true,
      CURLOPT_POSTFIELDS => json_encode($payload),
      CURLOPT_HTTPHEADER => ["Authorization: Bearer <token>", "Content-Type: application/json"]]);
  echo curl_exec($ch); curl_close($ch);
  ?>
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'json'
  require 'uri'

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

  payload = {
    model: "wan2.7-image-pro",
    prompt: "정교한 창문이 있는 꽃집, 아름다운 나무 문, 꽃이 진열된"
  }

  http = Net::HTTP.new(url.host, url.port)
  http.use_ssl = true

  request = Net::HTTP::Post.new(url)
  request["Authorization"] = "Bearer <token>"
  request["Content-Type"] = "application/json"
  request.body = payload.to_json

  response = http.request(request)
  puts response.body
  ```

  ```swift Swift theme={null}
  import Foundation

  let url = URL(string: "https://api.apimart.ai/v1/images/generations")!

  let payload: [String: Any] = [
      "model": "wan2.7-image-pro",
      "prompt": "정교한 창문이 있는 꽃집, 아름다운 나무 문, 꽃이 진열된"
  ]

  var request = URLRequest(url: url)
  request.httpMethod = "POST"
  request.setValue("Bearer <token>", forHTTPHeaderField: "Authorization")
  request.setValue("application/json", forHTTPHeaderField: "Content-Type")
  request.httpBody = try? JSONSerialization.data(withJSONObject: payload)

  let task = URLSession.shared.dataTask(with: request) { data, response, error in
      if let error = error { print("Error: \(error)"); return }
      if let data = data, let str = String(data: data, encoding: .utf8) { print(str) }
  }
  task.resume()
  ```

  ```csharp C# theme={null}
  using System.Net.Http; using System.Text;
  var payload = @"{""model"":""wan2.7-image-pro"",""prompt"":""정교한 창문이 있는 꽃집, 아름다운 나무 문, 꽃이 진열된""}";
  using var client = new HttpClient();
  client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");
  var res = await client.PostAsync("https://api.apimart.ai/v1/images/generations",
      new StringContent(payload, Encoding.UTF8, "application/json"));
  Console.WriteLine(await res.Content.ReadAsStringAsync());
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": "success",
    "data": [{ "task_id": "task_01HX...", "status": "processing" }]
  }
  ```

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

  ```json 500 theme={null}
  {
    "error": { "code": 500, "message": "서버 내부 오류가 발생했습니다", "type": "server_error" }
  }
  ```
</ResponseExample>

## 인증

<ParamField header="Authorization" type="string" required>
  모든 요청에는 Bearer Token 인증이 필요합니다.

  [API Key 관리 페이지](https://apimart.ai/keys)에서 API Key를 발급받아 요청 헤더에 추가하세요：

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

## 사용 가능한 모델

| 모델명                | 설명                    | 텍스트 생성 최대 해상도 | 편집 / 연속 생성 최대 해상도 | 단가        |
| ------------------ | --------------------- | :-----------: | :---------------: | --------- |
| `wan2.7-image-pro` | 프로 에디션, 디테일 우수, 4K 지원 |       4K      |         2K        | ¥0.50 / 장 |
| `wan2.7-image`     | 스탠다드 에디션, 고속 생성       |       2K      |         2K        | ¥0.20 / 장 |

<Note>
  과금은 **성공적으로 생성된 이미지 수 × 단가**로 계산됩니다. 입력은 과금되지 않습니다. 해상도와 비율은 가격에 영향을 주지 않습니다. 실패한 요청은 과금되지 않습니다.
</Note>

## Body

<ParamField body="model" type="string" required>
  이미지 생성 모델 이름

  * `wan2.7-image-pro` — 프로 에디션, 텍스트 생성 최대 4K
  * `wan2.7-image` — 스탠다드 에디션, 고속, 최대 2K
</ParamField>

<ParamField body="prompt" type="string">
  이미지 생성을 위한 텍스트 설명. 최대 5000자.

  * **텍스트 생성 모드** (`image_urls` 없음): 필수
  * **이미지 편집 모드** (`image_urls` 있음): 선택 사항 (권장)

  예: `"정교한 창문이 있는 꽃집, 아름다운 나무 문, 꽃이 진열된"`
</ParamField>

<ParamField body="image_urls" type="array<string>">
  입력 이미지 URL 배열. 이미지 편집 및 다중 이미지 참조 시나리오에 사용됩니다.

  제공하면 **이미지 편집 모드**로 자동 전환됩니다.

  **지원 형식:** HTTP / HTTPS 이미지 링크; `data:image/...;base64,...` Base64 형식

  **제약:** 최대 9장; JPEG / PNG / WEBP / BMP; 240–8000 px; 비율 1:8 \~ 8:1; 장당 ≤ 20MB

  <Note>
    출력 비율은 **마지막** 입력 이미지를 기준으로 자동 조정됩니다. 편집 모드는 최대 2K입니다（4K 미지원）.
  </Note>
</ParamField>

<ParamField body="n" type="integer" default="1">
  생성할 이미지 수

  * **일반 모드**: 1–4（기본값 1）
  * **연속 생성 모드**（`enable_sequential: true`）: 1–12（기본값 1）

  <Note>성공적으로 생성된 이미지 수에 따라 과금됩니다. `n` 기준으로 사전 차감됩니다.</Note>
</ParamField>

<ParamField body="size" type="string">
  출력 해상도 또는 비율. 세 가지 형식을 지원합니다:

  **① 해상도 키워드 (권장):** `1K` / `2K` (기본값) / `4K` (`wan2.7-image-pro` 텍스트 생성 전용)

  **② 비율:** `1:1` / `16:9` / `9:16` / `4:3` / `3:4` / `3:2` / `2:3` (기본적으로 2K 티어로 환산)

  **③ 픽셀 값:** `1024x1024` 또는 `1024*1024`
</ParamField>

<ParamField body="resolution" type="string">
  해상도 키워드: `1K` / `2K` / `4K`. `size` (비율)와 함께 사용할 수 있습니다.

  | 모델                 | 시나리오         |      지원 키워드      | 픽셀 범위                |
  | ------------------ | ------------ | :--------------: | -------------------- |
  | `wan2.7-image-pro` | 텍스트 생성 (비연속) | 1K / **2K** / 4K | 768×768 \~ 4096×4096 |
  | `wan2.7-image-pro` | 편집 / 연속 생성   |    1K / **2K**   | 768×768 \~ 2048×2048 |
  | `wan2.7-image`     | 모든 시나리오      |    1K / **2K**   | 768×768 \~ 2048×2048 |
</ParamField>

<ParamField body="negative_prompt" type="string">
  네거티브 프롬프트. 예: `"흐릿한, 왜곡된, 저화질"`
</ParamField>

<ParamField body="watermark" type="boolean" default="false">
  우측 하단에 "AI 생성" 워터마크를 추가할지 여부
</ParamField>

<ParamField body="seed" type="integer">
  랜덤 시드（0–2147483647）. 동일한 파라미터와 동일한 시드를 사용하면 시각적으로 일관된 결과를 생성할 수 있습니다.
</ParamField>

<ParamField body="thinking_mode" type="boolean" default="true">
  강화된 추론 모드. 이미지 품질이 향상되지만 생성 시간이 길어집니다.

  <Note>**연속 생성 모드 비활성화** 및 **이미지 입력 없음** 조건을 모두 만족할 때만 유효합니다.</Note>
</ParamField>

<ParamField body="enable_sequential" type="boolean" default="false">
  **연속 이미지 생성** 모드를 활성화합니다. 스토리보드, 만화, 시리즈에 적합합니다.

  * 활성화 시 `n` 최대값은 12
  * 연속 생성 모드에서는 `thinking_mode`와 `color_palette` 무효
  * `wan2.7-image-pro` 연속 생성은 최대 2K（4K 미지원）
</ParamField>

<ParamField body="bbox_list" type="array">
  인터랙티브 편집을 위한 바운딩 박스. 편집하거나 콘텐츠를 삽입할 정확한 영역을 지정합니다.

  **구조:** `[[[x1, y1, x2, y2], ...], ...]`

  * 외부 배열 길이는 `image_urls` 길이와 같아야 합니다
  * 바운딩 박스가 없는 이미지에는 `[]`를 전달합니다
  * 이미지당 최대 2개 박스. 좌표는 원본 이미지의 절대 픽셀값이며, 좌상단이 (0,0)입니다

  예: `[[], [[989, 515, 1138, 681]]]`
</ParamField>

<ParamField body="color_palette" type="array<object>">
  커스텀 색상 테마. **일반 모드에서만 사용 가능** (연속 생성 모드에서는 사용 불가).

  * 3–10개 항목 (8개 권장). 각 항목에는 `hex`와 `ratio`가 필요합니다
  * 모든 `ratio` 값의 합계는 정확히 `100.00%`여야 합니다

  ```json theme={null}
  [{ "hex": "#C2D1E6", "ratio": "23.51%" }, { "hex": "#636574", "ratio": "76.49%" }]
  ```
</ParamField>

## 응답

<ResponseField name="code" type="string">
  응답 상태입니다. 성공 시 `"success"`를 반환합니다.
</ResponseField>

<ResponseField name="data" type="array">
  <Expandable title="배열 요소">
    <ResponseField name="task_id" type="string">
      생성 결과 조회에 사용하는 고유 작업 식별자입니다.
    </ResponseField>

    <ResponseField name="status" type="string">
      초기 작업 상태입니다. 제출 직후에는 항상 `processing`입니다.
    </ResponseField>
  </Expandable>
</ResponseField>

## 예시

### 텍스트-이미지（최소）

```json theme={null}
{ "model": "wan2.7-image-pro", "prompt": "정교한 창문이 있는 꽃집, 아름다운 나무 문, 꽃이 진열된" }
```

### 텍스트-이미지（해상도 지정）

```json theme={null}
{ "model": "wan2.7-image-pro", "prompt": "여름 해변, 파란 하늘과 흰 구름, 4K 초고화질", "size": "4K", "thinking_mode": true }
```

### 커스텀 색상 팔레트

```json theme={null}
{
  "model": "wan2.7-image-pro",
  "prompt": "미니멀한 모던 거실",
  "size": "2K",
  "color_palette": [
    { "hex": "#C2D1E6", "ratio": "23.51%" }, { "hex": "#CDD8E9", "ratio": "20.13%" },
    { "hex": "#B5C8DB", "ratio": "15.88%" }, { "hex": "#C0B5B4", "ratio": "13.27%" },
    { "hex": "#DAE0EC", "ratio": "10.11%" }, { "hex": "#636574", "ratio": "8.93%" },
    { "hex": "#CACAD2", "ratio": "5.55%" },  { "hex": "#CBD4E4", "ratio": "2.62%" }
  ]
}
```

### 연속 이미지 생성

```json theme={null}
{
  "model": "wan2.7-image-pro",
  "prompt": "영화 같은 시리즈: 같은 길고양이 오렌지 고양이. 첫 번째: 봄 벚꽃 나무 아래. 두 번째: 여름 오래된 거리 그늘. 세 번째: 가을 낙엽 가득한 길. 네 번째: 겨울 눈 위의 발자국.",
  "enable_sequential": true,
  "n": 4,
  "size": "2K"
}
```

### 단일 이미지 편집

```json theme={null}
{ "model": "wan2.7-image", "prompt": "배경을 노을 장면으로 바꾸고, 전체적으로 따뜻한 색조로", "image_urls": ["https://example.com/portrait.jpg"], "size": "2K" }
```

### 다중 이미지 참조 / 요소 융합

```json theme={null}
{
  "model": "wan2.7-image-pro",
  "prompt": "이미지2의 그래피티를 이미지1의 자동차에 그려주세요",
  "image_urls": ["https://example.com/car.webp", "https://example.com/paint.webp"],
  "size": "2K"
}
```

### 인터랙티브 편집（바운딩 박스）

`bbox_list`는 `image_urls`와 1:1로 대응합니다. 선택 영역이 없는 이미지에는 `[]`를 전달하세요.

```json theme={null}
{
  "model": "wan2.7-image-pro",
  "prompt": "이미지1의 알람 시계를 이미지2의 지정 영역에 배치하고, 장면과 조명에 자연스럽게 어울리도록",
  "image_urls": ["https://example.com/clock.webp", "https://example.com/desk.webp"],
  "bbox_list": [[], [[989, 515, 1138, 681]]],
  "size": "2K"
}
```

<Note>
  **결과 조회**

  이미지 생성은 비동기입니다. 반환된 `task_id`를 사용하여 [작업 상태](/ko/api-reference/tasks/status) 엔드포인트를 `status == completed`가 될 때까지 폴링하세요.
</Note>
