Responses API, append messages to existing conversation

Hello

I was really excited about responses api feature to store conversations for entire month!

But I realized (when played) that It stores only beginning of conversation and doesn’t add new messages to existing chat. Am I wrong?

I played with this code

import OpenAI from "openai";

import cred from "./cred.json"

const openai = new OpenAI({
  apiKey: cred.openai
})

const prevId = "resp_681e4ae92df08191a874320b75b121180aded87eff5a98d8"


const main = async () => {

  const resp1 =
    await openai.responses.create({
      model: "gpt-4.1-mini",
      previous_response_id: "resp_681e4ae92df08191a874320b75b121180aded87eff5a98d8",
      input: "hello again, and how to translate hello to german?",
      store: true
    })

    console.log("resp1", resp1.id, resp1.output_text)
  

  const resp2 =
    await openai.responses.create({
      model: "gpt-4.1-mini",
      previous_response_id: prevId,
      input: [
        {
          role: "system",
          content: "be patient and very kind"
        },
        {
          role: "user",
          content: "what was my first question?"
        }
      ]
    });

  console.log("resp2", resp2.id, resp2.output_text)

}

main()

It doesn’t really seems to store the whole conversation.

Each response has a previous_response_id, that you can inform on the next request, that will follow the chained requests until the first one.

So, you need to continuously refer to the id of the latest response to continue the chain.

You can even fork the chain of messages.

Not entirely true. If I specify previous_response_id then new response has that id as well. So it doesn’t fork

No it doesn’t. It has a new one, I tried a few days ago.
Notice that you will get response.id not response.previous_response_id

like:
response_1 … generates a response_1.id

response_2 … will be requestes using previous_response_id=response_1.id

response_3 … will be requestes using previous_response_id=response_2.id

you are correct, thank you! They are very similar but different

resp1 resp_681e534945c88191b7c7ab171accf6810aded87eff5a98d8
resp2 resp_681e534b5d788191ad0f18bca0503fc50aded87eff5a98d8

1 Like

Funny thing is if you enable logs, you can navigate between them in the dashboard too.

1 Like