How to Use Gemini Enterprise Models with GCP Trial Credits (and Your Own Credits)
from Jim's Personal Blog
Google Cloud gives new accounts $300 in free trial credits valid for 90 days. If you want to run Gemini models on Google Cloud (formerly Vertex AI, now part of Gemini Enterprise / Agent Platform) rather than the separate Google AI Studio, these credits can cover your first-party Gemini API calls.
Here is how to claim the credits, set up your billing and project without getting hit by trial quota limits, and wire everything into gcloud, gemini-cli, and VS Code Copilot agents.
1. Claim the $300 Credit and Pass Verification
To sign up for the free trial at Google Cloud Free Features, you need a Google account and a valid credit or debit card.
A few practical details about payment methods: – Google runs a small temporary pre-authorization charge ($0 to $1) to verify you are human and prevent bot abuse. Google reverses this charge automatically. – Standard credit cards (Visa, Mastercard, Amex) work best. Debit cards usually work as long as your issuing bank supports international transactions and online 3D Secure verification. – Prepaid cards, virtual disposable cards, and some regional gift cards almost always fail Google's fraud checks. If your card gets declined, try a standard bank-issued card.
2. Consumer Gemini vs. Gemini Enterprise (Deploying Models Like Ollama)
Before spending credits, it helps to separate what Google sells to consumers from what Google Cloud provides to developers.
Consumer / Individual Gemini (Any Tier)
When you use the free Gemini web app (gemini.google.com), buy Google One AI Premium ($20/month for Gemini Advanced), or add Gemini to your personal Google Workspace, you are buying a finished consumer application:
– You interact through an opinionated chat interface with pre-packaged consumer tools (Google Drive/Docs integration, Gems, Imagen image generation).
– You pay a flat monthly subscription.
– You do not get raw API endpoints, custom system telemetry, IAM permissions, or VPC network controls.
– Your prompts and data fall under consumer terms of service unless covered by a commercial enterprise contract. You cannot connect this account to external coding agents or custom software.
Gemini Enterprise on Google Cloud
Gemini Enterprise (formerly Vertex AI, now part of Google Cloud's Agent Platform) works like a remote, cloud-scale version of Ollama.
When you run Ollama on your local machine, you do not pay a monthly subscription for a chat application. Ollama downloads raw model weights (like Gemma or Llama) and runs a local server that accepts HTTP POST requests with prompt payloads, token counts, and temperature settings.
Gemini Enterprise on GCP does the exact same thing, but hosted across Google's infrastructure:
– Raw API Endpoints: You do not buy an app subscription. You query managed endpoints for models like gemini-2.5-flash or gemini-1.5-pro (or deploy open weights directly in Model Garden).
– Pay-Per-Token Billing: You only pay for what you consume—fractions of a cent per million input/output tokens, context caching seconds, or dedicated GPU/TPU hours.
– Enterprise Data Privacy: Under Google Cloud terms, your prompts, context, and completions are never logged or used to train Google's base models.
– Pluggable Backend: Because it exposes standard endpoints, you can plug your Gemini Enterprise backend into any client: terminal tools (gemini-cli), VS Code Copilot extensions, backend microservices, or direct cURL calls.
3. The Free Trial Catch: Upgrading to Paid
By default, the Google Cloud Free Trial runs inside an isolated sandbox. You cannot request certain quota increases, access GPUs, or use some production APIs until you lift trial restrictions.
To get full API access, you need to upgrade your Cloud Billing account: 1. Open the Google Cloud Console. 2. Go to Billing > Billing Account Overview. 3. Click the Upgrade button in the top banner.
How Billing Works After Upgrading
Many developers hesitate to click “Upgrade” because they assume it wipes out the free credit balance. According to official GCP documentation: – You keep your remaining $300 credit. Upgrading ends the trial status, but your remaining balance stays active until the original 90-day window expires. – Google burns the credit first. Any eligible usage draws down your promotional credits before charging your card. – Credit limitations: The $300 credit applies to Google Cloud services, including first-party Gemini models on Vertex AI. It does not cover Google AI Studio (which is billed separately) or third-party partner models offered as Model-as-a-Service on Vertex AI. – Post-credit billing: Once your credits hit $0 or 90 days pass, Google bills your card for ongoing usage.
4. Create a Project and Enable Vertex AI
Google Cloud groups all resources, IAM permissions, and billing inside projects.
Create the Project
In the GCP Console or via terminal, create a fresh project:
gcloud projects create gemini-trial-lab --name="Gemini Trial Lab"
Link your billing account to the new project in the console under Billing > Account Management, or run:
gcloud billing projects link gemini-trial-lab --billing-account=YOUR_BILLING_ACCOUNT_ID
Enable the Required APIs
To send requests to Gemini models, enable the Vertex AI API (aiplatform.googleapis.com):
gcloud services enable aiplatform.googleapis.com --project=gemini-trial-lab
5. Set Up Authentication on Linux
Tools like gemini-cli and the Google GenAI SDK look for Application Default Credentials (ADC) to authenticate against Google Cloud.
Install the Google Cloud CLI (gcloud) if you have not already:
# On Debian/Ubuntu
sudo apt-get install apt-transport-https ca-certificates gnupg curl
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt-get update && sudo apt-get install google-cloud-cli
Authenticate your user account and configure ADC:
# 1. Log in to the CLI
gcloud auth login
# 2. Generate local Application Default Credentials (ADC)
gcloud auth application-default login
# 3. Set your active project
gcloud config set project gemini-trial-lab
# 4. Set the quota project so billing attributes correctly
gcloud auth application-default set-quota-project gemini-trial-lab
6. Configure and Run gemini-cli
gemini-cli can target either Google AI Studio (via API key) or Google Cloud Vertex AI (via ADC and GCP project settings). When using your GCP trial credits, you want Vertex AI mode.
Set Environment Variables
If you currently have a GEMINI_API_KEY or GOOGLE_API_KEY exported in your shell, unset them so the CLI does not default to AI Studio:
unset GEMINI_API_KEY
unset GOOGLE_API_KEY
Then tell the CLI which Google Cloud project and region to query:
export GOOGLE_CLOUD_PROJECT="gemini-trial-lab"
export GOOGLE_CLOUD_LOCATION="us-central1"
To persist these variables across terminal sessions, add them to your ~/.bashrc or put them directly in ~/.gemini/.env:
mkdir -p ~/.gemini
cat <<EOF >> ~/.gemini/.env
GOOGLE_CLOUD_PROJECT="gemini-trial-lab"
GOOGLE_CLOUD_LOCATION="us-central1"
EOF
Test the CLI
Run a quick prompt to verify the connection:
gemini -m gemini-2.5-flash -p "Explain how a reverse proxy works in two sentences."
If you prefer interactive mode, start a session directly:
gemini -m gemini-2.5-flash
7. Hook into VS Code Copilot Agents via Extensions
You can use your Google Cloud project and $300 trial credits directly inside VS Code's native Chat and Copilot agent workflows.
VS Code exposes a Language Model API (vscode.lm) that lets extensions register custom language models. Once installed, these models show up alongside default choices in the VS Code Copilot Chat panel.
Option 1: Use the Vertex AI Models Chat Provider Extension
The community extension Vertex AI Models Chat Provider connects the native VS Code Chat interface directly to your GCP project using Application Default Credentials.
- In VS Code, open the Extensions view (
Ctrl+Shift+XorCmd+Shift+X) and search for Vertex AI Models Chat Provider. Click Install. - Make sure you already ran the ADC authentication command in your terminal:
bash gcloud auth application-default login - Open your project folder in VS Code, create a
.vscode/settings.jsonfile (or edit your user settings), and specify your project ID and region:json { "vertexAiChat.projectId": "gemini-trial-lab", "vertexAiChat.location": "us-central1" } - Open the Copilot Chat panel (
Ctrl+Alt+IorCmd+Alt+I). Click the model selector dropdown at the bottom of the chat box. You will see your Vertex AI Gemini models listed. Select one, and all chat questions and agent turns will route through your GCP project and draw from your trial credits.
Option 2: Use the Official Gemini Code Assist Extension
If you want codebase indexing, whole-repo awareness, and inline code suggestions in addition to chat:
- Install the official Gemini Code Assist extension from the VS Code Marketplace.
- In your Google Cloud project, enable the Cloud AI Companion API:
bash gcloud services enable cloudaicompanion.googleapis.com --project=gemini-trial-lab - Click the Gemini status item in the VS Code bottom status bar, sign in with your Google account, and choose
gemini-trial-lab.
Clarification on GitHub Copilot's Built-in Model Picker
GitHub Copilot natively offers Gemini 2.5 Pro in its dropdown for Copilot subscribers. That option runs on GitHub's infrastructure and burns your GitHub subscription quota, not your Google Cloud $300 credit. To draw from your Google Cloud trial balance, use the Language Model Provider extension approach above, which routes your queries through your own GCP project ID.
8. Calling Models from Code or cURL
You can also call the same models in scripts using your trial credits.
Python (google-genai SDK)
Install the official SDK:
pip install google-genai
Run a generation query with vertexai=True:
from google import genai
client = genai.Client(
vertexai=True,
project="gemini-trial-lab",
location="us-central1"
)
response = client.models.generate_content(
model="gemini-2.5-flash",
contents="Name three practical use cases for Redis."
)
print(response.text)
Direct cURL Request
To test from bash without installing Python packages:
TOKEN=$(gcloud auth print-access-token)
PROJECT_ID="gemini-trial-lab"
LOCATION="us-central1"
MODEL="gemini-2.5-flash"
curl -X POST \
-H "Authorization: Bearer ${TOKEN}" \
-H "Content-Type: application/json" \
"https://${LOCATION}-aiplatform.googleapis.com/v1/projects/${PROJECT_ID}/locations/${LOCATION}/publishers/google/models/${MODEL}:generateContent" \
-d '{
"contents": [
{
"role": "user",
"parts": [{"text": "Hello from curl!"}]
}
]
}'
9. Budget Guardrails: Avoid Surprise Bills
The $300 credit gives you plenty of room to test, but you should set limits so you avoid unexpected charges when the trial ends or credits run out.
Set Up a Budget and Alerts
- In Google Cloud Console, navigate to Billing > Budgets & alerts.
- Click Create Budget.
- Set your target budget amount (e.g., $300 during trial, or $20/month if continuing on your own funds).
- Configure threshold rules (such as 50%, 90%, and 100% of actual spend). Google sends email alerts to billing administrators whenever your spend crosses these thresholds.
Model Cost Awareness
Gemini pricing on Google Cloud scales by input and output tokens: – Flash models (e.g. Gemini 2.5 Flash, 1.5 Flash) are inexpensive: fractions of a dollar per million tokens. You can run hundreds of thousands of test prompts before making a noticeable dent in the $300 credit. – Pro models (e.g. Gemini 1.5 Pro, 2.5 Pro) cost significantly more per token and consume credits much faster, especially with long context windows and audio or video inputs.
When You Are Done Experimenting
If you decide not to keep using Google Cloud after testing:
– Delete the project via gcloud projects delete gemini-trial-lab or from the console's Resource Management page. Shutting down the project immediately stops all billable services linked to it.
– If keeping the project, disable the Vertex AI API:
gcloud services disable aiplatform.googleapis.com --project=gemini-trial-lab
Closing Takeaways
Using Google Cloud's $300 trial credit for Gemini models gives you 90 days of high-end LLM infrastructure without paying a subscription. You can run hundreds of thousands of requests through gemini-cli, build prototypes with the google-genai Python SDK, or route your VS Code Copilot agent turns through your own project.
Two practical habits will keep this setup painless:
1. Always check your active project: Run gcloud config get-value project before starting a session so you do not accidentally send requests to a production or unmonitored project.
2. Watch your budget thresholds: Keep billing alerts active so you know exactly when the trial balance is running low. When the 90 days end, Flash models cost only pennies for casual development work, but shutting down unused projects ensures you are never billed for background idle resources.
Sources & Official Documentation
- Google Cloud Free Program & Trial Features: cloud.google.com/free/docs/free-cloud-features
- Upgrading to a Paid Cloud Billing Account: cloud.google.com/billing/docs/how-to/modify-project
- Vertex AI Generative AI Documentation: cloud.google.com/vertex-ai/docs/generative-ai/start/quickstarts/quickstart-multimodal
- Vertex AI Pricing & Token Rates: cloud.google.com/vertex-ai/generative-ai/pricing
- Application Default Credentials (ADC) Setup: cloud.google.com/docs/authentication/provide-credentials-adc
- Gemini Code Assist for VS Code: cloud.google.com/gemini/docs/codeassist/overview
- VS Code Language Model API: code.visualstudio.com/api/extension-guides/language-model
- Vertex AI Models Chat Provider (VS Code Marketplace): marketplace.visualstudio.com/items?itemName=GoogleCloudTools.vertex-ai-models-chat-provider






Kang Dadang M. Naser
Kang Dadang Supriatna anu BEDAS


