C.W.K.
Stream
Lesson 04 of 08 · published

The Responses API

~22 min · responses-api, stateful, input

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

The Responses API (POST /v1/responses) is OpenAI's recommended API for all new projects, superseding Chat Completions. It's a superset that adds stateful sessions, built-in tools, semantic streaming events, and better reasoning model support.

Chat Completions vs Responses API

CapabilityChat CompletionsResponses API
Text generation
Vision
Structured Outputs
Function calling
Web search
File search
Code interpreter
Image generation
MCP (Model Context Protocol)
Stateful multi-turnManualprevious_response_id
Semantic SSE eventsNoYes

The Responses API shows a 3% improvement on SWE-benchmark vs Chat Completions with the same prompt, and 40–80% improvement in cache utilization.

Basic Usage

Responses also unifies the input shape: a plain string for one-shot calls, a typed message list (input_text, input_image, input_file) for multi-modal or multi-turn. The same endpoint handles every modality. You don't pick a different URL for vision vs text; the input list says so.

For new product code, the question is no longer 'should I use Responses?' — it is 'is there a reason I cannot use Responses?' The two common answers are: (1) you have an existing chat.completions.create call that already works, or (2) you depend on a tool/SDK feature that hasn't crossed over yet. Both shrink as time passes.

Code

Minimal responses.create() call·python
from openai import OpenAI

client = OpenAI()

response = client.responses.create(
    model="gpt-5.4",
    input="Explain quantum entanglement in simple terms."
)
print(response.output_text)  # convenience property

External links

Exercise

Have a 4-turn conversation using only previous_response_id (no resending the message array). Print response.id and response.previous_response_id at each turn so you can see the chain.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.