Can’t thank you enough for sharing such valuable info.
I have tried with my project application URL in both the API(As well as your Macro code) and page speed front end.
The speed score differs with API (Score: 78) and front end (Score 99), you have any idea.
Font End: https://developers.google.com/speed/pagespeed/insights/
I checked and I get roughly the same results for this domain.
Maybe try adding the following do debug what is the API response vs what the API is telling you (to see if there is an error in the code against the API response):
You also need to make sure you are testing the same URL and strategy option (Mobile / Desktop). Some difference will always be there due to DNS and host server latencies.