The info you found for OSM should be applicable to Google Maps as
well.
It's basically find two things: 1) how many horizontal pixel (for
global) at zoom level Z? and 2) how many meters (for global) at
latitude LAT?
The first one is basically 256x2^Z.
The second one should be 2*PI*R*cosine(LATinRadian). R is earth
radius in meters as a sphere.
divide them should get what you need.
If a scale bar is what you are after, I think the API already has a
control for that.