You can tune the temperature parameter and bring it to 0 (if using the API). Although technically it's not fully deterministic, it will reply with the exact same answer >99% of the time in my experience.
(This is for GPT-3 and ChatGPT. Haven't tested GPT-4)
(This is for GPT-3 and ChatGPT. Haven't tested GPT-4)