You can't. The API is free to use, even commercially, but it belongs to, and is hosted by Google and their TOS,
https://developers.google.com/terms and
https://support.google.com/code/topic/13605, means you cannot download it and host it locally.
This may change in the future as they posted in the forum in
June 2022 that they may be looking at releasing at least part of it as open source.
When I was looking around at the various charting and graphing libraries, this API was one of the feature rich and easier ones to use. If you absolutely must use something locally, then it may be one of the others is better for you.