There are several CLI programs like this. I built mine before ChatGPT came out so it uses text-davinci-003. It https://github.com/runvnc/askleo
If you google for ChatGPT CLI I assume some will come up and those are probably better because they are cheaper and faster.
Looks like a typo; this should work:
Thanks! Does it take prompt on stdin too?
Fixed link:
I made something quite similar, it runs with support for things like color: https://github.com/runvnc/askleo