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

# OpenAI 멀티모달 Responses API

>  - OpenAI Responses API 형식과 완전 호환
- 텍스트 및 이미지를 사용한 멀티모달 입력 지원
- 도구 확장 지원: 웹 검색, 파일 검색, 함수 호출, 원격 MCP 

<RequestExample>
  ```bash cURL theme={null}
  curl https://api.apimart.ai/v1/responses \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <token>" \
    -d '{
      "model": "gpt-5.2-pro",
      "input": [
        {
          "role": "user",
          "content": [
            {
              "type": "input_text",
              "text": "이 이미지에는 무엇이 있습니까?"
            },
            {
              "type": "input_image",
              "image_url": "https://openai-documentation.vercel.app/images/cat_and_otter.png"
            }
          ]
        }
      ]
    }'
  ```

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

  url = "https://api.apimart.ai/v1/responses"

  payload = {
      "model": "gpt-5.2-pro",
      "input": [
          {
              "role": "user",
              "content": [
                  {
                      "type": "input_text",
                      "text": "이 이미지에는 무엇이 있습니까?"
                  },
                  {
                      "type": "input_image",
                      "image_url": "https://openai-documentation.vercel.app/images/cat_and_otter.png"
                  }
              ]
          }
      ]
  }

  headers = {
      "Authorization": f"Bearer {os.environ.get('OPENAI_API_KEY')}",
      "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/responses";

  const payload = {
    model: "gpt-5.2-pro",
    input: [
      {
        role: "user",
        content: [
          {
            type: "input_text",
            text: "이 이미지에는 무엇이 있습니까?"
          },
          {
            type: "input_image",
            image_url: "https://openai-documentation.vercel.app/images/cat_and_otter.png"
          }
        ]
      }
    ]
  };

  const headers = {
    "Authorization": `Bearer ${process.env.OPENAI_API_KEY}`,
    "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"
      "os"
  )

  func main() {
      url := "https://api.apimart.ai/v1/responses"

      payload := map[string]interface{}{
          "model": "gpt-5.2-pro",
          "input": []map[string]interface{}{
              {
                  "role": "user",
                  "content": []map[string]string{
                      {
                          "type": "input_text",
                          "text": "이 이미지에는 무엇이 있습니까?",
                      },
                      {
                          "type":      "input_image",
                          "image_url": "https://openai-documentation.vercel.app/images/cat_and_otter.png",
                      },
                  },
              },
          },
      }

      jsonData, _ := json.Marshal(payload)

      req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
      req.Header.Set("Authorization", "Bearer "+os.Getenv("OPENAI_API_KEY"))
      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://api.apimart.ai/v1/responses";
          String apiKey = System.getenv("OPENAI_API_KEY");

          String payload = """
          {
            "model": "gpt-5.2-pro",
            "input": [
              {
                "role": "user",
                "content": [
                  {
                    "type": "input_text",
                    "text": "이 이미지에는 무엇이 있습니까?"
                  },
                  {
                    "type": "input_image",
                    "image_url": "https://openai-documentation.vercel.app/images/cat_and_otter.png"
                  }
                ]
              }
            ]
          }
          """;

          HttpClient client = HttpClient.newHttpClient();
          HttpRequest request = HttpRequest.newBuilder()
              .uri(URI.create(url))
              .header("Authorization", "Bearer " + apiKey)
              .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://api.apimart.ai/v1/responses";
  $apiKey = getenv('OPENAI_API_KEY');

  $payload = [
      "model" => "gpt-5.2-pro",
      "input" => [
          [
              "role" => "user",
              "content" => [
                  [
                      "type" => "input_text",
                      "text" => "이 이미지에는 무엇이 있습니까?"
                  ],
                  [
                      "type" => "input_image",
                      "image_url" => "https://openai-documentation.vercel.app/images/cat_and_otter.png"
                  ]
              ]
          ]
      ]
  ];

  $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 " . $apiKey,
      "Content-Type: application/json"
  ]);

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

  echo $response;
  ?>
  ```

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

  url = URI("https://api.apimart.ai/v1/responses")
  api_key = ENV['OPENAI_API_KEY']

  payload = {
    model: "gpt-5.2-pro",
    input: [
      {
        role: "user",
        content: [
          {
            type: "input_text",
            text: "이 이미지에는 무엇이 있습니까?"
          },
          {
            type: "input_image",
            image_url: "https://openai-documentation.vercel.app/images/cat_and_otter.png"
          }
        ]
      }
    ]
  }

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

  request = Net::HTTP::Post.new(url)
  request["Authorization"] = "Bearer #{api_key}"
  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/responses")!
  let apiKey = ProcessInfo.processInfo.environment["OPENAI_API_KEY"] ?? ""

  let payload: [String: Any] = [
      "model": "gpt-5.2-pro",
      "input": [
          [
              "role": "user",
              "content": [
                  [
                      "type": "input_text",
                      "text": "이 이미지에는 무엇이 있습니까?"
                  ],
                  [
                      "type": "input_image",
                      "image_url": "https://openai-documentation.vercel.app/images/cat_and_otter.png"
                  ]
              ]
          ]
      ]
  ]

  var request = URLRequest(url: url)
  request.httpMethod = "POST"
  request.setValue("Bearer \(apiKey)", 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 responseString = String(data: data, encoding: .utf8) {
          print(responseString)
      }
  }

  task.resume()
  ```

  ```csharp C# theme={null}
  using System;
  using System.Net.Http;
  using System.Text;
  using System.Threading.Tasks;

  class Program
  {
      static async Task Main(string[] args)
      {
          var url = "https://api.apimart.ai/v1/responses";
          var apiKey = Environment.GetEnvironmentVariable("OPENAI_API_KEY");

          var payload = @"{
              ""model"": ""gpt-5.2-pro"",
              ""input"": [
                  {
                      ""role"": ""user"",
                      ""content"": [
                          {
                              ""type"": ""input_text"",
                              ""text"": ""이 이미지에는 무엇이 있습니까?""
                          },
                          {
                              ""type"": ""input_image"",
                              ""image_url"": ""https://openai-documentation.vercel.app/images/cat_and_otter.png""
                          }
                      ]
                  }
              ]
          }";

          using var client = new HttpClient();
          client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");

          var content = new StringContent(payload, Encoding.UTF8, "application/json");
          var response = await client.PostAsync(url, content);
          var result = await response.Content.ReadAsStringAsync();

          Console.WriteLine(result);
      }
  }
  ```

  ```c C theme={null}
  #include <stdio.h>
  #include <curl/curl.h>
  #include <stdlib.h>

  int main(void) {
      CURL *curl;
      CURLcode res;
      const char *api_key = getenv("OPENAI_API_KEY");

      curl_global_init(CURL_GLOBAL_DEFAULT);
      curl = curl_easy_init();

      if(curl) {
          const char *url = "https://api.apimart.ai/v1/responses";
          const char *payload = "{"
              "\"model\":\"gpt-5.2-pro\","
              "\"input\":[{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"이 이미지에는 무엇이 있습니까?\"},{\"type\":\"input_image\",\"image_url\":\"https://openai-documentation.vercel.app/images/cat_and_otter.png\"}]}]"
          "}";

          char auth_header[256];
          snprintf(auth_header, sizeof(auth_header), "Authorization: Bearer %s", api_key);

          struct curl_slist *headers = NULL;
          headers = curl_slist_append(headers, auth_header);
          headers = curl_slist_append(headers, "Content-Type: application/json");

          curl_easy_setopt(curl, CURLOPT_URL, url);
          curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload);
          curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);

          res = curl_easy_perform(curl);

          if(res != CURLE_OK) {
              fprintf(stderr, "curl_easy_perform() failed: %s\n",
                      curl_easy_strerror(res));
          }

          curl_slist_free_all(headers);
          curl_easy_cleanup(curl);
      }

      curl_global_cleanup();
      return 0;
  }
  ```

  ```objectivec Objective-C theme={null}
  #import <Foundation/Foundation.h>

  int main(int argc, const char * argv[]) {
      @autoreleasepool {
          NSURL *url = [NSURL URLWithString:@"https://api.apimart.ai/v1/responses"];
          NSString *apiKey = [NSProcessInfo processInfo].environment[@"OPENAI_API_KEY"];

          NSDictionary *payload = @{
              @"model": @"gpt-5.2-pro",
              @"input": @[
                  @{
                      @"role": @"user",
                      @"content": @[
                          @{
                              @"type": @"input_text",
                              @"text": @"이 이미지에는 무엇이 있습니까?"
                          },
                          @{
                              @"type": @"input_image",
                              @"image_url": @"https://openai-documentation.vercel.app/images/cat_and_otter.png"
                          }
                      ]
                  }
              ]
          };

          NSError *error;
          NSData *jsonData = [NSJSONSerialization dataWithJSONObject:payload
                                                            options:0
                                                              error:&error];

          NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
          [request setHTTPMethod:@"POST"];
          [request setValue:[NSString stringWithFormat:@"Bearer %@", apiKey]
              forHTTPHeaderField:@"Authorization"];
          [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
          [request setHTTPBody:jsonData];

          NSURLSessionDataTask *task = [[NSURLSession sharedSession]
              dataTaskWithRequest:request
              completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
                  if (error) {
                      NSLog(@"Error: %@", error);
                      return;
                  }
                  NSString *result = [[NSString alloc] initWithData:data
                                                          encoding:NSUTF8StringEncoding];
                  NSLog(@"%@", result);
              }];

          [task resume];
          [[NSRunLoop mainRunLoop] run];
      }
      return 0;
  }
  ```

  ```ocaml OCaml theme={null}
  (* Requires cohttp and yojson libraries *)
  open Lwt
  open Cohttp
  open Cohttp_lwt_unix

  let url = "https://api.apimart.ai/v1/responses"
  let api_key = Sys.getenv "OPENAI_API_KEY"

  let payload = {|{
    "model": "gpt-5.2-pro",
    "input": [
      {
        "role": "user",
        "content": [
          {
            "type": "input_text",
            "text": "이 이미지에는 무엇이 있습니까?"
          },
          {
            "type": "input_image",
            "image_url": "https://openai-documentation.vercel.app/images/cat_and_otter.png"
          }
        ]
      }
    ]
  }|}

  let () =
    let headers = Header.init ()
      |> fun h -> Header.add h "Authorization" ("Bearer " ^ api_key)
      |> fun h -> Header.add h "Content-Type" "application/json"
    in
    let body = Cohttp_lwt.Body.of_string payload in

    let response = Client.post ~headers ~body (Uri.of_string url) >>= fun (resp, body) ->
      body |> Cohttp_lwt.Body.to_string >|= fun body_str ->
      print_endline body_str
    in
    Lwt_main.run response
  ```

  ```dart Dart theme={null}
  import 'dart:convert';
  import 'dart:io';
  import 'package:http/http.dart' as http;

  void main() async {
    final url = Uri.parse('https://api.apimart.ai/v1/responses');
    final apiKey = Platform.environment['OPENAI_API_KEY'];

    final payload = {
      'model': 'gpt-5.2-pro',
      'input': [
        {
          'role': 'user',
          'content': [
            {
              'type': 'input_text',
              'text': '이 이미지에는 무엇이 있습니까?'
            },
            {
              'type': 'input_image',
              'image_url': 'https://openai-documentation.vercel.app/images/cat_and_otter.png'
            }
          ]
        }
      ]
    };

    final response = await http.post(
      url,
      headers: {
        'Authorization': 'Bearer $apiKey',
        'Content-Type': 'application/json',
      },
      body: jsonEncode(payload),
    );

    print(response.body);
  }
  ```

  ```r R theme={null}
  library(httr)
  library(jsonlite)

  url <- "https://api.apimart.ai/v1/responses"
  api_key <- Sys.getenv("OPENAI_API_KEY")

  payload <- list(
    model = "gpt-5.2-pro",
    input = list(
      list(
        role = "user",
        content = list(
          list(
            type = "input_text",
            text = "이 이미지에는 무엇이 있습니까?"
          ),
          list(
            type = "input_image",
            image_url = "https://openai-documentation.vercel.app/images/cat_and_otter.png"
          )
        )
      )
    )
  )

  response <- POST(
    url,
    add_headers(
      Authorization = paste("Bearer", api_key),
      `Content-Type` = "application/json"
    ),
    body = toJSON(payload, auto_unbox = TRUE),
    encode = "raw"
  )

  cat(content(response, "text"))
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 200,
    "data": {
      "id": "resp-9876543210",
      "object": "response",
      "created": 1677652288,
      "model": "gpt-5.2-pro",
      "choices": [
        {
          "index": 0,
          "message": {
            "role": "assistant",
            "content": "이 이미지에는 고양이와 수달이 있습니다. 매우 귀엽고 훈훈한 장면으로 서로 교감하고 있는 것처럼 보입니다. 고양이와 수달이 사이좋게 지내고 있는 것 같습니다."
          },
          "finish_reason": "stop"
        }
      ],
      "usage": {
        "prompt_tokens": 156,
        "completion_tokens": 45,
        "total_tokens": 201
      }
    }
  }
  ```

  ```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 403 theme={null}
  {
    "error": {
      "code": 403,
      "message": "접근이 금지되었습니다. 이 리소스에 접근할 권한이 없습니다",
      "type": "permission_error"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "요청이 너무 많습니다. 나중에 다시 시도하세요",
      "type": "rate_limit_error"
    }
  }
  ```

  ```json 500 theme={null}
  {
    "error": {
      "code": 500,
      "message": "서버 내부 오류입니다. 나중에 다시 시도하세요",
      "type": "server_error"
    }
  }
  ```

  ```json 502 theme={null}
  {
    "error": {
      "code": 502,
      "message": "게이트웨이 오류입니다. 서버를 일시적으로 사용할 수 없습니다",
      "type": "bad_gateway"
    }
  }
  ```
