To make requests to the OpenAI API, you need to use your API key and organization name (if applicable). To avoid exposing your API key in your Unity project, you can save it in your device's local storage.
To do this, follow these steps:
- Create a folder called
.openaiin your home directory (e.g.C:User\UserName\for Windows or~\for Linux or Mac) - Create a file called auth.json in the
.openaifolder - Add an
api_keyfield and a organization field (if applicable) to theauth.jsonfile and save it
Here is an example of what your auth.json file should look like:
{
"api_key": "sk-...W6yi",
"organization": "org-...L7W"
}



