If you are using Windows and do not know how to install OpenAI SDK, run configure.bat and follow the instructions it gives.
The issue does not appear to be with the R/Python code or the system environment, but rather with how the Positron IDE's integrated R console handles the standard ...