An API key is a password for your quota. If it appears in browser code, anyone can copy it and spend your requests.
Call from your server
Keep the key in an environment variable on your server and call the API from there. Your front end talks to your own endpoint, which returns cached data.
Rotate and separate
Use separate keys for testing and production, and rotate a key if it ever appears in a repository, a screenshot or a support ticket.
Watch your usage
A sudden jump in requests is the earliest sign of a leaked key or a loop in your code. Alert on it. Ask your provider whether usage reports are available.
Next step: tell us what you are building and we will point you to the right endpoints.