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

# FLUX.2 Pro 이미지 생성

> - 비동기 처리 모드, 이후 조회를 위한 작업 ID 반환
- 텍스트에서 이미지 생성과 이미지 변환 지원, image_url 입력 시 자동으로 이미지 변환 모드로 전환
- 최대 8장의 참고 이미지 지원, 주제, 상품, 스타일 및 구도 일관성 유지용
- 7가지 일반적인 이미지 비율 지원
- 1K / 2K 해상도 등급 지원
- 제출된 프롬프트는 플랫폼의 민감어 및 안전 심사를 거치며, 위반 내용은 즉시 거부됨


export const apiKeyUrl = 'https://aireiter.com/keys';

## Authorizations

<ParamField header="Authorization" type="string" required>
  모든 엔드포인트는 Bearer Token 인증을 필요로 합니다.

  API 키 받기:

  <a href={apiKeyUrl} target="_blank">API Key 관리 페이지</a>에서 API 키를 받으세요.

  요청 헤더에 다음을 추가하세요:

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

## Body

<ParamField body="model" type="string" required>
  모델 이름입니다.

  고정 값: `"flux_2_pro"`
</ParamField>

<ParamField body="params" type="object" required>
  모델 매개변수 객체입니다.

  <Expandable title="params 객체 속성">
    <ParamField body="prompt" type="string" required>
      이미지 생성 또는 편집 지시어로, 최대 5000자까지 입력 가능합니다.

      * 한중영 지원, 주제, 장면, 구성, 조명, 재질 및 유지할 참조 이미지 특징을 명확하게 설명하는 것이 좋습니다.
      * 이미지-이미지 변환 시, 프롬프트에 유지할 부분과 수정할 부분을 명확히 기재해야 합니다.
      * 제출 전 플랫폼에서 민감어 및 안전성 검사를 거치며, 위반 내용 발견 시 오류를 직접 반환합니다.
    </ParamField>

    <ParamField body="image_url" type="string[]">
      참조 이미지 배열입니다. 전달하면 자동으로 이미지-이미지 모드가 사용되고, 전달하지 않으면 텍스트-이미지 모드가 사용됩니다.

      * 최대 8장의 참조 이미지
      * 단일 이미지 최대 크기 10MB
      * jpeg, png, webp 지원
      * 다음 두 가지 형식 지원:
        1. 공개 접근 가능한 URL
        2. 완전한 Base64 Data URI 예: `data:image/jpeg;base64,/9j/4AAQ...`

      <Warning>
        URL은 공용 인터넷에서 직접 접근 가능해야 하며, 로그인, 쿠키 또는 임시 페이지 인증을 요구할 수 없습니다.
      </Warning>
    </ParamField>

    <ParamField body="aspect_ratio" type="string" default="1:1">
      이미지 가로세로 비율입니다.

      다음 값을 지원합니다:

      * `1:1` - 정사각형 (기본값)
      * `4:3` / `3:4` - 표준 가로 / 세로
      * `16:9` / `9:16` - 와이드 가로 / 세로
      * `3:2` / `2:3` - 클래식 가로 / 세로

      <Warning>
        `aspect_ratio`는 모델의 목표 비율 단계를 의미하며, 고정된 픽셀 크기를 보장하지 않습니다. 생성 모드에 따라 비율에 근접한 모델 네이티브 크기를 반환할 수 있습니다. 예를 들어, 실측 1K 이미지-이미지 16:9는 1344×768을 반환하고, 2K 텍스트-이미지 16:9는 1920×1088을 반환합니다.
      </Warning>
    </ParamField>

    <ParamField body="resolution" type="string" default="1K">
      이미지 해상도 단계입니다.

      * `1K` - 기본 해상도(기본값), 한 장당 예상 5 포인트 소모
      * `2K` - 고해상도, 한 장당 예상 7 포인트 소모
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="out_task_id" type="string" required>
  호출자가 정의한 작업 ID로, 멱등성 제출 및 결과 조회에 사용됩니다.

  * 길이는 1\~64자
  * 영문자, 숫자, 밑줄, 하이픈만 허용
  * 동일 API Key 내 중복 사용 불가
