Asked about The model has no memory

How would you keep a long-running chat affordable?

An answer that works

Prompt caching on the stable prefix first, since it is free quality-wise. Then summarise or drop older turns, keeping a short running summary. Then retrieve only relevant history instead of carrying all of it. Increasing the context window is the last resort, not the first.

Reading an answer is not being able to give one. The section that teaches this is The model has no memory, 2 hours of The Messages API.

Learn this properly