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

# GPT-Image-1.5 이미지 생성

> - 비동기 처리 모드, 후속 조회를 위한 작업 ID 반환
- OpenAI GPT Image 1.5, 텍스트 투 이미지 / 이미지 투 이미지(참조 이미지 편집, 다중 이미지 합성) 지원
- image_url 전달 시 자동으로 이미지 투 이미지로 처리, 미전달 시 텍스트 투 이미지로 처리
- 3가지 이미지 비율 지원: 1:1 / 3:2 / 2:3, aspect_ratio 필드를 통해 전달
- quality 품질 옵션 지원: medium(기본값, 더 빠름) / high(더 느림, 디테일이 더욱 풍부함)
- 참조 이미지 최대 16장 지원, URL 및 base64 혼합 입력 가능
- 1회 요청 시 이미지 1장 반환; resolution / size / 투명 배경 미지원
- 제출된 prompt는 플랫폼 민감어 / 안전 검토를 거치며, 위반 콘텐츠는 즉시 거부됨


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

## Authorizations

<ParamField header="Authorization" type="string" required>
  모든 인터페이스는 Bearer Token을 사용하여 인증해야 합니다

  API Key 가져오기:

  <a href={apiKeyUrl} target="_blank">API Key 관리 페이지</a>에 접속하여 API Key를 확인하세요

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

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

## Body

<ParamField body="model" type="string" required>
  모델명

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

<ParamField body="params" type="object" required>
  모델 파라미터 객체

  <Expandable title="params 객체 속성">
    <ParamField body="prompt" type="string" required>
      이미지 생성을 위한 텍스트 설명

      * 중국어 및 영어를 지원하며, 상세하게 설명하는 것을 권장합니다
      * 이미지 투 이미지 시 '수정할 부분'과 '그대로 유지할 부분'(예: 인물의 얼굴, 포즈, 배경)을 명확하게 작성해 주세요
      * 이미지에 표시되어야 하는 텍스트는 따옴표로 감싸 주세요
      * 제출 전 플랫폼의 민감어 / 안전 검사를 거치며, 위반 콘텐츠가 감지되면 즉시 오류가 반환됩니다
    </ParamField>

    <ParamField body="image_url" type="string[]">
      참조 이미지 배열로, 전달 시 이미지 투 이미지 모드로 실행되며 전달하지 않으면 텍스트 투 이미지로 실행됩니다

      * 최대 16장의 참조 이미지
      * 장당 10MB 이하, jpeg, png, webp 지원
      * 다음 두 가지 형식을 지원합니다:
        1. 공개적으로 접근 가능한 URL
        2. Base64 인코딩 형식
           * 반드시 완전한 Data URI 형식을 사용해야 합니다: `data:image/{格式};base64,{base64数据}`
           * 예시: `data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABg...`
           * ⚠️ 주의: 반드시 `data:image/jpeg;base64,` 접두사 부분을 포함해야 합니다
    </ParamField>

    <ParamField body="aspect_ratio" type="string" default="1:1">
      이미지 생성 비율

      지원하는 값은 다음과 같습니다:

      * `1:1` - 정사각형(기본값)
      * `3:2` - 가로형
      * `2:3` - 세로형

      <Warning>
        위 3가지 값만 지원됩니다. 다른 비율(예: `16:9`, `auto`)이나 픽셀 크기(예: `1024x1024`)를 전달하면 즉시 오류가 발생합니다
      </Warning>
    </ParamField>

    <ParamField body="quality" type="string" default="medium">
      이미지 품질 등급

      * `medium` - 균형 잡힘, 더 빠른 생성(기본값)
      * `high` - 더 느림, 더 풍부한 디테일, 최종본 완성에 적합

      먼저 `medium`으로 prompt와 구도를 조율한 후, 확정되면 `high`로 최종 이미지를 생성하는 것을 권장합니다. 등급에 따라 요금이 다르며, 제출 응답의 `estimated_credits`를 기준으로 합니다.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="out_task_id" type="string" required>
  요청자 작업 ID

  사용자 정의 작업 식별자, 필수
</ParamField>

## 使用说明

* **텍스트 투 이미지 / 이미지 투 이미지 자동 전환**: `image_url`을 전달하지 않으면 텍스트 투 이미지로 동작하며, 1\~16장의 참조 이미지를 전달하면 이미지 투 이미지로 동작하여 부분 수정, 의상 변경, 배경 교체, 스타일 변환 및 다중 이미지 합성에 사용할 수 있습니다.
* **두 모드의 파라미터 일치**: 텍스트 투 이미지와 이미지 투 이미지는 동일한 파라미터 세트를 사용하며, `quality` 등급에 따라 과금됩니다.
* **출력 크기**: `aspect_ratio`와 `quality`에 의해 함께 결정되며, 실제 픽셀 수는 반환된 이미지를 기준으로 합니다. 1K / 2K / 4K 또는 더 많은 비율이 필요한 경우 [GPT-Image-2](/en/api-reference/images/gpt-image-2/generation)를 사용하세요.
* **실패 시 미차감**: 작업 실패 시 포인트가 차감되지 않습니다.

