OpenAI Responses API 신청 및 사용

플랫폼에서 수락하는 호환 모델 요청은 모델의 입력, 출력 및 캐시 사용량에 따라 과금됩니다. Responses의 총 입력량에는 보고된 캐시 토큰이 포함되며, 캐시 부분은 해당 캐시 가격에 따라 정산됩니다. 인터페이스 형식을 변경해도 고정 횟수 과금으로 바뀌지 않습니다. 비용은 콘솔의 현재 모델 가격과 응답의 usage.cost를 기준으로 합니다.

Responses API는 OpenAI 호환 요청 및 응답 형식을 사용합니다. 사용 가능한 입력 유형, 도구 및 대화 기능은 선택한 모델에 따라 달라집니다.

Gemini 3.8 Flash 및 Gemini 4

model은 gemini-3.8-flash, gemini-4-argon, gemini-4-carbon, gemini-4-hydrogen, gemini-4-neon 중에서 선택할 수 있습니다.

POST https://api.yxai-tech.top/v1/responses로 다음 JSON을 전송합니다. 이 모델들은 텍스트 또는 이미지 입력을 받아 텍스트를 생성합니다. 일반 응답의 본문은 output의 메시지 항목에 있는 output_text 콘텐츠 블록에 위치합니다. "stream": true로 설정하면 response.output_text.delta 이벤트를 통해 증분 텍스트를 받을 수 있습니다.

{"model": "gemini-4-neon", "input": "只回复 OK", "store": false}

여러 턴의 대화는 클라이언트가 기록을 저장하고 다음 요청의 input 배열에 다시 전달합니다. function 도구를 사용할 때는 클라이언트가 함수를 실행하고, 이전 턴의 입력과 전체 출력 항목을 유지한 다음, 동일한 call_id가 포함된 function_call_output을 추가합니다. 요청에서 previous_response_id를 생략하고, store를 생략하거나 false로 설정합니다.

GPT-6.2 Astra 및 GPT-6.2 Sol

model: "gpt-6.2-astra" 또는 model: "gpt-6.2-sol"을 사용하여 모델을 선택합니다. 텍스트, 이미지 입력 및 텍스트 출력을 지원합니다. reasoning: {"effort": "low"}부터 시작하는 것을 권장합니다. low, medium, high, xhigh, max를 지원하며, none 또는 minimal은 지원하지 않습니다. 도구 호출과 구조화된 출력에는 해당 인터페이스의 공개 매개변수 형식을 사용하세요.

공식 컨텍스트 윈도는 1,050,000 토큰이며, 최대 입력은 922,000, 최대 출력은 128,000입니다. 실제 요청은 이 인터페이스의 매개변수 및 계정 제한도 충족해야 합니다. 입력이 272,000 토큰을 초과하면 전체 요청에 긴 컨텍스트 요율이 적용됩니다. 입력 및 캐시 요율은 기본 요금의 2배, 출력은 1.5배입니다. 가격과 비용은 콘솔의 현재 모델 가격, 선택한 요금제 및 실제 사용량을 기준으로 합니다.

GPT-6.1 Terra

model: "gpt-6.1-terra"를 사용하여 이 모델을 선택합니다. 텍스트, 이미지 입력, 스트리밍 출력, 함수 도구 및 구조화된 출력을 지원합니다. 추론 수준은 low, medium, high, xhigh 및 max를 지원하며, reasoning: {"effort": "low"}부터 시작하는 것을 권장합니다. none 또는 minimal은 지원하지 않습니다. 입력이 272,000 토큰을 초과하면 긴 컨텍스트 가격이 적용되며, 실제 비용은 콘솔의 현재 가격과 응답의 사용량을 기준으로 합니다.

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 토큰을 초과하면 전체 요청에 긴 컨텍스트 가격이 적용되며, 비용은 콘솔의 현재 가격을 기준으로 합니다.

신청 절차

OpenAI Responses API를 사용하려면 먼저 AI 聚合 콘솔에서 API 토큰을 발급받아 준비해 두세요.

