// What's Next · Done · The Associate Track
Working with the OpenAI Responses API
Completed Nov 07, 2026 · 3 hrs
Covers the OpenAI Responses API from first request through production patterns: parameters and reasoning, conversation chaining, response items, web search, function-calling tools, structured outputs, streaming semantic events, and multimodal inputs.
First Requests and Parameters
- client.responses.create(): Creates a request, passing model, instructions, and input.
- instructions: Clear requirements on how the model should behave, considered superior to input.
- input: The task or question at hand.
- reasoning: A dictionary with an effort key that tunes how much deep thinking the model does.
- max_output_tokens: An integer specifying the token count, which also limits reasoning tokens.
Conversation Chaining
- previous_response_id: Provides a prior response ID so the model loads context from that conversation.
- conversation history: Stores and retrieves previous prompts and responses so the model has access to them.
- control flow: A mechanism that keeps the prompt following the response continually.
- latest_response_id: Variable updated after each iteration to extract the latest response ID.
Response Items and Web Search
- response.output: Extracts the output in structured form, where each object is an item.
- ResponseReasoningItem: Returned for reasoning-enabled models, with a summary attribute if requested.
- ResponseOutputMessage: Contains the final output of the model under the content attribute.
- web_search tool: Enables the model to retrieve up-to-date information, overcoming knowledge cutoffs.
- include: Parameter passing web_search_call.action.sources to add sources.
Function-Calling Tools
- function-calling tools: Convert Python functions into tools the LLM can use.
- tool definitions: A manual for the LLM so it can choose which tool to use and call it correctly.
- function_call item: Returned when the model decides a message requires the tool, with arguments as a JSON string.
- function_call_output: Message type appended to messages with the tool's result.
Structured Outputs
- pydantic BaseModel: Defines the output schema, the template the LLM populates.
- text_format: Argument passing the pydantic class to enforce output structure.
- output_parsed: Attribute extracting the parsed output with attributes for each defined field.
Streaming and Multimodality
- semantic events: Structured updates describing what is happening during generation.
- stream=True: Enables streaming so partial updates are delivered as the model types.
- role-based messages: Dictionaries with role and content keys passed to input.
- input_image: Content type for sending images from URLs or local base64 files.
// Module notes
First Requests and Parameters
The Responses API is the latest stop on a road from the Completions API (2020) through Chat Completions and Assistants to one simplified interface for chat and tool-based work. A request goes through client.responses.create(), passing model, instructions, and input.
- instructions: clear requirements on behavior, considered superior to input.
- input: the task or question at hand.
- reasoning: a dictionary with an effort key (none, low, medium, high, xhigh).
- max_output_tokens: an integer token count that also caps reasoning tokens.
Because instructions outrank input, behavior belongs there and the task in input.
Conversation Chaining and Response Items
Back-and-forth conversation needs control flow plus conversation history, and the API supplies the second part out of the box: previous_response_id loads context from that conversation, so any thread can be picked up at any point.
- response.output: structured output where each object is an item.
- ResponseReasoningItem: reasoning for reasoning-enabled models, with .summary.
- ResponseOutputMessage: final output under .content, with .status for cut-offs.
- items as building blocks: loop over items, check item.type, and extract attributes for custom logic.
The payoff is a predictable loop: inspect item.type, then pull the attribute you need.
Web Search and Function-Calling Tools
Models carry a knowledge cut-off, so web search is built in; enabling it takes a single tools parameter, and sources ride along with include. Function-calling tools turn any Python function into a tool the LLM can reach for.
- tool definitions: a manual with type, name, description, and parameters.
- two-request workflow: first to trigger the call, then to send results back.
- json.loads / json.dumps: convert arguments and results between JSON strings and dictionaries.
- function_call and function_call_output: item types for the call and its result.
The watch point is the handoff: the model proposes arguments as JSON, your code executes, then the result goes back before the answer.
Structured Outputs
Structured outputs enforce strict JSON for production systems, and the schema is a pydantic BaseModel template the LLM populates, with Field descriptions so the model knows what to generate.
- client.responses.parse(): sends the request with text_format set to the pydantic class.
- output_parsed: extracts the parsed object with attributes per field.
- nested classes: a Mistake class can be listed inside DetailedQuizResult for detailed results.
This is the fix for the weakest link in an LLM app: formatting a UI depends on.
Streaming, Inputs, and Multimodality
Streaming delivers partial updates through semantic events instead of raw chunks, which is what makes real-time interfaces feel alive. Inputs can be plain strings or role-based messages, and images arrive from URLs or local files.
- stream=True: opens a streaming connection via a with statement.
- events: response.output_text.delta, response.created, response.completed, function_call_arguments.delta.
- role-based messages: dictionaries with role and content keys; system, user, and assistant roles.
- input_image: image_url from a URL or a base64-encoded local file.
Because events are typed, your app can react to each stage rather than guess.
In plain terms
The Responses API is a concierge for OpenAI models: hand it a request and it can answer, look up fresh information, call your own code, and return the result in a strict format you define. Web search, function-calling tools, structured JSON, streaming, and images all go through the same desk. One interface, and the model does the running around.
Worth sitting with
- If max_output_tokens caps reasoning tokens too, what happens to the answer when the model spends its budget thinking?
- Since instructions outrank input, what shifts when you move to role-based messages and a system role instead?
- What should an app do when a streamed function_call_arguments.delta never arrives at .done?
// Where this fits
The concepts above are the ones this module turns on, and the notes below explain each in turn. The course page carries the whole track, and the certificate page carries the plan it belongs to.