To generate GTmetrix API Key, just follow the images to get the key

Open Gtmetrix website and create a free account there.

Info macro

Info macro

Info macro

Click on the Generate API key option to generate your key

Info macro