A macro that uses OpenAI API?

Does anybody have an example script that uses the OpenAI API? I would like to feed some copied text for spell checking and grammar requests. It seems easy enough, but I'm looking for any example code that sends input to OpenAI through the API and retrieves the resulting text.

They have lots of examples in the documentation that you can implement via the script actions :wink:

https://platform.openai.com/docs/api-reference/authentication