The Elevation API, just like with other Google Maps Platform APIs, are billed based on consumption wether the requests originate from a prod server or a localhost.
The API currently offers a free monthly allowance of 5,000 requests. Once this allowance is exceeded, the price starts at $5.00 USD per 1,000 requests ($0.005 per request) for the first 100,000 calls.
Have you tried batch requests with your application such as querying the locations parameter up to 512 lat/lng coordinates in a single request?
If these charges were incurred due to an unintended implementation error during testing, please let us know by creating a support case.