> ## 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 2.0 이미지 생성

>  - 비동기 처리 모드, 후속 쿼리를 위한 작업 ID 반환
- 텍스트-이미지, 이미지-이미지 등 다양한 생성 모드 지원
- 1K/2K 해상도 등급 지원, 최대 6장 이미지 생성 

<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-2.0",
      "prompt": "햇살 아래 낮잠 자는 귀여운 주황색 고양이"
    }'
  ```

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

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

  payload = {
      "model": "qwen-image-2.0",
      "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: "qwen-image-2.0",
    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>

## 지원되는 모델

| 모델명                  | 설명                                 | 최대 장수 | 과금 방식 |
| -------------------- | ---------------------------------- | ----- | ----- |
| `qwen-image-2.0`     | 표준 버전, 품질과 성능의 균형                  | 6장    | 고정 가격 |
| `qwen-image-2.0-pro` | Pro 버전, 텍스트 렌더링이 강력하고 사실적 질감이 더 세밀 | 6장    | 고정 가격 |

## 인증

<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>
  모델 이름

  * `qwen-image-2.0` - 표준 버전, 품질과 성능의 균형
  * `qwen-image-2.0-pro` - Pro 버전, 텍스트 렌더링이 강력하고 사실적 질감이 더 세밀
</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="n" type="integer" default="1">
  생성할 이미지 수

  범위: 1-6
</ParamField>

<ParamField body="negative_prompt" type="string">
  네거티브 프롬프트 (나타나지 않기를 원하는 콘텐츠), 최대 500자
</ParamField>

<ParamField body="image_urls" type="array">
  참조 이미지 URL 배열 (이미지-이미지 모드)

  **제한:**

  * 공개적으로 접근 가능한 URL이어야 함
  * Base64 형식은 지원되지 않음
</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 |

* `size`만 전달 → 기본 1K 등급: `{"size": "16:9"}` → 1280×720
* `size` + `resolution` 전달 → 지정 등급: `{"size": "16:9", "resolution": "2K"}` → 2048×1152

## 사용 예시

**텍스트-이미지 (최소 요청)**

```json theme={null}
{
  "model": "qwen-image-2.0",
  "prompt": "햇살 아래 낮잠 자는 귀여운 주황색 고양이"
}
```

**비율과 장수 지정**

```json theme={null}
{
  "model": "qwen-image-2.0-pro",
  "prompt": "사이버펑크 스타일의 미래 도시 야경, 네온 불빛이 깜빡임",
  "size": "16:9",
  "n": 4
}
```

**고화질 2K 등급**

```json theme={null}
{
  "model": "qwen-image-2.0-pro",
  "prompt": "정교한 음식 사진, 초밥 모듬",
  "size": "4:3",
  "resolution": "2K",
  "n": 2
}
```

**이미지-이미지 (참조 이미지 + 텍스트 설명)**

```json theme={null}
{
  "model": "qwen-image-2.0",
  "prompt": "배경을 해변 일몰로 변경",
  "image_urls": ["https://example.com/my-photo.jpg"]
}
```

## 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. **이미지 URL 요구사항**: 입력 이미지는 공개적으로 접근 가능한 URL이어야 합니다, base64는 지원되지 않습니다
