Can you limit the number of messages included when using previous_response_id?

I’m taking a look at the Responses API and previous_response_id looks like a good fit for my use case. I wanted to see if there’s a way to control the number of past messages that will be included when using previous_response_id?

I saw this in the conversation state docs mentioning it uses all past messages:

Even when using previous_response_id , all previous input tokens for responses in the chain are billed as input tokens in the API.

If it’s not supported yet, is it on a roadmap somewhere? Thanks!

1 Like

I believe that is not possible at the moment, but It would certainly be an interesting feature.

1 Like

One way to do it in the meantime might be to just call DELETE https://api.openai.com/v1/responses/{response_id} on older responses manually once you’ve exceeded the message window size you want

Deleting responses would not truncate the conversation length of the most recent response ID that you’d need to reuse. It would just prevent you from returning to that branch point in the conversation.