The API currently does not offer a memory function. It’s only currently being rolled out across the ChatGPT interface.
But if you are interested in building a custom solution for retaining memory then it might be worth checking out some of the other Forum posts. Some individuals such as @darcschnider have been doing some advanced work to enable memory retention. See the post here: