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 로 해 보면 차이가 즉시 보여. response.output_text — Responses 에 존재, assistant 의 final string 을 직접 줘. completion.choices[0].message.content 안 걸어도 돼. 그 한 줄 이득만으로도 swap 가치 있음.

3 가지 즉시 눈에 띄는 차이

  1. response.output_text — final string 바로.
  2. previous_response_id — 메시지 배열 resending 대체.
  3. instructions= top-level — system-role 메시지 대체.

Migration cost 는 tool shape 에서 와

위 셋은 작아. 진짜 cost 는 tool definition shape — Custom Function Tools lesson 에서 볼 top-level name/parameters vs nested function 차이. 마이그레이션 trip-up 1 위.

실제 비교 exercise

같은 호출 (model + prompt) 을 두 API 로 보내고 응답 JSON 을 side-by-side 출력해. 한쪽에만 있는 필드 5 개 찾기 — output_text, output, previous_response_id, instructions, ... 직접 보면 머릿속에 박혀.

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 응답 side-by-side print. 한쪽에만 있는 필드 5 개 식별.

Progress

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

댓글 0

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

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