Responses API

An API that represents a model response as output items such as messages and tool calls.

···
html
<div class="scene"><div class="heading">RESPONSE ITEMS</div><div class="stream"><div id="item-call">output: tool_call</div><div id="item-result">input: tool_result</div><div id="item-message">output: message</div></div><div class="muted" id="response-note">모델이 도구 호출 항목을 냅니다</div></div>
css
.scene{width:min(94vw,800px);height:min(88vh,326px);padding:clamp(10px,2.7vmin,19px);border:1px solid var(--line);border-radius:13px;background:var(--surface);font:500 clamp(13px,2.4vmin,17px)/1.3 var(--font-sans,sans-serif);position:relative;overflow:hidden}.scene .mono{font-family:ui-monospace,SFMono-Regular,monospace}.scene .muted{color:var(--muted)}.scene .accent{color:var(--accent)}.scene .heading{font-weight:750;color:var(--accent);margin-bottom:clamp(5px,1.6vmin,12px)}.stream{height:68%;display:flex;flex-direction:column;justify-content:space-around;gap:5px}.stream div{border-left:4px solid var(--line);padding:clamp(7px,2vmin,13px);background:var(--bg);font-family:ui-monospace,monospace;opacity:.72;transition:.3s}.stream div.on{border-color:var(--accent);opacity:1;background:color-mix(in srgb,var(--accent) 14%,var(--surface))}
js
const ids=['item-call','item-result','item-message'],notes=['모델이 도구 호출 항목을 냅니다','앱이 실행 결과를 다음 입력으로 보냅니다','모델이 최종 메시지를 냅니다'];let i=0;function draw(){ids.forEach((id,n)=>document.getElementById(id).classList.toggle('on',n===i));document.getElementById('response-note').textContent=notes[i];i=(i+1)%3}draw();setInterval(draw,850)

The Responses API accepts input and returns a response object whose output can contain messages, tool calls, and other items. An application can inspect each item and send a tool result back as input.

The demo shows a tool call, an application-provided result, and a final message. Code should not assume the first output item is always plain text.

When to use

Use it when the application owns model calls and tool dispatch.

Open as page ↗