아직 로그인하거나 가입하지 않았다면 자동으로 로그인 페이지로 이동하여 가입 및 로그인을 안내하며, 완료되면 자동으로 현재 페이지로 돌아옵니다.

범용 애플리케이션의 API 키는 계정에 공개된 서비스에 사용할 수 있으며, 전용 애플리케이션의 키는 해당 애플리케이션의 서비스 범위에 따라 사용합니다. 키의 권한, 유효 기간 및 한도를 확인하고, 애플리케이션 잔액이 이번 요청 비용을 지불하기에 충분한지 확인하세요. 사용 가능한 체험 한도는 계정에 표시된 내용을 기준으로 하며, 잔액이 부족하면 「충전」 버튼을 클릭하면 됩니다.

📘 전체 문서: OpenAI Responses API →

기본 사용법

이제 그림과 같이 인터페이스에 해당 내용을 입력할 수 있습니다.

디버깅 화면에서 authorization에 사용할 API 토큰을 선택하고, model 목록에서 모델을 선택한 다음, input에 텍스트 또는 메시지 배열을 입력합니다. 메시지의 role은 역할을, content는 내용을 나타냅니다.

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

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

  • max_tokens: 한 번의 응답에 사용할 최대 토큰 수를 제한합니다.
  • temperature: 생성의 무작위성을 나타내며, 0~2 사이의 값으로 값이 클수록 결과가 다양해집니다.
  • n: 한 번에 생성할 후보 응답의 수입니다.
  • response_format: 반환 형식 설정입니다.
  • tools: 함수/도구 호출 정의입니다.
  • background: 백그라운드에서 비동기적으로 실행할지 여부입니다.

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

{
  "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임을 그림과 같이 확인할 수 있습니다.

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

스트리밍 응답

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

응답을 스트리밍으로 반환하려면 요청 헤더 안의 stream 매개변수를 true로 변경하면 됩니다.

그림과 같이 변경하되, 호출 코드도 스트리밍 응답을 지원할 수 있도록 그에 맞게 변경해야 합니다.

stream을 true로 변경하면 API는 해당 JSON 데이터를 한 줄씩 반환하며, 코드 수준에서 줄별 결과를 얻으려면 그에 맞게 수정해야 합니다.

Python 호출 예제 코드:

import requests

url = "https://api.yxai-tech.top/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)

출력 결과는 다음과 같습니다.

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": "Hello", "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": " How", "model": "gpt-4.1"} 

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

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

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

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

data: {"type": "response.output_text.delta", "sequence_number": 11, "item_id": "msg_68a9837c49f081908f568bf9c6065c620721186e8fbb89d0", "output_index": 0, "content_index": 0, "delta": " today", "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": "Hello! How can I help you today? 😊", "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": "Hello! How can I help you today? 😊"}, "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": "Hello! How can I help you today? 😊"}], "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": "Hello! How can I help 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.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는 이번 요청의 최종 토큰 사용량이며, 과금 기준이기도 합니다.

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

반환되는 data 결과에는 여러 필드가 있으며, 설명은 다음과 같습니다.

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

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

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

fetch("https://api.yxai-tech.top/openai/responses", options)
  .then((response) => response.json())
  .then((response) => console.log(response))
  .catch((err) => console.error(err));

Java 예제 코드:

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.yxai-tech.top/openai/responses")
  .post(body)
  .addHeader("accept", "application/json")
  .addHeader("authorization", "Bearer YOUR_API_TOKEN")
  .addHeader("content-type", "application/json")
  .build();

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

다른 언어로는 직접 별도로 수정할 수 있으며, 원리는 모두 같습니다.

다중 턴 대화

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

Python 호출 코드 예시:

import requests

url = "https://api.yxai-tech.top/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)

여러 프롬프트를 업로드하면 다중 턴 대화를 쉽게 구현할 수 있으며, 다음과 같은 응답을 얻을 수 있습니다.