</ParamField>

## 과금

| 해상도  | 예상 소모 포인트 | 생성 수량 |
| ---- | --------: | ----: |
| `1K` |         5 |    1장 |
| `2K` |         7 |    1장 |

제출 성공 시, 응답의 `estimated_credits` 는 예상 소모 포인트입니다. 작업 완료 후, 조회 API 응답의 `credits_used` 를 통해 실제 소모된 포인트를 확인할 수 있습니다. 작업 생성 실패 시, 시스템은 자동으로 이번 작업에 예치된 포인트를 환불합니다.

## Response

<ResponseField name="out_task_id" type="string">
  호출자 작업 ID로, 결과 조회에 사용할 수 있습니다.
</ResponseField>

<ResponseField name="status" type="string">
  초기 상태이며, 고정값 `"pending"`입니다.
</ResponseField>

<ResponseField name="estimated_credits" type="number">
  예상 소모 포인트입니다.
</ResponseField>

<ResponseField name="created_at" type="string">
  생성 시간이며, ISO 8601 형식입니다.
</ResponseField>

## 조회 결과

제출이 성공한 후, 동일한 `out_task_id`를 사용하여 호출하세요:

```bash theme={null}
curl --request POST \
  --url https://aireiter.com/api/openapi/query \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "out_task_id": "flux_2_pro_task_001"
  }'
```

작업 상태는 `pending`, `processing`, `completed`, `failed`를 포함합니다. 작업이 완료되면 결과 이미지는 `data.output`에, 실제 소모된 크레딧은 `data.credits_used`에 위치합니다.

