This code contains two possibilities for letting OpenAI correct your text from the clipboard.
Use Python to grab your text from the clipboard, send it over to OpenAI and put the result again back to the clipboard.
Make sure to have rye installed on your system.
The init.lua is a simple Hammerspoon code snippet which allows to do the same thing from anywhere without any console. Install Hammerspoon, put the code into the configuration path and enjoy your text corrections.
Feel free to clone, fork, and change to you needs. The article to this repository can be found on my Substack https://craftpurist.substack.com.