Also! if you have an openai account, this python script is an example of how to use the API: https://gist.github.com/vgmoose/a54408a28189b19501ed1afb7ee8d4e1
There's an initial prompt, and then each API request sends the chat history to the end point, so over a conversation it builds out.
On Line 44 is the main infinite loop. Line 47 prompts for text input from the user, Line 49 actually submits it to openAI, and then 50 prints the response, before saving it and looping back around.