Adding an OpenAI API key

The API key should be provided as a text file that contains only that key string and nothing else. By default, the file is at Path * '.secrets' / 'open-ai-api-key.txt'.

You can store the key programmatically using the following snippet:

apiKey := ''.
fileReference := GtLOpenAIClient apiKeyFile.
fileReference parent ensureCreateDirectory. 
fileReference ensureDelete writeStreamDo: [ :s | s nextPutAll: apiKey ]
  

Once set, you can test the key by trying to inspect the client:

GtLOpenAIClient withApiKeyFromFile