{
  "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.yxai-tech.top/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 스크립트 방식
import requests

url = "https://api.yxai-tech.top/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)

그다음 아래와 같은 결과를 얻을 수 있으며, 결과에 포함된 필드 정보는 위의 내용과 동일하고, 구체적인 내용은 다음과 같습니다.

{
  "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 모델 사용 내용을 참고할 수 있습니다.

파일 처리 모델 생성

요청 예시:

{
  "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"
        }
      ]
    }
  ]
}

결과 예시:

{
  "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": "The file you posted contains the **2024 annual letter to shareholders from Berkshire Hathaway Inc.**, written by Warren E. Buffett, Chairman of the Board. This document is a comprehensive communication that is typically included in Berkshire's annual report to shareholders.\n\n### What's Inside the File:\n\n#### 1. **Chairman's Letter to Shareholders**\n   - **Introduction & Philosophy:** Warren Buffett discusses the purpose of the annual report, Berkshire Hathaway’s communication style, and his philosophy for transparency and candid discussion of both successes and failures.\n   - **Discussion of Mistakes:** He talks openly about the mistakes made in capital allocation and personnel decisions, emphasizing the importance of admitting errors and acting promptly to correct them.\n   - **Succession Comments:** Buffett references his eventual retirement, and that Greg Abel will succeed him as CEO and writer of these letters.\n   - **Anecdotal Story:** The story of Pete Liegl, founder of Forest River (an RV manufacturer acquired by Berkshire), is told to illustrate management philosophy and business decision-making.\n\n#### 2. **2024 Business and Financial Performance**\n   - **Key Results:** Summary of how Berkshire performed financially in 2024 vs. 2023, including operating earnings breakdown by business segments such as insurance, BNSF railroad, and energy.\n   - **Insurance Business:** GEICO and the property-casualty insurance division had a standout year, with commentary on the industry and how Berkshire approaches insurance risk, pricing, and investment of insurance \"float.\"\n   - **Investments:** Discussion on Berkshire’s strategy of owning both full businesses and partial stakes (marketable securities) in large companies (e.g., Apple, American Express, Coca-Cola), and its deployment of cash.\n   - **Taxes:** Reference to Berkshire breaking records in corporate tax payments ($26.8 billion to the IRS in 2024).\n\n#### 3. **Long-term Philosophy & Capitalism Commentary**\n   - **On Equities:** Buffett explains why Berkshire prioritizes ownership of businesses (equities) over cash or bonds, and why the company favors long-term investments.\n   - **On Capitalism:** There’s a reflection on America’s growth, the role of capitalism, savings, and capital allocation in the nation’s success, and a nod to the importance of maintaining a stable currency.\n\n#### 4. **Japanese Investments**\n   - **Update on Japanese Holdings:** Berkshire’s growing investments in five Japanese trading companies, and the positive view of their management and governance.\n\n#### 5. **Berkshire Hathaway Annual Meeting**\n   - **Annual Gathering Info:** Details about the annual meeting in Omaha, including social events, book sales, and charitable initiatives related to the meeting.\n   - **Personal Stories:** Personal anecdotes involving Buffett’s family, (including his sister Bertie), to add a human touch to the letter.\n\n#### 6. **Performance Tables**\n   - **Berkshire vs S&P 500 (1965-2024):** Two detailed tables showing annual percentage change in Berkshire’s share price vs. total return for the S&P 500, as well as long-term compounded and overall gains.\n\n---\n\n### In Summary\n\nThis file is the **2024 Berkshire Hathaway annual letter to shareholders**, primarily written by Warren Buffett. It covers business performance, management philosophy, investment strategy, earnings and taxes, insurance operations, significant holdings, capital allocation, succession updates, and more. Tables show a remarkable outperformance of Berkshire Hathaway vs. the S&P 500 over nearly six decades – a central point of pride in the letter.\n\nIf you want specifics from any particular section, let me know!"
        }
      ],
      "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 API를 사용하여 공식 OpenAI의 Responses 생성 기능을 쉽게 구현하는 방법을 알아보았습니다. 이 문서가 해당 API를 더 잘 연동하고 사용하는 데 도움이 되기를 바랍니다. 질문이 있으시면 언제든지 기술 지원팀에 문의해 주세요.