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

# OpenAI Responses API 신청 및 사용

> OpenAI generation API guide - Ace Data Cloud

OpenAI는 최근 모델 응답을 생성하는 인터페이스를 제공했습니다. 텍스트 또는 이미지 입력을 제공하여 텍스트 또는 이미지 출력을 생성합니다. 모델이 자체 사용자 정의 코드를 호출하거나 웹 검색 또는 파일 검색과 같은 내장 도구를 사용하도록 하여, 자체 데이터를 모델 응답의 입력으로 사용할 수 있습니다.

이 문서는 주로 OpenAI Responses API 작업의 사용 절차를 소개하며, 이를 통해 공식 OpenAI의 모델 응답 생성 기능을 쉽게 사용할 수 있습니다.

## GPT-6.1 Sol

`model: "gpt-6.1-sol"`을 사용하여 해당 모델을 선택합니다. 스트리밍 출력, 함수 호출, 구조화된 출력 및 이미지 입력을 지원합니다. 최초 공개된 첫 주 동안에는 검증된 ACE T1+ 보유자(최소 100,000 ACE) 또는 권한을 부여받은 사용자에게만 공개됩니다. 구체적인 공개 시점은 콘솔 접근 안내를 기준으로 합니다.

추론 수준은 `low`, `medium`, `high`, `xhigh` 및 `max`를 지원하며, 현재 `none` 또는 `minimal`은 지원하지 않습니다. `reasoning: {"effort": "low"}`부터 시작하는 것을 권장합니다. 입력이 272,000 tokens를 초과하면 전체 요청에 장문 컨텍스트 가격이 적용되며, 비용은 콘솔의 현재 가격을 기준으로 합니다.

## 신청 절차

