macOS 11: Get system information (GPU, resolution) programmatically (in C)
displayplacer allows to read and write display settings and is open source. I'm not sure about GPU details though.
The API used seems to be defined in IOKit/graphics/IOGraphicsLib.h.