본문 바로가기
C.W.K.
Stream
Lesson 02 of 07 · published

responses.create vs chat.completions.create

~22 min · responses-api, shape-diff

Level 0Tokenizer
0 XP0/54 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

같은 작업을 두 API 로 실행하면 차이가 바로 보여. Responses 는 response.output_text 로 assistant 의 최종 문자열을 직접 꺼낼 수 있어. completion.choices[0].message.content 를 따라 들어갈 필요가 없어.

먼저 눈에 들어오는 차이 세 가지

  1. response.output_text — 최종 문자열을 바로 꺼내.
  2. previous_response_id — 전체 메시지 배열을 다시 보내지 않고 대화를 이어.
  3. 최상위 instructions= — system 성격의 지시를 따로 둬.

도구 정의 구조는 주의해서 옮겨

실수하기 쉬운 부분은 tool definition 이야. Responses 의 최상위 name/parameters 와 Chat Completions 의 중첩된 function 구조가 달라. Custom Function Tools lesson 에서 정확히 비교해볼 거야.

응답 JSON 을 직접 비교해봐

같은 model 과 prompt 를 두 API 에 보내고 응답 JSON 을 나란히 출력해. output_text, output, previous_response_id 처럼 한쪽에만 있는 필드를 다섯 개 찾아보면 차이를 빠르게 익힐 수 있어.

Code

같은 작업, 두 API·python
# Chat Completions
completion = client.chat.completions.create(
    model="gpt-5.4",
    messages=[
        {"role": "developer", "content": "Be concise."},
        {"role": "user", "content": "What is 2+2?"},
    ],
)
print(completion.choices[0].message.content)

# Responses API — simpler
response = client.responses.create(
    model="gpt-5.4",
    instructions="Be concise.",
    input="What is 2+2?",
)
print(response.output_text)  # convenience property

External links

Exercise

같은 모델과 프롬프트를 두 API 에서 실행하고 JSON 응답을 나란히 출력해. 한쪽에만 있는 필드 다섯 개를 찾아.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.