Spring › Spring-AI

Setting up Google AI Studio keys with monthly developer credits

Issue a Google AI Studio API key, claim the $10 monthly Google Developer Program credit from Gemini Pro, and verify Tier 1 standard billing with curl.

Setting up Google AI Studio keys with monthly developer credits

Google AI Studio’s free tier is convenient for quick experiments, but its data-training policy and tight rate limits make it a poor fit for real backend work. Here is how I issue an API key, claim the monthly $10 Google Developer Program credit included with Google One AI Premium (Gemini Pro), and activate pay-as-you-go Tier 1 billing.

Free tier limits and why billing matters

Google AI Studio lets you generate an API key without a credit card and start calling Gemini models right away. Once you wire that key into a Spring Boot backend or test suite, though, two free-tier constraints get in the way fast.

1. Data privacy and model training

Under the Google AI Studio terms, prompts and responses sent on the Free Tier may be collected and reviewed to improve Google’s models. You shouldn’t send internal schemas, customer payloads, or proprietary source code through a free-tier key.

When you attach a Google Cloud Billing Account to the project (Pay-as-you-go), Google excludes your API prompts and responses from model training.

2. Rate limits (RPM/TPM) and service tier

Free-tier keys hit strict requests-per-minute (RPM) and tokens-per-minute (TPM) caps. Running streaming chat tests or parallel integration suites quickly triggers 429 Too Many Requests. Switching to a billed project upgrades requests to the standard paid tier (serviceTier: standard) with higher quotas and steadier latency.

flowchart TD
    Req["Gemini API Request"] --> Check{"Billing Account Linked?"}
    Check -->|"No (Free Tier)"| Free["Strict RPM/TPM Limits & Training Eligible"]
    Check -->|"Yes (Tier 1 Prepaid)"| Paid["Standard Tier & Excluded from Training"]
    Paid --> Credit["Monthly $10 Developer Credit Applied First"]
OptionData privacyRate limitsBest fit
AI Studio Free TierMay be used for model improvementLow RPM/TPMPublic demos, throwaway prompt tests
AI Studio Pay-as-you-go (Tier 1)Excluded from model trainingProduction-ready quotasPersonal backends, side projects, Spring AI dev
Vertex AI (GCP)Enterprise IAM, VPC-SC, regional SLAHigh / custom quotasRegulated production workloads and team orgs

When not to use AI Studio API keys: If your organization requires IAM-based authentication instead of static API keys, regional data residency guarantees, or VPC Service Controls, skip AI Studio and connect through Vertex AI on Google Cloud instead.

Claiming the $10 monthly credit from Gemini Pro

If you already subscribe to Google One AI Premium (Gemini Pro), your account includes a Google Developer Program benefit: $10 per month (roughly ₩15,348) in Google Cloud and GenAI promotional credits.

Here is how to claim it:

  1. Sign in to your browser with the Google account that holds your Google One AI Premium subscription.
  2. Open the Google Developer Program benefits dashboard.
  3. Select the Benefits tab to view your recurring monthly GenAI and Cloud credit card and link it to your billing account.

Google Developer Program monthly credit benefits dashboard Figure 1. Monthly promotional credit card (₩15,348 / $10) and linked billing account status in the Google Developer Program dashboard.

This isn’t a one-time voucher—a fresh credit is issued every month, and each grant stays valid for roughly a year. Paired with a low-cost model like gemini-3.5-flash-lite, $10 covers millions of tokens per month, which is plenty for backend development and integration testing.

Linking a Google Cloud billing account for Tier 1

Credits land in a Google Cloud Billing Account, so you need to bind that billing account to your Google AI Studio project before the project upgrades out of the free tier.

1. Creating the billing account and the $5 prepaid deposit

If this is your first Google Cloud billing account, Google requires a payment card and may ask for a minimum $5 prepaid deposit as an anti-abuse measure.

Monthly promotional credits are consumed before your $5 prepaid balance or card is charged. As long as your development traffic stays under $10 a month, you won’t see additional card charges.

2. Switching your AI Studio project to Tier 1

  1. Open Google AI Studio.
  2. Click Projects in the left navigation bar.
  3. Change the billing setting on your target project from Free tier to the billing account holding your developer credits (Tier 1 · Prepaid).

Google AI Studio project billing tier comparison Figure 2. Google AI Studio Projects view comparing a Free tier project with a billed Tier 1 prepaid project.

Once the project badge switches to Tier 1, every API key created under that project routes through the paid infrastructure.

Issuing and securing your API key

  1. Go to API keys in the left menu of Google AI Studio.
  2. Click Create API key and select your newly upgraded Tier 1 project.
  3. Copy the generated AIzaSy... key into a local secret store or .env file.

Never commit API keys to Git or embed them in client-side code. A leaked key on a billed project can rack up unexpected charges within minutes.

Add the key to your project’s .env file and double-check that .env is listed in .gitignore:

1
2
# .env (never commit to Git)
SPRING_AI_GOOGLE_GENAI_API_KEY=AIzaSyDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

For quick terminal tests, export it in your shell session:

1
export SPRING_AI_GOOGLE_GENAI_API_KEY="AIzaSyDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Verifying the standard service tier with curl

Before wiring the key into Spring Boot, verify with curl that the key works and that Google routes it to the paid standard tier. I tested against gemini-3.5-flash-lite:

1
2
3
4
5
6
7
8
9
10
11
curl -s -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.5-flash-lite:generateContent?key=${SPRING_AI_GOOGLE_GENAI_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "parts": [
          { "text": "Hello, reply in 5 words." }
        ]
      }
    ]
  }' | jq .

Running this command returns the generated response along with billing and token metadata:

Gemini API curl verification terminal output Figure 3. Terminal curl response confirming serviceTier is set to standard.

Check three fields in the JSON payload:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "text": "Hello, how can I help?"
          }
        ],
        "role": "model"
      },
      "finishReason": "STOP",
      "index": 0
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 8,
    "candidatesTokenCount": 7,
    "totalTokenCount": 15,
    "serviceTier": "standard"
  },
  "modelVersion": "gemini-3.5-flash-lite"
}
  • "serviceTier": "standard" confirms the request ran on the paid tier rather than the free tier, so your prompt data is excluded from model training.
  • "modelVersion": "gemini-3.5-flash-lite" confirms the target lightweight model answered the request.
  • "totalTokenCount": 15 logs 8 input tokens and 7 output tokens, deducted from your monthly $10 developer credit first.

Production caveats and checklist

Before using this key in CI pipelines or backend services, verify these four items:

  • Set a Cloud Billing budget alert: Configure a $5 or $10 budget threshold in Google Cloud Billing so a runaway retry loop notifies you before touching your card.
  • Restrict the API key in GCP: In Google Cloud Console under APIs & Services → Credentials, restrict the key to the Generative Language API only.
  • Confirm .env is ignored: Run git status after adding your local .env file to be sure it isn’t tracked.
  • Separate dev and prod projects: Keep personal monthly credits on a dev project and isolate production traffic under a dedicated organization billing account.

With the Tier 1 API key verified, you can wire it straight into Spring Boot 4 and Spring AI 2.0.1—see Using Spring AI ChatClient with Google GenAI for sync calls for the full spring-ai-starter-model-google-genai setup.

This post is licensed under CC BY 4.0 by the author.