LGTM × Google Gemini
BYOK with Google Gemini on LGTM: paste your ai.google.dev key, AES-256-GCM at rest, decrypt only in worker memory. Use Gemini 2.5 Pro or Flash for review.
How LGTM uses your Gemini key
Settings → AI Providers → Google Gemini. Paste your Google AI Studio key (from aistudio.google.com/app/apikey). LGTM validates by calling GET /v1beta/models on generativelanguage.googleapis.com with the key — accepted if 200 and at least one Gemini chat model is listed.
Storage: AES-256-GCM identical to OpenAI / Anthropic. Master key in Fly Secrets, encrypted blob in MongoDB. Decryption happens only inside worker process at review time.
Per-review: worker decrypts, calls /v1beta/models/{model}:generateContent with the key as URL param (Gemini's auth pattern is different from Bearer-token providers — same security implications). Drops plaintext after response. Your bill comes from Google Cloud / Google AI Studio.
Supported Gemini models
LGTM's Gemini catalog: Gemini 2.5 Pro (flagship, highest quality, 2M+ token context window), Gemini 2.5 Flash (balanced cost/quality, 1M context), Gemini 2.5 Flash-Lite (cheapest, faster).
Gemini's massive context window is unique — for large diffs or whole-file review, Gemini Pro can handle 10x what GPT-4o or Claude can ingest in one call. Less useful for typical 300-line PRs; very useful for monorepo cross-file analysis.
Default agent assignment: Pro for Bugs + Security, Flash for Performance + Best-Practices + Readability, Flash-Lite for Documentation. Per-repo overrides on Pro plan.
Cost — Gemini pricing
Gemini's pricing model is the most aggressive of the three majors. Flash-Lite costs ~$0.075 per million input tokens — about 1/5 of Claude Haiku, 1/3 of gpt-4o-mini. Flash and Pro are higher but still competitive.
A 300-line PR review on Gemini 2.5 Pro: $0.04-$0.10 (cheaper than OpenAI gpt-5.4 by ~50%, similar quality on code tasks). On Gemini 2.5 Flash: $0.01-$0.025. On Flash-Lite: $0.003-$0.008.
Caveat: Gemini's free tier (Google AI Studio) is generous but rate-limited. For production team use, you'll want Google Cloud Vertex AI integration with paid quotas — the LGTM key works for both, but Vertex AI gives higher quotas + GCP billing integration.
Privacy + data handling
Google's API terms separate AI Studio (developer tier) from Vertex AI (production tier). AI Studio inputs ARE used to improve Google services unless you've opted out at the project level. Vertex AI inputs are NOT used for improvement — enterprise terms.
Recommendation: for production team use, configure your Gemini key against a Vertex AI project (you'll need a GCP account). LGTM doesn't enforce this — your key just works — but the data-handling implications differ between Studio and Vertex.
LGTM-side: same as the other providers — diffs not persisted, findings persisted (deletable on request).
Setup
(1) Get a key from aistudio.google.com/app/apikey (developer) OR from GCP IAM → Service Accounts (Vertex AI production). (2) Sign in to LGTM. (3) Settings → AI Providers → Google Gemini. (4) Paste key + click Validate. (5) Pick default model.
Multi-region: Gemini is available in multiple GCP regions; LGTM's worker calls whichever endpoint your key is provisioned for. For India teams, asia-south1 (Mumbai) gives sub-100ms latency.
Concurrent limit: AI Studio dev tier caps you to ~60 RPM. For team use exceeding that, upgrade to Vertex AI paid tier (no LGTM-side change required — your key handles it).
Implementation examples
async function validateGeminiKey(key: string) {
const url = `https://generativelanguage.googleapis.com/v1beta/models?key=${key}`;
const res = await fetch(url);
if (res.status === 401 || res.status === 403) throw new Error('invalid_key');
if (res.status === 429) throw new Error('rate_limited');
if (!res.ok) throw new Error('provider_error');
const { models } = await res.json();
const hasGemini = models.some(m => m.name.includes('gemini'));
if (!hasGemini) throw new Error('no_models_available');
return encryptKey(key);
}Configure Gemini on LGTM
Gemini 2.5 Pro/Flash/Flash-Lite · 1M-2M context · per-repo overrides
Go to the product pageGoogle Gemini integration FAQs
AI Studio vs Vertex AI — which should I use for BYOK?
AI Studio for personal / small-team use; Vertex AI for production team use with enterprise data-handling terms. Same Gemini models, different data-use policies. LGTM works with both — the key you paste determines the path.
Does Google train on my prompts?
Depends on tier. AI Studio (developer) inputs are training-eligible by default, opt-out at project level. Vertex AI (enterprise) inputs are NOT training-eligible. Configure accordingly for your use case.
Is Gemini's big context window useful for code review?
Yes for large diffs (5000+ line refactors) and whole-file rewrites. For typical 300-line PRs, the context window doesn't matter much — but for that one quarterly mega-PR, Gemini Pro can review it in a single call where other providers would chunk.
What about regional availability for India teams?
Gemini is available in asia-south1 (Mumbai) and asia-south2 (Delhi) via Vertex AI. AI Studio routes to whichever Google datacenter is closest, no region pinning. LGTM works the same regardless.
Cost vs OpenAI vs Anthropic on equal task?
Gemini Flash-Lite is typically the cheapest workable option (~1/5 the cost of Haiku/gpt-4o-mini). Gemini Pro ≈ Claude Sonnet ≈ gpt-5.4 in cost. The aggressive Flash-Lite pricing makes Gemini compelling for high-volume Documentation/Readability agents.
Related across LGTM
Other integrations
OpenAI
BYOK with OpenAI on LGTM: paste your platform.openai.com key, we encrypt with AES-256-GCM, decrypt only inside worker memory at review time. Zero markup, your bill, your model choice.
Anthropic
BYOK with Anthropic on LGTM: connect your console.anthropic.com key, encrypted with AES-256-GCM, decrypted only in worker memory. Use Claude Opus 4.7, Sonnet 4.6, or Haiku 4.5 per repo.
GitHub
LGTM's GitHub App: 4 permissions (contents:read, pull-requests:write, checks:write, metadata:read), webhook subscriptions on pull_request + push + installation. No access to secrets, can't push code.