OpenAI Responses API를 사용하려면 먼저 [Ace Data Cloud 콘솔](https://platform.acedata.cloud/console/applications)에서 API Token을 발급받아 예비용으로 보관하세요.

![](https://cdn.acedata.cloud/dvc3cg.jpg)

아직 로그인하거나 등록하지 않았다면 로그인 페이지로 자동 이동하여 등록 및 로그인을 안내하며, 완료 후 현재 페이지로 자동 반환됩니다.

**하나의 API Token으로 플랫폼의 모든 서비스를 호출할 수 있으며, 서비스별로 별도 신청할 필요가 없습니다.** 최초 신청 시 무료 크레딧이 제공되어 무료로 체험할 수 있으며, 크레딧이 부족할 경우 [콘솔](https://platform.acedata.cloud/console/coin)에서 공용 잔액을 충전할 수 있습니다.

> 📘 전체 문서: [OpenAI Responses API →](https://platform.acedata.cloud/documents/openai-responses)

## 기본 사용

다음으로 화면에서 해당 내용을 입력할 수 있으며, 그림과 같습니다:

![](https://cdn.acedata.cloud/8lu8di.png)

이 인터페이스를 처음 사용할 때는 최소 세 가지 내용을 입력해야 합니다. 하나는 `authorization`이며, 드롭다운 목록에서 직접 선택하면 됩니다. 다른 하나의 매개변수는 `model`이며, `model`은 우리가 사용할 OpenAI ChatGPT 공식 웹사이트 모델 유형입니다. 여기에는 주로 20가지 모델이 있으며, 자세한 내용은 우리가 제공하는 모델을 확인할 수 있습니다. 마지막 매개변수는 `input`이며, `input`은 우리가 입력하는 질문 문구 배열입니다. 이는 배열로, 여러 질문 문구를 동시에 업로드할 수 있음을 나타내며, 각 질문 문구에는 `role`과 `content`가 포함됩니다. 그중 `role`은 질문자의 역할을 나타내며, 우리는 `user`, `assistant`, `system`의 세 가지 신분을 제공합니다. 또 다른 `content`는 우리가 질문하는 구체적인 내용입니다.

동시에 오른쪽에 해당 호출 코드가 생성되는 것을 확인할 수 있으며, 코드를 복사하여 직접 실행하거나 「Try」 버튼을 직접 클릭하여 테스트할 수도 있습니다.

자주 사용하는 선택적 매개변수:

* `max_tokens`: 단일 응답의 최대 token 수를 제한합니다.
* `temperature`: 생성 무작위성으로, 0-2 사이이며 값이 클수록 더 발산적입니다.
* `n`: 한 번에 생성할 후보 응답 수입니다.
* `response_format`: 반환 형식 설정입니다.
* `tools`: 함수/도구 호출 정의입니다.
* `background`: 백그라운드에서 비동기로 실행할지 여부입니다.

![](https://cdn.acedata.cloud/rsw47a.png)

호출 후 반환 결과는 다음과 같습니다:

```json theme={null}
{
  "id": "resp_68a98322e3c88191a027de2711a02a490554cad0b36c0400",
  "object": "response",
  "created_at": 1755939618,
  "status": "completed",
  "background": false,
  "content_filters": null,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "max_tool_calls": null,
  "model": "gpt-5.5",
  "output": [
    {
      "id": "msg_68a98323422c8191a7f383eea48ba5160554cad0b36c0400",
      "type": "message",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "annotations": [],
          "text": "Hello! How can I assist you today?"
        }
      ],
      "role": "assistant"
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "prompt_cache_key": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "safety_identifier": null,
  "service_tier": "default",
  "store": true,
  "temperature": 1,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "top_p": 1,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 8,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 10,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 18
  },
  "user": null,
  "metadata": {}
}
```

반환 결과에는 여러 필드가 있으며, 소개는 다음과 같습니다:

* `id`: 이번 대화 작업을 생성하는 ID로, 이번 대화 작업을 고유하게 식별하는 데 사용됩니다.
* `model `: 선택한 OpenAI ChatGPT 공식 웹사이트 모델입니다.
* `output`: ChatGPT가 질문 문구에 대해 제공한 응답 정보입니다.
* `usage `: 이번 질의응답에 대한 token 통계 정보입니다.

그중 `output`은 ChatGPT의 응답 정보를 포함하며, 그 안의 `output`은 ChatGPT입니다. 그림과 같이 확인할 수 있습니다.

![](https://cdn.acedata.cloud/mald8o.png)

`output` 내부의 `content` 필드에 ChatGPT 응답의 구체적인 내용이 포함되어 있음을 확인할 수 있습니다.

## 스트리밍 응답

이 인터페이스는 스트리밍 응답도 지원하며, 이는 웹페이지 연동에 매우 유용하여 웹페이지에서 글자 단위 표시 효과를 구현할 수 있습니다.

응답을 스트리밍으로 반환하려면 요청 헤더의 `stream ` 매개변수를 변경하여 `true`로 수정할 수 있습니다.

수정은 그림과 같지만, 호출 코드도 스트리밍 응답을 지원하도록 해당 변경이 필요합니다.

![](https://cdn.acedata.cloud/xidnao.png)

`stream`을 `true`로 수정한 후 API는 해당 JSON 데이터를 한 줄씩 반환하며, 코드 수준에서는 한 줄씩 결과를 얻기 위해 이에 맞는 수정이 필요합니다.

Python 예제 호출 코드:

```python theme={null}
import requests

url = "https://api.acedata.cloud/openai/responses"

headers = {
    "accept": "application/json",
    "authorization": "Bearer {token}",
    "content-type": "application/json"
}

payload = {
    "model": "gpt-4.1",
    "input": [{"role":"user","content":"Hello"}],
    "stream": True
}

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

출력 효과는 다음과 같습니다:

```json theme={null}
data: {"type": "response.created", "sequence_number": 0, "response":
{"id": "resp_68a9837bb9bc8190b403947311db6faa0721186e8fbb89d0", "object": "response", "created_at": 1755939707, "status": "in_progress", "background": false, "content_filters": null, "error": null, "incomplete_details": null, "instructions": null, "max_output_tokens": null, "max_tool_calls": null, "model": "gpt-4.1-data", "output": [], "parallel_tool_calls": true, "previous_response_id": null, "prompt_cache_key": null, "reasoning": {"effort": null, "summary": null}, "safety_identifier": null, "service_tier": "auto", "store": true, "temperature": 1.0, "text": {"format": {"type": "text"}}, "tool_choice": "auto", "tools": [], "top_p": 1.0, "truncation": "disabled", "usage": null, "user": null, "metadata": {}}, "model": "gpt-4.1"} 

data: {"type": "response.in_progress", "sequence_number": 1, "response": {"id": "resp_68a9837bb9bc8190b403947311db6faa0721186e8fbb89d0", "object": "response", "created_at": 1755939707, "status": "in_progress", "background": false, "content_filters": null, "error": null, "incomplete_details": null, "instructions": null, "max_output_tokens": null, "max_tool_calls": null, "model": "gpt-4.1-data", "output": [], "parallel_tool_calls": true, "previous_response_id": null, "prompt_cache_key": null, "reasoning": {"effort": null, "summary": null}, "safety_identifier": null, "service_tier": "auto", "store": true, "temperature": 1.0, "text": {"format": {"type": "text"}}, "tool_choice": "auto", "tools": [], "top_p": 1.0, "truncation": "disabled", "usage": null, "user": null, "metadata": {}}, "model": "gpt-4.1"} 

data: {"type": "response.output_item.added", "sequence_number": 2, "output_index": 0, "item": {"id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "type": "message", "status": "in_progress", "content": [], "role": "assistant"}, "model": "gpt-4.1"} 

data: {"type": "response.content_part.added", "sequence_number": 3, "item_id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "output_index": 0, "content_index": 0, "part": {"type": "output_text", "annotations": [], "text": ""}, "model": "gpt-4.1"} 

data: {"type": "response.output_text.delta", "sequence_number": 4, "item_id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "output_index": 0, "content_index": 0, "delta": "안녕", "model": "gpt-4.1"} 

data: {"type": "response.output_text.delta", "sequence_number": 5, "item_id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "output_index": 0, "content_index": 0, "delta": "!", "model": "gpt-4.1"} 

data: {"type": "response.output_text.delta", "sequence_number": 6, "item_id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "output_index": 0, "content_index": 0, "delta": " 오늘", "model": "gpt-4.1"} 

data: {"type": "response.output_text.delta", "sequence_number": 7, "item_id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "output_index": 0, "content_index": 0, "delta": " 어떻게", "model": "gpt-4.1"} 

data: {"type": "response.output_text.delta", "sequence_number": 8, "item_id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "output_index": 0, "content_index": 0, "delta": " 도와", "model": "gpt-4.1"} 

data: {"type": "response.output_text.delta", "sequence_number": 9, "item_id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "output_index": 0, "content_index": 0, "delta": "드릴", "model": "gpt-4.1"} 

data: {"type": "response.output_text.delta", "sequence_number": 10, "item_id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "output_index": 0, "content_index": 0, "delta": " 수", "model": "gpt-4.1"} 

data: {"type": "response.output_text.delta", "sequence_number": 11, "item_id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "output_index": 0, "content_index": 0, "delta": " 있나요", "model": "gpt-4.1"} 

data: {"type": "response.output_text.delta", "sequence_number": 12, "item_id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "output_index": 0, "content_index": 0, "delta": "?", "model": "gpt-4.1"} 

data: {"type": "response.output_text.delta", "sequence_number": 13, "item_id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "output_index": 0, "content_index": 0, "delta": " 😊", "model": "gpt-4.1"} 

data: {"type": "response.output_text.done", "sequence_number": 14, "item_id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "output_index": 0, "content_index": 0, "text": "안녕! 오늘 어떻게 도와드릴 수 있나요? 😊", "model": "gpt-4.1"} 

data: {"type": "response.content_part.done", "sequence_number": 15, "item_id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "output_index": 0, "content_index": 0, "part": {"type": "output_text", "annotations": [], "text": "안녕! 오늘 어떻게 도와드릴 수 있나요? 😊"}, "model": "gpt-4.1"} 

data: {"type": "response.output_item.done", "sequence_number": 16, "output_index": 0, "item": {"id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "type": "message", "status": "completed", "content": [{"type": "output_text", "annotations": [], "text": "안녕! 오늘 어떻게 도와드릴 수 있나요? 😊"}], "role": "assistant"}, "model": "gpt-4.1"} 

data: {"type": "response.completed", "sequence_number": 17, "response":
{"id": "resp_68a9837bb9bc8190b403947311db6faa0721186e8fbb89d0", "object": "response", "created_at": 1755939707, "status": "completed", "background": false, "content_filters": null, "error": null, "incomplete_details": null, "instructions": null, "max_output_tokens": null, "max_tool_calls": null, "model": "gpt-4.1-data", "output": [{"id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "type": "message", "status": "completed", "content": [{"type": "output_text", "annotations": [], "text": "안녕하세요! 오늘 무엇을 도와드릴까요? 😊"}], "role": "assistant"}], "parallel_tool_calls": true, "previous_response_id": null, "prompt_cache_key": null, "reasoning": {"effort": null, "summary": null}, "safety_identifier": null, "service_tier": "default", "store": true, "temperature": 1.0, "text": {"format": {"type": "text"}}, "tool_choice": "auto", "tools": [], "top_p": 1.0, "truncation": "disabled", "usage": {"input_tokens": 8, "input_tokens_details": {"cached_tokens": 0}, "output_tokens": 11, "output_tokens_details": {"reasoning_tokens": 0}, "total_tokens": 19}, "user": null, "metadata": {}}, "model": "gpt-4.1"} 

```

응답에는 많은 `data`가 있으며, `data` 안의 `delta`가 최신 답변 내용임을 확인할 수 있고, 이는 위에서 소개한 내용과 일치합니다. `delta`는 새로 추가된 답변 내용이며, 결과에 따라 시스템에 연동할 수 있습니다. 스트리밍 응답은 `response.completed` 또는 `response.incomplete`를 최종 상태로 사용합니다. 최종 상태의 `usage`는 이번 요청의 최종 token 사용량이며, 과금 기준이기도 합니다.

클라이언트가 최종 상태가 도착하기 전에 연결을 끊으면, 이번 요청은 클라이언트 종료(499)로 기록되며, 로컬 추정 token을 사용하여 과금되지 않습니다. 연결이 정상적으로 종료되었지만 최종 상태 및 최종 `usage`를 받지 못한 경우, 이번 요청은 응답 불완전(502)으로 기록되며, 마찬가지로 추정 token을 사용하여 과금되지 않습니다. 이 두 가지 상황이 발생하면 요청을 다시 시작하세요.

반환된 `data` 결과에는 여러 필드가 있으며, 다음과 같이 소개합니다:

* `item_id`, 이번 대화 작업을 생성하는 ID로, 이번 대화 작업을 고유하게 식별하는 데 사용됩니다.
* `type`, 이번 대화 Responses 작업을 생성하는 유형입니다.
* `model `, 선택한 OpenAI ChatGPT 공식 웹사이트 모델입니다.
* `delta`, ChatGPT가 질문어에 대해 제공하는 답변 정보입니다.

JavaScript도 지원되며, 예를 들어 Node.js의 스트리밍 호출 코드는 다음과 같습니다:

```javascript theme={null}
const options = {
  method: "post",
  headers: {
    accept: "application/json",
    authorization: "Bearer b82d32f570bc434d9ba9923aa0e7dce0",
    "content-type": "application/json",
  },
  body: JSON.stringify({
    model: "gpt-4.1",
    input: [{ role: "user", content: "Hello" }],
    stream: true,
  }),
};

fetch("https://api.acedata.cloud/openai/responses", options)
  .then((response) => response.json())
  .then((response) => console.log(response))
  .catch((err) => console.error(err));
```

Java 예제 코드:

```java theme={null}
JSONObject jsonObject = new JSONObject();
jsonObject.put("model", "gpt-4.1");
jsonObject.put("input", [{"role":"user","content":"Hello"}]);
jsonObject.put("stream", true);
MediaType mediaType = "application/json; charset=utf-8".toMediaType();
RequestBody body = jsonObject.toString().toRequestBody(mediaType);
Request request = new Request.Builder()
  .url("https://api.acedata.cloud/openai/responses")
  .post(body)
  .addHeader("accept", "application/json")
  .addHeader("authorization", "Bearer b82d32f570bc434d9ba9923aa0e7dce0")
  .addHeader("content-type", "application/json")
  .build();

OkHttpClient client = new OkHttpClient();
Response response = client.newCall(request).execute();
System.out.print(response.body!!.string())
```

다른 언어는 별도로 직접 수정하여 작성할 수 있으며, 원리는 모두 동일합니다.

## 다중 턴 대화

다중 턴 대화 기능을 연동하려면 `input` 필드에 여러 질문어를 업로드해야 하며, 여러 질문어의 구체적인 예시는 아래 그림과 같습니다:

![](https://cdn.acedata.cloud/1jqwnf.png)

Python 예제 호출 코드:

```python theme={null}
import requests

url = "https://api.acedata.cloud/openai/responses"

headers = {
    "accept": "application/json",
    "authorization": "Bearer {token}",
    "content-type": "application/json"
}

payload = {
    "model": "gpt-4.1",
    "input": [{"role":"user","content":"Hello"},{"role":"assistant","content":"Hello! How can I help you today? 😊"},{"role":"user","content":"What did I just say?"}]
}

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

여러 질문어를 업로드하면 다중 턴 대화를 쉽게 구현할 수 있으며, 다음과 같은 답변을 얻을 수 있습니다:

```json theme={null}
{
  "id": "resp_68a989c03c508191a1dd82ce2e37e88a0932a4328c0a5d5b",
  "object": "response",
  "created_at": 1755941312,
  "status": "completed",
  "background": false,
  "content_filters": null,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "max_tool_calls": null,
  "model": "gpt-4.1",
  "output": [
    {
      "id": "msg_68a989c092e4819189821a9eb8247e1e0932a4328c0a5d5b",
      "type": "message",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "annotations": [],
          "text": "You just said \"Hello.\" \n\nWould you like to continue the conversation or ask a question?"
        }
      ],
      "role": "assistant"
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "prompt_cache_key": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "safety_identifier": null,
  "service_tier": "default",
  "store": true,
  "temperature": 1,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "top_p": 1,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 32,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 20,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 52
  },
  "user": null,
  "metadata": {}
}
```

`output`에 포함된 정보는 기본 사용의 내용과 일치함을 확인할 수 있습니다. 여기에는 ChatGPT가 여러 대화에 대해 답변한 구체적인 내용이 포함되어 있으며, 이렇게 여러 대화 내용을 기반으로 해당 질문에 답변할 수 있습니다.

## 비전 모델

gpt-4o는 OpenAI가 개발한 멀티모달 대규모 언어 모델이며, GPT-4를 기반으로 시각 이해 능력을 추가했습니다. 이 모델은 텍스트와 이미지 입력을 동시에 처리하여, 크로스모달 이해와 생성을 구현합니다.
gpt-4o 모델을 사용한 텍스트 처리는 위의 기본 사용 내용과 일치하며, 아래에서는 모델의 이미지 처리 능력을 사용하는 방법을 간략히 소개합니다.

gpt-4o 모델의 이미지 처리 능력은 주로 기존 `content` 내용에 `type` 필드를 추가하여 사용합니다. 이 필드를 통해 업로드된 것이 텍스트인지 이미지인지 알 수 있으므로 gpt-4o 모델의 이미지 처리 능력을 사용할 수 있습니다. 아래에서는 주로 Curl과 Python 두 가지 방식으로 해당 기능을 호출하는 방법을 설명합니다.

* Curl 스크립트 방식

```
curl -X POST 'https://api.acedata.cloud/openai/responses' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
    "model": "gpt-4.1",
    "input": [
      {
        "role": "user",
        "content": [
          {"type": "input_text", "text": "what is in this image?"},
          {
            "type": "input_image",
            "image_url": "https://cdn.acedata.cloud/e724d7f13d.png"
          }
        ]
      }
    ]
  }'
```

* Python 스크립트 방식

```python theme={null}
import requests

url = "https://api.acedata.cloud/openai/chat/completions"

headers = {
    "accept": "application/json",
    "authorization": "Bearer {token}",
    "content-type": "application/json"
}

payload = {
    "model": "gpt-4.1",
    "input": [
      {
        "role": "user",
        "content": [
          {"type": "input_text", "text": "what is in this image?"},
          {
            "type": "input_image",
            "image_url": "https://cdn.acedata.cloud/e724d7f13d.png"
          }
        ]
      }
    ]
  }

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

그러면 아래와 같은 결과를 얻을 수 있으며, 결과 내부의 필드 정보는 위와 일치합니다. 구체적인 내용은 다음과 같습니다.

```json theme={null}
{
  "id": "resp_68a98c1bb784819e9b9f622007a2d37602483949012d2193",
  "object": "response",
  "created_at": 1755941915,
  "status": "completed",
  "background": false,
  "content_filters": null,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "max_tool_calls": null,
  "model": "gpt-4.1",
  "output": [
    {
      "id": "msg_68a98c1dd030819e97fb71e6ee33f5a902483949012d2193",
      "type": "message",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "annotations": [],
          "text": "This image shows a scenic path, possibly a boardwalk, running through a lush green field or meadow. The sky above is bright blue with some white clouds, and there are green trees and bushes in the background. It looks like a peaceful nature scene, possibly in a park, wetland, or prairie area. The image conveys a sense of tranquility and natural beauty."
        }
      ],
      "role": "assistant"
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "prompt_cache_key": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "safety_identifier": null,
  "service_tier": "default",
  "store": true,
  "temperature": 1,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "top_p": 1,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 1118,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 75,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 1193
  },
  "user": null,
  "metadata": {}
}
```

답변 내용이 이미지를 기반으로 답변된 것임을 알 수 있으므로, 위의 두 가지 방식을 통해 gpt-4.1 모델의 텍스트 및 이미지 처리 능력을 쉽게 사용할 수 있습니다.

gpt-4.1 외에도 gpt-4o-mini라는 더 저비용의 모델이 있습니다. gpt-4o-mini는 OpenAI가 개발한 최신 세대의 대규모 언어 모델로, 응답 속도가 빠를 뿐만 아니라 가격도 더 저렴하며 멀티모달도 지원합니다. vision 기능의 사용은 위의 gpt-4.1 모델 사용 내용을 참고할 수 있습니다.

## 파일 처리 모델 생성

요청 예시:

```json theme={null}
{
  "model": "gpt-4.1",
  "input": [
    {
      "role": "user",
      "content": [
        { "type": "input_text", "text": "what is in this file?" },
        {
          "type": "input_file",
          "file_url": "https://cdn.acedata.cloud/assets/examples/fish/64adc04b-c196-4a0f-9070-222ba101ce6c-fc50de38c165.wav"
        }
      ]
    }
  ]
}
```

예시 결과:

```json theme={null}
{
  "id": "resp_68a98d7bb57c819ba25424f5f50a29a300a1af2af822e88a",
  "object": "response",
  "created_at": 1755942267,
  "status": "completed",
  "background": false,
  "content_filters": null,
  "error": null,
  "incomplete_details": null,
  "instructions": null,
  "max_output_tokens": null,
  "max_tool_calls": null,
  "model": "gpt-4.1",
  "output": [
    {
      "id": "msg_68a98d7d9b80819b9b0f09b7bcd00bf900a1af2af822e88a",
      "type": "message",
      "status": "completed",
      "content": [
        {
          "type": "output_text",
          "annotations": [],
          "text": "게시한 파일에는 이사회 의장인 워런 E. 버핏이 작성한 **버크셔 해서웨이 주식회사의 2024년 연례 주주 서한**이 포함되어 있습니다. 이 문서는 일반적으로 버크셔의 연례 주주 보고서에 포함되는 종합적인 커뮤니케이션입니다.\n\n### 파일에 포함된 내용:\n\n#### 1. **회장의 주주 서한**\n   - **소개 및 철학:** 워런 버핏은 연례 보고서의 목적, 버크셔 해서웨이의 커뮤니케이션 방식, 그리고 성공과 실패 모두에 대한 투명성과 솔직한 논의에 관한 자신의 철학을 이야기합니다.\n   - **실수에 대한 논의:** 그는 자본 배분과 인사 결정에서 있었던 실수에 대해 솔직하게 이야기하며, 오류를 인정하고 이를 바로잡기 위해 신속히 행동하는 것의 중요성을 강조합니다.\n   - **승계에 대한 언급:** 버핏은 자신의 언젠가 있을 은퇴를 언급하며, 그레그 에이블이 CEO이자 이 서한들의 작성자로 자신을 승계할 것이라고 말합니다.\n   - **일화적 이야기:** 버크셔가 인수한 RV 제조업체인 포리스트 리버의 창립자 피트 리글의 이야기는 경영 철학과 사업 의사결정을 설명하기 위해 소개됩니다.\n\n#### 2. **2024년 사업 및 재무 성과**\n   - **주요 결과:** 보험, BNSF 철도, 에너지 등의 사업 부문별 영업이익 내역을 포함하여 2024년 버크셔의 재무 성과를 2023년과 비교한 요약입니다.\n   - **보험 사업:** GEICO와 손해보험 부문은 뛰어난 한 해를 보냈으며, 업계와 버크셔가 보험 위험, 가격 책정 및 보험 \"플로트\" 투자에 접근하는 방식에 대한 논평이 포함됩니다.\n   - **투자:** 대기업(예: 애플, 아메리칸 익스프레스, 코카콜라)의 전체 사업체와 부분 지분(시장성 증권)을 모두 소유하는 버크셔의 전략 및 현금 배치에 대한 논의입니다.\n   - **세금:** 2024년에 국세청에 268억 달러를 납부하여 법인세 납부 기록을 경신한 버크셔에 대한 언급입니다.\n\n#### 3. **장기 철학 및 자본주의 논평**\n   - **주식에 관하여:** 버핏은 버크셔가 현금이나 채권보다 사업체 소유권(주식)을 우선시하는 이유와 회사가 장기 투자를 선호하는 이유를 설명합니다.\n   - **자본주의에 관하여:** 미국의 성장, 국가의 성공에서 자본주의, 저축 및 자본 배분의 역할에 대한 성찰과 안정적인 통화 유지의 중요성에 대한 언급이 있습니다.\n\n#### 4. **일본 투자**\n   - **일본 보유 지분 업데이트:** 일본의 5개 종합상사에 대한 버크셔의 증가하는 투자와 이들 기업의 경영 및 지배구조에 대한 긍정적인 견해입니다.\n\n#### 5. **버크셔 해서웨이 연례 회의**\n   - **연례 모임 정보:** 오마하에서 열리는 연례 회의에 관한 세부 사항으로, 사교 행사, 도서 판매 및 회의와 관련된 자선 활동을 포함합니다.\n   - **개인적인 이야기:** 편지에 인간적인 정취를 더하기 위해 버핏의 가족(여동생 버티 포함)과 관련된 개인적인 일화가 포함됩니다.\n\n#### 6. **성과 표**\n   - **버크셔 대 S&P 500 (1965-2024):** 버크셔의 주가 연간 변동률과 S&P 500의 총수익률, 장기 복리 수익 및 전체 수익을 보여주는 두 개의 상세 표입니다.\n\n---\n\n### 요약하면\n\n이 파일은 주로 워런 버핏이 작성한 **2024년 버크셔 해서웨이 연례 주주 서한**입니다. 사업 성과, 경영 철학, 투자 전략, 수익과 세금, 보험 운영, 주요 보유 지분, 자본 배분, 승계 업데이트 등을 다룹니다. 표는 거의 60년에 걸쳐 버크셔 해서웨이가 S&P 500을 놀랍도록 능가한 성과를 보여주며, 이는 이 서한에서 핵심적인 자부심의 지점입니다.\n\n특정 섹션의 세부 사항을 원하시면 알려주세요!"
        }
      ],
      "role": "assistant"
    }
  ],
  "parallel_tool_calls": true,
  "previous_response_id": null,
  "prompt_cache_key": null,
  "reasoning": {
    "effort": null,
    "summary": null
  },
  "safety_identifier": null,
  "service_tier": "default",
  "store": true,
  "temperature": 1,
  "text": {
    "format": {
      "type": "text"
    }
  },
  "tool_choice": "auto",
  "tools": [],
  "top_p": 1,
  "truncation": "disabled",
  "usage": {
    "input_tokens": 8438,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 731,
    "output_tokens_details": {
      "reasoning_tokens": 0
    },
    "total_tokens": 9169
  },
  "user": null,
  "metadata": {}
}
```

입력 파일도 처리되었으며, 결과는 위와 유사한 것을 확인할 수 있습니다.

## 오류 처리

API를 호출할 때 오류가 발생하면 API는 해당 오류 코드와 정보를 반환합니다. 예를 들면 다음과 같습니다:

* `400 token_mismatched`：잘못된 요청이며, 매개변수가 누락되었거나 유효하지 않기 때문일 수 있습니다.
* `400 api_not_implemented`：잘못된 요청이며, 매개변수가 누락되었거나 유효하지 않기 때문일 수 있습니다.
* `401 invalid_token`：인증되지 않음, 인증 토큰이 유효하지 않거나 누락되었습니다.
* `429 too_many_requests`：요청이 너무 많습니다. 요청 한도를 초과했습니다.
* `500 api_error`：내부 서버 오류, 서버에서 문제가 발생했습니다.

### 오류 응답 예시

```
{
  "success": false,
  "error": {
    "code": "api_error",
    "message": "fetch failed"
  },
  "trace_id": "2cf86e86-22a4-46e1-ac2f-032c0f2a4e89"
}
```

## 결론

이 문서를 통해 공식 OpenAI의 Responses 생성 기능을 쉽게 구현하기 위해 OpenAI Responses API를 사용하는 방법을 이해하셨습니다. 이 문서가 해당 API를 더 효과적으로 연동하고 사용하는 데 도움이 되기를 바랍니다. 궁금한 점이 있으시면 언제든지 기술 지원팀에 문의해 주세요.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.