Does Responses API support `stop` parameter or not?
OpenAI Developer Community
April 28, 2026
Here is a simple Python example using a stop sequence with the OpenAI Responses API:
from openai import OpenAI
client = OpenAI()
response = client.responses.create( model=“gpt-4.1-mini”, input=“Write a short bedtime story in two sentences. End the story with the marker .”, stop=[“END”] )
print(response.output_text)
In this example, "END" is the stop sequence. When the model generates "END", the API stops producing more output, and the stop sequence itself is not included in response.output_text.
Discussion in the ATmosphere