<RequestExample>
  ```bash cURL (텍스트→이미지) theme={null}
  curl --request POST \
    --url https://aireiter.com/api/openapi/submit \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "flux_2_pro",
      "params": {
        "prompt": "미래지향적인 전기 스포츠카가 현대적인 유리 건물 앞에 주차되어 있으며, 블루 아워, 습한 바닥에는 건물 조명이 반사되고, 상업 자동차 촬영, 실제 질감과 자연스러운 그림자, 문자 및 워터마크 없음",
        "aspect_ratio": "16:9",
        "resolution": "2K"
      },
      "out_task_id": "flux_2_pro_task_001"
    }'
  ```

  ```bash cURL (이미지→이미지) theme={null}
  curl --request POST \
    --url https://aireiter.com/api/openapi/submit \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "flux_2_pro",
      "params": {
        "prompt": "참조 상품 이미지를 고급 야간 광고 스타일로 변경, 병 모양, 비율, 스프레이 헤드, 투명 유리 구조 및 라벨 문자를 유지하며, 짙은 회색 배경과 차가운 색상의 윤곽광 사용, 상품 하나만 유지",
        "image_url": [
          "https://example.com/product-reference.png"
        ],
        "aspect_ratio": "16:9",
        "resolution": "1K"
      },
      "out_task_id": "flux_2_pro_image_task_001"
    }'
  ```

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

  url = "https://aireiter.com/api/openapi/submit"

  payload = {
      "model": "flux_2_pro",
      "params": {
          "prompt": "영화 같은 제품 광고 사진, 검은 돌 받침대 위에 유리 향수병이 놓여 있고, 실제 반사와 자연스러운 그림자",
          "aspect_ratio": "16:9",
          "resolution": "1K"
      },
      "out_task_id": "flux_2_pro_python_001"
  }

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

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

  ```javascript JavaScript theme={null}
  const response = await fetch("https://aireiter.com/api/openapi/submit", {
    method: "POST",
    headers: {
      Authorization: "Bearer <token>",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      model: "flux_2_pro",
      params: {
        prompt: "영화 같은 제품 광고 사진, 검은 돌 받침대 위에 유리 향수병이 놓여 있고, 실제 반사와 자연스러운 그림자",
        aspect_ratio: "16:9",
        resolution: "1K"
      },
      out_task_id: "flux_2_pro_javascript_001"
    })
  });

  console.log(await response.json());
  ```

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

  import (
      "bytes"
      "fmt"
      "io"
      "net/http"
  )

  func main() {
      payload := []byte(`{
        "model":"flux_2_pro",
        "params":{
          "prompt":"영화 같은 제품 광고 사진, 검은 돌 받침대 위에 유리 향수병이 놓여 있고, 실제 반사와 자연스러운 그림자",
          "aspect_ratio":"16:9",
          "resolution":"1K"
        },
        "out_task_id":"flux_2_pro_go_001"
      }`)

      req, _ := http.NewRequest(
          http.MethodPost,
          "https://aireiter.com/api/openapi/submit",
          bytes.NewBuffer(payload),
      )
      req.Header.Set("Authorization", "Bearer <token>")
      req.Header.Set("Content-Type", "application/json")

      response, err := http.DefaultClient.Do(req)
      if err != nil {
          panic(err)
      }
      defer response.Body.Close()

      body, _ := io.ReadAll(response.Body)
      fmt.Println(string(body))
  }
  ```

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

  public class Main {
      public static void main(String[] args) throws Exception {
          String payload = """
          {
            "model": "flux_2_pro",
            "params": {
              "prompt": "영화 같은 제품 광고 사진, 검은 돌 받침대 위에 유리 향수병이 놓여 있고, 실제 반사와 자연스러운 그림자",
              "aspect_ratio": "16:9",
              "resolution": "1K"
            },
            "out_task_id": "flux_2_pro_java_001"
          }
          """;

          HttpRequest request = HttpRequest.newBuilder()
              .uri(URI.create("https://aireiter.com/api/openapi/submit"))
              .header("Authorization", "Bearer <token>")
              .header("Content-Type", "application/json")
              .POST(HttpRequest.BodyPublishers.ofString(payload))
              .build();

          HttpResponse<String> response = HttpClient.newHttpClient().send(
              request,
              HttpResponse.BodyHandlers.ofString()
          );
          System.out.println(response.body());
      }
  }
  ```

  ```php PHP theme={null}
  <?php

  $payload = [
      "model" => "flux_2_pro",
      "params" => [
          "prompt" => "영화 같은 제품 광고 사진, 검은 돌 받침대 위에 유리 향수병이 놓여 있고, 실제 반사와 자연스러운 그림자",
          "aspect_ratio" => "16:9",
          "resolution" => "1K"
      ],
      "out_task_id" => "flux_2_pro_php_001"
  ];

  $ch = curl_init("https://aireiter.com/api/openapi/submit");
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      "Authorization: Bearer <token>",
      "Content-Type: application/json"
  ]);

  echo curl_exec($ch);
  curl_close($ch);
  ?>
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "statusCode": 200,
    "message": "",
    "data": {
      "task_id": "",
      "status": "pending",
      "created_at": "2026-07-22T10:37:44.800Z",
      "out_task_id": "flux_2_pro_task_001",
      "estimated_credits": 5
    },
    "ok": true
  }
  ```

  ```json 400 theme={null}
  {
    "statusCode": 400,
    "message": "잘못된 aspect_ratio: \"widescreen\". 허용 값: [1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3]",
    "ok": false
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "인증 실패, API 키를 확인하세요"
    }
  }
  ```

  ```json 433 theme={null}
  {
    "error": {
      "code": 433,
      "message": "계정 잔액 부족, 충전 후 다시 시도하세요"
    }
  }
  ```

  ```json 500 theme={null}
  {
    "error": {
      "code": 500,
      "message": "서버 내부 오류, 나중에 다시 시도하세요"
    }
  }
  ```
</ResponseExample>
