AI prototypes should retire shared API keys before launch

Google Cloud’s migration guide makes the case for short-lived identity, narrow permissions and managed secrets. The useful lesson is to make key retirement a release gate, not a post-incident cleanup.
A Google Cloud access token typically lasts about 1 hour; an AI Studio API key does not expire on its own. That difference matters when a prototype reaches real users: a copied key can keep working, while a short-lived credential narrows the window for misuse. Google Cloud’s new migration guide argues that teams should stop treating shared keys as a production identity.
That is a useful security recommendation, but it should not be read as a reason to replace every key on day one. The practical trigger is exposure and shared use: once credentials leave one developer’s laptop, you need a way to know who used them, constrain what they can do and revoke access without hunting through chat logs.
Give people and software different identities
The guide’s first change is to let developers authenticate through Application Default Credentials, then use a service account for the deployed application. That separates a person’s access from the production workload and removes a long-lived key from source files and environment configuration.
For teams using Google’s model platform, the article says a short-lived credential can also call partner and open models through Model Garden. The operational benefit is larger than reducing accidental commits: each request maps to a user or workload identity, making access review and offboarding more concrete.
“Keep people and production apart.”
That separation only helps if permissions are narrow. The post recommends the Vertex AI User role for model calls rather than broad project roles such as Editor, and suggests granting human access through a group. A service account should receive only what the deployed service needs.
Keep the remaining secrets bounded
Some credentials will remain: payment, messaging and other third-party keys do not become identity-based just because a team moves model access to cloud IAM. Google’s guide puts those values in Secret Manager, with test secrets available to the developer group and production secrets readable only by the application identity.
It also recommends scanning repositories, deleting old AI Studio keys after migration, and adding spend controls. These steps address different failure modes. A scanner finds accidental exposure; revocation prevents a copied key from remaining useful; quotas and spend caps limit damage if an authorised path is abused. Alerts alone do not stop requests.
Make migration a release gate
The strongest takeaway is to treat credential migration as part of the prototype-to-production checklist, not as cleanup after launch. Start by taking inventory of keys and where each is used. Move developer access first, assign a separate workload identity, test least-privilege permissions, then rotate and revoke the old keys. Keep a rollback path that does not restore a shared production secret.
Google’s walkthrough is built around its own Cloud services, so teams on other platforms should map the same controls to their provider: short-lived identity for people and workloads, narrow permissions, managed storage for unavoidable secrets, and a verified revocation step. The measure of completion is simple: no production process depends on a key that has been copied between people or machines.
Sources
- Ultimate guide for fixing your team’s API keys · Google Cloud Blog
Written by the Devence Lab research team.




