Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

AI & ML · Function

responses

The Responses API makes direct model requests for text, structured outputs, tools, and multimodal workflows. Submit a model and input, then read generated output from the returned response.

How it works

The Responses API accepts a model identifier and input, then returns a response containing generated output items. The official SDK exposes the resulting text through output_text, while the API also supports multimodal inputs, tools, structured outputs, and stateful interactions.

Syntax

client.responses.create({ model, input })

Parameters

NameTypeDescription
modelstringThe model identifier used to generate the response.
inputstring or arrayText or other supported input supplied to the model.

Returns

A response object containing generated output items; SDK clients expose convenient text through output_text.

Key points

  • Use Responses as the main entry point for direct model calls that combine generation with structured data, tools, or multimodal inputs.
  • Treat output as a collection of generated items rather than assuming every result is one plain string.
  • Structured Outputs are suitable when downstream code needs model results constrained by a JSON schema.

Common mistakes

  • Inspect output when you need the structured output items; output_text is a convenience for text-only handling.
  • Do not begin new text-generation integrations with the older Chat Completions API when Responses is appropriate.
  • Prefer Responses for reasoning models to obtain the documented performance and intelligence benefits.

Example: Create a text response

import OpenAI from "openai";

const client = new OpenAI();
const response = await client.responses.create({
  model: "gpt-5",
  input: "Summarize this sentence in five words: Responses API is direct.",
});

console.log(response.output_text);

Creates a model response from text input and prints the SDK's combined text output.

When to use it

Text generation

Generate text or code from a prompt.

Multimodal analysis

Extract or classify information from images or documents.

Structured output

Return data that downstream code can validate against a schema.

Tool-enabled workflows

Connect model requests to external capabilities.

Interview questions

QHow do you create a basic text response?

Call responses.create with a model and input. The returned object contains generated output, and the SDK provides output_text for convenient text access.

Follow-up: How would you handle structured results? Use the Responses API's structured-output capability and consume the response according to the declared schema.

QWhy choose the Responses API instead of Chat Completions?

Responses is intended for direct model requests and supports text, image, audio, tools, and stateful interactions. The API returns output items rather than only a single text field.

Follow-up: What changes for tool use? Attach the relevant tool and explicitly process the returned tool-call output before continuing the interaction.

QWhat are the supported ways to call Responses?

Use the official SDK or call the HTTP endpoint directly. SDK usage requires a client, a model, and input; HTTP requests target the Responses endpoint with bearer authentication.

Follow-up: What should be reviewed before deployment? Check authentication, errors, rate limits, and request-ID logging in the API reference.

  • Structured Outputs
  • Chat Completions API
  • Tools
  • Conversations API
  • Reasoning models

Source: Overview - OpenAI API. Checked 2026-10-15.