Repository navigation
Google Places Autocomplete API pricing, session tokens, and request optimization #1112
Replies: 1 comment
The Idea is that if you use the new Autocomplete Data API to get to places-data you pay for, the autocomplete requests leading to finding the Place record to load are grouped in a session and paid together. So, if you end the autocomplete session by "purchasing" place details ( Here is the documentation that explains the sessions: https://developers.google.com/maps/documentation/places/web-service/session-pricing#session-billing, which explains this in much more detail which also contains links to the different SKU's and Price List. Also have a look at this: https://developers.google.com/maps/documentation/javascript/place-autocomplete-new#best-practices, which has a number of helpful tips for cost- and performance-optimization.
Yes, that seems correct. The session is created correctly and cleared after
That's an "abandoned session" and all autocomplete requests will be billed as usual, as if there was no session.
Yes, that’s one common approach to reduce the cost. Also, maybe wait with the first request until the first three or four characters have been typed.
Yes, but it only applies when the session terminates with one of the more expensive detail requests ("Place Details Enterprise" or "Address Validation")
The free tier is 10k requests, that's quite a lot to do in two days of development. The implementation with the hook seems fine, but there might be other problems in your application that cause more requests than needed. I'd recommend adding
This page (already linked above) also has a section about cost-optimization. Since you only need the address, you can also use the Geocoder with const gc = new google.maps.Geocoder();
const result = await gc.geocode({placeId: placeId})instead of using Some more Ideas if you're worried about API cost:
|
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone!
I'm currently implementing Google Places Autocomplete using the new Autocomplete Data API with React and @vis.gl/react-google-maps.
The implementation works, but I'm concerned about Google Maps API pricing, especially during development. I managed to hit my API usage limit within just two days, and I'm trying to understand whether my implementation is making unnecessary requests or whether this is expected behavior.
I'd appreciate some clarification from anyone who has experience with the Google Places API.
I'm using a 500ms debounce to avoid sending a request on every keystroke.
SearchBox component
useAutocompleteSuggestions hook
Google documentation mentions session-based pricing, and I'm having trouble understanding what this means in practice.
Does one session token group multiple autocomplete requests into a single billing session?
Are autocomplete requests within the same session free, discounted, or individually billed?
Does the session only become complete when the user selects a prediction and requests Place Details?
What happens if the user types something but never selects a suggestion?
2. Does debouncing actually reduce API costs?
For example, suppose a user types TOKYO.
With a 500ms debounce, will Google receive:
One request after the user finishes typing?
Multiple requests if the user pauses between keystrokes for more than 500ms?
If the user types slowly, could this result in five separate autocomplete requests within the same session?
I've seen references to unlimited requests in the Google Maps pricing documentation.
Does this mean unlimited requests within a session, or does it mean something else?
I'm particularly confused about how this relates to actual billing.
I'd also appreciate feedback on whether my current implementation follows Google's recommended session-token lifecycle.
Some things I'm unsure about:
Am I creating and reusing session tokens correctly?
Is resetting the token after fetchFields() the correct approach?
Should I create a new token when the user clears the search input?
Should I reset the session when the user abandons a search without selecting anything?
Is there a better way to prevent unnecessary API requests?
4. Is Google Places Autocomplete expensive?
I'm building an application that will use city autocomplete as an important feature.
I'm concerned about the cost when the application has hundreds or thousands of users searching for cities.
During development alone, I seem to have hit my API usage limit within two days.
Is this normal, or does it indicate that something is wrong with my implementation?
Would you recommend any alternatives or optimization strategies for reducing Google Places API costs?
I want to implement Google Places Autocomplete properly while keeping API costs predictable.
I'm not looking for ways to bypass Google's billing. I just want to understand the pricing model, session tokens, and best practices
Any explanations, implementation suggestions, or real-world experiences would be greatly appreciated!
Thanks in advance!
All reactions