GPT-4.1 retains Memory Across Calls Despite Stateless

Hi all,
I’m currently using the OpenAI API with the latest SDK and GPT-4.1. Here’s a simplified version of my code:

new_prompt = ‘…xyz’

from openai import OpenAI

client = OpenAI(api_key = your_api_key)

response = client.responses.create(
model=“gpt-4.1”,
tools=[{“type”: “web_search_preview”}],
input= new_prompt)

According to the docs, API calls should be stateless — i.e., the model should not retain memory of previous prompts unless I explicitly include them in the messages list. However, I’m observing behavior that suggests the model is remembering previous interactions, even when I send an entirely new prompt.

I’ve verified that:

  • I’m not reusing the messages list.
  • I’m not using any wrapper like LangChain or memory-enabled classes.
    Is there any caching, tool memory, or known behavior in GPT-4.1 (especially when using tools like web_search_preview) that might explain this? Has anyone else encountered something similar?

Hi and welcome to the community!

It is most likely something with your implementation that’s causing this issue.

The short answer is: no :slight_smile:

What you can try is to perform your test via Curl to break down the requests to their most simple form.

2 Likes

Verify the value of new_prompt and make sure you aren’t passing any previous_response_id.