</ResponseExample>

## Authorizations

<ParamField header="Authorization" type="string" required>
  \##모든 API는 Bearer Token 인증이 필요합니다##

  API 키 가져오기:

  [API 키 관리 페이지](https://apimart.ai/keys)를 방문하여 API 키를 받으세요

  요청 헤더에 추가:

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

## Body

<ParamField body="model" type="string" required default="gpt-5.2-pro">
  모델 이름

  지원되는 모델:

  * `gpt-5.2-pro`
  * `gpt-5.2-codex`
  * 더 많은 모델이 곧 출시될 예정입니다...
</ParamField>

<ParamField body="input" type="array" required>
  입력 콘텐츠 목록

  입력 배열, 각 항목은 `role`과 `content` 필드를 포함합니다.

  **💡 빠른 입력 (Try it 영역):**

  1. "+ Add an item"을 클릭하여 입력 항목 추가
  2. `role` 입력: `user` (사용자 메시지), `assistant` (AI 응답), 또는 `system` (시스템 프롬프트)
  3. `content` 콘텐츠 블록 추가 (텍스트와 이미지 포함 가능)

  <Expandable title="필드 상세">
    <ParamField body="role" type="string" required default="user">
      역할 유형

      선택 가능: `user` (사용자 메시지), `assistant` (AI 응답, 다중 턴용), `system` (시스템 프롬프트, AI 동작 설정)
    </ParamField>

    <ParamField body="content" type="array" required>
      콘텐츠 배열

      여러 유형의 콘텐츠 블록을 지원하며, 텍스트와 이미지를 포함할 수 있습니다.

      <Expandable title="콘텐츠 블록 유형">
        <ParamField body="type" type="string" required>
          콘텐츠 유형

          선택 가능:

          * `input_text`: 텍스트 입력
          * `input_image`: 이미지 입력
        </ParamField>

        <ParamField body="text" type="string">
          텍스트 내용

          `type`이 `input_text`일 때 사용, 텍스트 내용 입력
        </ParamField>

        <ParamField body="image_url" type="string">
          이미지 URL

          `type`이 `input_image`일 때 사용, 이미지 URL 또는 base64 인코딩 입력

          두 가지 형식을 지원합니다:

          **1. 전체 이미지 URL**

          * 공개적으로 접근 가능한 이미지 URL (http\:// 또는 https\://)
          * 예: `https://example.com/image.jpg`

          **2. Base64 인코딩 형식**

          * **완전한 Data URI 형식을 사용해야 합니다**
          * 형식: `data:image/{format};base64,{base64_data}`
          * 지원 이미지 형식: jpeg, png, gif, webp
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="temperature" type="number">
  출력 무작위성 제어, 범위 0-2

  * 낮은 값 (예: 0.2)은 출력을 더 결정적으로 만듭니다
  * 높은 값 (예: 1.8)은 출력을 더 무작위로 만듭니다

  기본값: 1.0
</ParamField>

<ParamField body="max_tokens" type="integer">
  생성할 최대 토큰 수

  모델마다 최대 제한이 다르므로 특정 모델 문서를 참조하세요
</ParamField>

<ParamField body="stream" type="boolean">
  스트리밍 출력 사용 여부

  * `true`: 스트림 응답 (SSE 형식)
  * `false`: 전체 응답을 한 번에 반환

  기본값: false
</ParamField>

<ParamField body="top_p" type="number">
  Nucleus 샘플링 매개변수, 범위 0-1

  생성된 텍스트의 다양성을 제어하며, temperature와 번갈아 사용하는 것을 권장합니다

  기본값: 1.0
</ParamField>

<ParamField body="tools" type="array">
  모델 기능을 확장하기 위한 도구 목록

  지원되는 도구 유형:

  * **웹 검색** (`web_search`): 실시간 인터넷 정보 검색
  * **파일 검색** (`file_search`): 업로드된 파일 콘텐츠 검색
  * **함수 호출** (`function`): 사용자 정의 함수 호출
  * **원격 MCP** (`remote_mcp`): 원격 Model Context Protocol 서비스에 연결

  예시: `[{"type": "web_search"}]`
</ParamField>

## Response

<ResponseField name="id" type="string">
  응답의 고유 식별자
</ResponseField>

<ResponseField name="object" type="string">
  객체 유형, `response`로 고정
</ResponseField>

<ResponseField name="created" type="integer">
  생성 타임스탬프
</ResponseField>

<ResponseField name="model" type="string">
  사용된 실제 모델 이름
</ResponseField>

<ResponseField name="choices" type="array">
  생성된 응답 목록

  <Expandable title="Properties">
    <ResponseField name="index" type="integer">
      선택 인덱스
    </ResponseField>

    <ResponseField name="message" type="object">
      메시지 내용

      <Expandable title="Properties">
        <ResponseField name="role" type="string">
          역할 유형 (assistant)
        </ResponseField>

        <ResponseField name="content" type="string">
          생성된 텍스트 내용
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="finish_reason" type="string">
      종료 이유

      가능한 값:

      * `stop` - 자연스러운 완료
      * `length` - 최대 길이 도달
      * `content_filter` - 콘텐츠 필터링
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="usage" type="object">
  토큰 사용 통계

  <Expandable title="Properties">
    <ResponseField name="prompt_tokens" type="integer">
      입력의 토큰 수
    </ResponseField>

    <ResponseField name="completion_tokens" type="integer">
      출력의 토큰 수
    </ResponseField>

    <ResponseField name="total_tokens" type="integer">
      총 토큰 수
    </ResponseField>
  </Expandable>
</ResponseField>

## 사용 예시

### 텍스트 전용 입력

```json theme={null}
{
  "model": "gpt-5.2-pro",
  "input": [
    {
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "안녕하세요, 인공지능을 소개해주세요"
        }
      ]
    }
  ]
}
```

### 웹 검색 도구 사용

```json theme={null}
{
  "model": "gpt-5.2-pro",
  "tools": [{"type": "web_search"}],
  "input": "오늘 어떤 긍정적인 뉴스가 있나요?"
}
```

```bash cURL 예시 theme={null}
curl "https://api.apimart.ai/v1/responses" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <token>" \
    -d '{
        "model": "gpt-5.2-pro",
        "tools": [{"type": "web_search"}],
        "input": "오늘 어떤 긍정적인 뉴스가 있나요?"
    }'
```

### 이미지 이해

```json theme={null}
{
  "model": "gpt-5.2-pro",
  "input": [
    {
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "이 이미지를 설명해주세요"
        },
        {
          "type": "input_image",
          "image_url": "https://example.com/image.jpg"
        }
      ]
    }
  ]
}
```

### 다중 이미지 분석

```json theme={null}
{
  "model": "gpt-5.2-pro",
  "input": [
    {
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "이 두 이미지의 유사점과 차이점을 비교해주세요"
        },
        {
          "type": "input_image",
          "image_url": "https://example.com/image1.jpg"
        },
        {
          "type": "input_image",
          "image_url": "https://example.com/image2.jpg"
        }
      ]
    }
  ]
}
```

### Base64 인코딩 이미지

```json theme={null}
{
  "model": "gpt-5.2-pro",
  "input": [
    {
      "role": "user",
      "content": [
        {
          "type": "input_text",
          "text": "이 이미지를 분석해주세요"
        },
        {
          "type": "input_image",
          "image_url": "data:image/jpeg;base64,/9j/4AAQSkZJRg..."
        }
      ]
    }
  ]
}
```

### 파일 검색 도구 사용

```json theme={null}
{
  "model": "gpt-5.2-pro",
  "tools": [{"type": "file_search"}],
  "input": "업로드된 문서를 기반으로 회사의 분기별 실적을 요약해주세요"
}
```

### 함수 호출 사용

```json theme={null}
{
  "model": "gpt-5.2-pro",
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "지정된 도시의 날씨 정보 가져오기",
        "parameters": {
          "type": "object",
          "properties": {
            "city": {
              "type": "string",
              "description": "도시 이름, 예: 서울"
            },
            "unit": {
              "type": "string",
              "enum": ["celsius", "fahrenheit"],
              "description": "온도 단위"
            }
          },
          "required": ["city"]
        }
      }
    }
  ],
  "input": "오늘 서울의 날씨는 어떤가요?"
}
```

### 원격 MCP 사용

```json theme={null}
{
  "model": "gpt-5.2-pro",
  "tools": [
    {
      "type": "remote_mcp",
      "remote_mcp": {
        "url": "https://mcp.example.com/api",
        "auth_token": "your_mcp_token"
      }
    }
  ],
  "input": "데이터베이스에서 사용자 정보를 조회해주세요"
}
```

### 여러 도구 결합

```json theme={null}
{
  "model": "gpt-5.2-pro",
  "tools": [
    {"type": "web_search"},
    {"type": "file_search"},
    {
      "type": "function",
      "function": {
        "name": "calculate",
        "description": "수학 계산 수행",
        "parameters": {
          "type": "object",
          "properties": {
            "expression": {
              "type": "string",
              "description": "수학 표현식"
            }
          },
          "required": ["expression"]
        }
      }
    }
  ],
  "input": "최신 비트코인 가격을 검색하고 비트코인 100개의 총 가치를 계산해주세요"
}
```

## 콘텐츠 유형 사양

### input\_text

텍스트 입력 유형

**속성:**

* `type`: `"input_text"`로 고정
* `text`: 텍스트 내용 (문자열)

### input\_image

이미지 입력 유형

**속성:**

* `type`: `"input_image"`로 고정
* `image_url`: 이미지 URL 또는 Base64 인코딩된 데이터 URI

**지원되는 이미지 형식:**

* JPEG
* PNG
* GIF
* WebP

**이미지 크기 제한:**

* 최대 파일 크기: 20MB
* 권장 해상도: 2048x2048 픽셀 이하

## 도구 사용 세부 정보

### 웹 검색

웹 검색 도구를 사용하면 모델이 실시간 인터넷 정보에 접근할 수 있습니다.

**구성 예시:**

```json theme={null}
{
  "tools": [{"type": "web_search"}]
}
```

**사용 사례:**

* 최신 뉴스 및 시사 조회
* 실시간 데이터 가져오기 (주식, 날씨, 환율 등)
* 최신 기술 문서 검색
* 사실 정보 확인

### 파일 검색

파일 검색 도구를 사용하면 모델이 업로드된 문서에서 관련 정보를 검색할 수 있습니다.

**구성 예시:**

```json theme={null}
{
  "tools": [{"type": "file_search"}]
}
```

**사용 사례:**

* 회사 내부 문서 분석
* 기술 사양 및 매뉴얼 검색
* 계약서 및 법률 문서 조회
* 지식 베이스 Q\&A 시스템

### 함수 호출

사용자 정의 함수를 정의하여 모델이 외부 API를 호출하거나 특정 작업을 수행할 수 있게 합니다.

**전체 구성 예시:**

```json theme={null}
{
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_stock_price",
        "description": "실시간 주가 가져오기",
        "parameters": {
          "type": "object",
          "properties": {
            "symbol": {
              "type": "string",
              "description": "주식 기호, 예: AAPL"
            },
            "currency": {
              "type": "string",
              "enum": ["USD", "CNY"],
              "description": "통화 단위",
              "default": "USD"
            }
          },
          "required": ["symbol"]
        }
      }
    }
  ]
}
```

**매개변수 설명:**

* `name`: 함수 이름 (필수)
* `description`: 함수 설명 (필수)
* `parameters`: JSON Schema 형식을 사용한 매개변수 정의
  * `type`: 매개변수 유형
  * `properties`: 매개변수 속성 정의
  * `required`: 필수 매개변수 목록

**사용 사례:**

* 타사 API 호출
* 데이터베이스 쿼리 실행
* 비즈니스 프로세스 트리거
* 내부 시스템과 통합

### 원격 MCP

원격 Model Context Protocol (MCP) 서비스에 연결하여 모델 기능을 확장합니다.

**구성 예시:**

```json theme={null}
{
  "tools": [
    {
      "type": "remote_mcp",
      "remote_mcp": {
        "url": "https://your-mcp-server.com/api",
        "auth_token": "your_auth_token",
        "timeout": 30
      }
    }
  ]
}
```

**매개변수 설명:**

* `url`: MCP 서버 주소 (필수)
* `auth_token`: 인증 토큰 (선택)
* `timeout`: 타임아웃(초), 기본값 30초

**사용 사례:**

* 기업급 AI 서비스에 연결
* 도메인별 모델 사용
* 보호된 데이터 소스에 접근
* 분산 AI 시스템 통합

## 도구 응답 형식

모델이 도구를 사용하면 응답 형식에 도구 호출 정보가 포함됩니다:

```json theme={null}
{
  "id": "resp-123456",
  "object": "response",
  "created": 1677652288,
  "model": "gpt-5.2-pro",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": null,
        "tool_calls": [
          {
            "id": "call_abc123",
            "type": "function",
            "function": {
              "name": "get_weather",
              "arguments": "{\"city\": \"서울\"}"
            }
          }
        ]
      },
      "finish_reason": "tool_calls"
    }
  ]
}
```

**도구 호출 워크플로:**

1. 모델이 사용자 입력을 수신
2. 도구가 필요한지 분석
3. 필요한 경우 도구 호출 요청 반환
4. 클라이언트가 도구 호출 실행
5. 도구 결과를 모델에 반환
6. 모델이 최종 응답 생성

## 중요 참고 사항

1. **이미지 URL 요구 사항**:
   * 공개적으로 접근 가능한 URL이어야 합니다
   * 또는 Base64 인코딩된 Data URI 형식 사용

2. **토큰 청구**:
   * 이미지는 해상도에 따라 토큰을 소비합니다
   * 고해상도 이미지는 비용 최적화를 위해 자동으로 크기가 조정됩니다
   * 도구 호출도 추가 토큰을 소비합니다

3. **콘텐츠 순서**:
   * 콘텐츠 배열의 요소 순서가 모델 이해에 영향을 줍니다
   * 텍스트 지시사항을 먼저, 그다음 이미지를 배치하는 것을 권장합니다

4. **멀티모달 조합**:
   * 하나의 요청에서 여러 텍스트와 이미지를 혼합할 수 있습니다
   * 컨텍스트 일관성을 유지하는 다중 턴 대화를 지원합니다

5. **도구 사용 제한 사항**:
   * 여러 도구를 동시에 사용할 때 모델이 가장 적절한 도구를 지능적으로 선택합니다
   * 함수 호출에는 명확한 함수 정의와 매개변수 설명이 필요합니다
   * 웹 검색 결과는 지역 및 시간에 따라 제한될 수 있습니다

6. **API 호환성**:
   * OpenAI Responses API 형식과 완전히 호환됩니다
   * 기존 OpenAI 코드를 원활하게 마이그레이션할 수 있습니다
   * 모든 OpenAI 도구 확장 기능을 지원합니다
