English edition · cyberattaques.org in FrenchFrançais
IT news

Google Cloud publishes guide to retire raw Gemini API keys before production

Google Cloud has published a guide on moving Gemini projects from AI Studio API keys to identity-based authentication, service accounts and spending controls. It targets developers and administrators whose AI prototypes are heading into production.

What to do now

Google Cloud has posted a guide for teams that built a Gemini prototype using a plain API key taken from Google AI Studio. The pattern it describes is familiar: the key is a convenient way to start quickly, and it then stays in place once the application starts serving real users.

Over time the keys multiply. Each developer tends to hold one or more, kept in .env files, shell profiles and chat threads, while the application carries another in its configuration. Google points out that an AI Studio key is a bearer token, usable by anyone who has it. It does not expire by itself, is not bound to a machine, a person or a workload, and has no spending limit unless one is set.

To show what can go wrong, the vendor walks through a hypothetical case: an account that normally spends $180 a month has a key leak into a public repository, a Slack channel or a mobile app bundle. Automated scrapers pick it up within minutes and run heavy workloads, and the bill reaches tens of thousands of dollars before the first billing alert fires. Under the shared responsibility model, the customer pays for usage made with its own valid credentials.

The guide is organised in three parts. For people, each team member gets a single login through Application Default Credentials and uses it to call Gemini, Claude and open models; Google puts the first two steps at about five minutes. For the application, it should run under its own service account granted only the access it needs.

The remaining keys are then moved into Secret Manager, with spend caps, guardrails and monitoring added on top. Code for every step is published in a companion repository with runnable samples and offline tests. The source does not mention any deadline or enforced change on Google's side; the guide is advisory.

Action plan

What to do now

  1. Inventory every AI Studio API key in use, including those in .env files, shell profiles, chat tools and application configs.
  2. Move developers to Application Default Credentials with individual logins instead of shared keys.
  3. Run each application under a dedicated service account limited to the permissions it actually needs.
  4. Store any remaining keys in Secret Manager and set spend caps, billing alerts and usage monitoring.

Sources