## Response

<ResponseField name="out_task_id" type="string">
  요청자 작업 ID, 결과 조회에 사용 가능
</ResponseField>

<ResponseField name="status" type="string">
  초기 상태, `"pending"`으로 고정
</ResponseField>

<ResponseField name="estimated_credits" type="number">
  예상 소모 크레딧, `quality` 등급에 따라 변동
</ResponseField>

<ResponseField name="created_at" type="string">
  생성 시간 (ISO 형식)
</ResponseField>

<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": "gpt_image_1_5",
      "params": {
        "prompt": "사찰과 벚꽃, 큰 제목으로 \"VISIT KYOTO\"가 적힌 빈티지 여행 포스터",
        "aspect_ratio": "2:3",
        "quality": "high"
      },
      "out_task_id": "my_task_123456"
    }'
  ```

  ```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": "gpt_image_1_5",
      "params": {
        "prompt": "인물은 그대로 유지하고 배경을 화창한 해변으로 변경",
        "image_url": ["https://example.com/person.jpg"],
        "aspect_ratio": "3:2",
        "quality": "medium"
      },
      "out_task_id": "my_task_edit_001"
    }'
  ```

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

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

  payload = {
      "model": "gpt_image_1_5",
      "params": {
          "prompt": "인물은 그대로 유지하고 배경을 화창한 해변으로 변경",
          "image_url": ["https://example.com/person.jpg"],
          "aspect_ratio": "3:2",
          "quality": "medium"
      },
      "out_task_id": "my_task_123456"
  }

  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://aireiter.com/api/openapi/submit";

  const payload = {
    model: "gpt_image_1_5",
    params: {
      prompt: "인물은 그대로 유지하고 배경을 화창한 해변으로 변경",
      image_url: ["https://example.com/person.jpg"],
      aspect_ratio: "3:2",
      quality: "medium"
    },
    out_task_id: "my_task_123456"
  };

  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));
  ```

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

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

  func main() {
      url := "https://aireiter.com/api/openapi/submit"

      payload := map[string]interface{}{
          "model": "gpt_image_1_5",
          "params": map[string]interface{}{
              "prompt":       "인물은 그대로 유지하고 배경을 화창한 해변으로 변경",
              "image_url":    []string{"https://example.com/person.jpg"},
              "aspect_ratio": "3:2",
              "quality":      "medium",
          },
          "out_task_id": "my_task_123456",
      }

      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")

      client := &http.Client{}
      resp, err := 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 url = "https://aireiter.com/api/openapi/submit";

          String payload = """
          {
            "model": "gpt_image_1_5",
            "params": {
              "prompt": "인물은 그대로 유지하고 배경을 화창한 해변으로 변경",
              "image_url": ["https://example.com/person.jpg"],
              "aspect_ratio": "3:2",
              "quality": "medium"
            },
            "out_task_id": "my_task_123456"
          }
          """;

          HttpClient client = HttpClient.newHttpClient();
          HttpRequest request = HttpRequest.newBuilder()
              .uri(URI.create(url))
              .header("Authorization", "Bearer <token>")
              .header("Content-Type", "application/json")
              .POST(HttpRequest.BodyPublishers.ofString(payload))
              .build();

          HttpResponse<String> response = client.send(request,
              HttpResponse.BodyHandlers.ofString());

          System.out.println(response.body());
      }
  }
  ```

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

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

  $payload = [
      "model" => "gpt_image_1_5",
      "params" => [
          "prompt" => "인물은 그대로 유지하고 배경을 화창한 해변으로 변경",
          "image_url" => ["https://example.com/person.jpg"],
          "aspect_ratio" => "3:2",
          "quality" => "medium"
      ],
      "out_task_id" => "my_task_123456"
  ];

  $ch = curl_init($url);
  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"
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  echo $response;
  ?>
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
      "statusCode": 200,
      "message": "",
      "data": {
          "out_task_id": "my_task_123456",
          "status": "pending",
          "created_at": "2026-09-24T06:33:30.012Z"
      }
  }
  ```

  ```json 400 theme={null}
  {
      "statusCode": 400,
      "message": "요청 매개변수가 유효하지 않습니다",
      "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>
