How to fix API keys before your startup goes live
Google has published a guide to fix API keys for AI teams. It explains safer access, spend limits and monitoring before prototypes become real services.

Key takeaways
- A raw AI API key can be used by anyone who holds it and may not expire.
- Teams can use individual logins and service accounts instead of shared keys.
- Remaining third party keys should be stored in a secret manager with limits and monitoring.
In this article
Why a raw key is risky
On 20 November 2026, Google published a guide to fix API keys for AI teams. The build begins quickly. A coder gets a key from Google AI Studio and hands it to an agent. The aim is speed.
Later, the prototype may reach real users. The key then stays the same. The setup may grow into many keys.
Each coder may have one, or more than one, stored in setup files, shell profiles and chat threads. The app may add another from its own settings.
A raw key is a bearer token. Anyone who holds it can use the service. The key does not expire by itself and is not tied to one person or workload. Google notes that a key may not have a spending cap unless one is added.
How to move to safer access

The guide suggests a different approach. First, offer each person a single login that uses Application Default Credentials. That single credential can call Gemini, Claude and open models. The group should not need fresh accounts or fresh keys.
Within each SDK, changing which model is selected is a small code change. Second, give the application its own service account. The earlier code may stay as it is. On cloud hosts, the workload gets a short-lived token. The token refreshes automatically.
OpenAI GPT-6 models came to private preview for some enterprise customers. The same login may work when access opens. A leaked token is short lived and limited. The team should also give each identity only the access it needs. Calling models usually needs a narrow role rather than broad admin rights.
Where remaining keys should go
A few credentials may remain necessary. Payment, chat and email services can still need their own secrets. They should be kept in a protected secrets store. Access can be granted to the identity that requires it.
Keys that are active can remain in the live project. They should be opened only by the application service account. The application can fetch them when it starts. Using standard input can stop the value being stored in shell history.
The guide also discusses spend caps, guardrails and monitoring. These controls can help when a key is used in an unexpected way. The steps are part of a larger path from prototype to production. A companion repository has runnable samples and offline tests. It includes code for each step.
What to do next
Before making changes, the guide advises teams to check where their keys currently sit. A small tool can search for patterns that resemble API keys and for api_key entries set to fixed text. It can show where a match was found without displaying the secret.
It can return a failure code, making it suitable for continuous integration. The steps go from person logins to service accounts, secret storage and spend controls. Teams should follow official guidance from Google Cloud before acting.
The provider considers the customer responsible for spending made with valid credentials. The guide notes that a raw key is different from credentials that expire or are tied to a workload. It says such a key may be acceptable on a personal device. It becomes risky if the secret leaves that device, if several people need it, or if costs rise above a few hundred dollars monthly.
Sources
- Ultimate guide for fixing your team’s API keysGoogle Cloud Blog
Spotted a mistake? See our corrections policy. Read how News by OnDevice works in our editorial policy.



