See chat history with api

Wondering if can I see my chat history with ChatGPT with api key if history dosent show itself in the playground? History is like gone on the web


i have some programs that use the api, but i never implemented logging. i’d also like to be able to see my history

Chat GPT-4 API does not “remember” your responses like when using it in the browser. To have a conversation with it, you need to constantly update and provide the previous conversation to it for context.

For the API, you achieve this by saving the previous response and adding it to the messages array every time you make a new API request / chat message. In the example above, there are 3x previous messages from the user and GPT-4 combined and the 4th one is the “new one” for GPT-4 to answer.

Here is a code example to illustrate.

1 Like

When you send the whole prompt/response history every time, isn’t that more expensive? And when I do that, it doesn’t mimic the ongoing drill down like conversation flow that you experience on chat.openai . Can we not re-create that using the API?

1 Like