Skip to main content

gemini-radar

Gemini API infrastructure FinOps SDK — part of the Hyperscaler Radar suite.

Scan a Gemini Developer API key's project for its model catalog, tuned models, cached content, uploaded files, File Search Stores, and batch jobs. Detect external service relationships from cached-content system instructions (the closest thing this API has to an OpenAI assistant's stored instructions), flag cost/hygiene anomalies via a findings engine, and export inventory to CSV or a draw.io architecture diagram.


Install

pip install gemini-radar

Requires Python 3.10+. CSV and draw.io export ship in the base install.


A different shape than openai-radar / anthropic-radar — on purpose

The Gemini Developer API (generativelanguage.googleapis.com) has no org-wide usage/cost report and no API-key-listing endpoint — a single key just scopes calls to whichever Google Cloud project issued it in AI Studio. So gemini-radar doesn't do token/dollar findings the way its siblings do; instead it watches the resources that carry their own standing cost regardless of billing visibility:

  • cachedContents — billed hourly for storage until they expire, whether or not they're being hit
  • fileSearchStores — persistent RAG storage
  • batches — async job failures that silently waste quota
  • files — 48h auto-delete TTL, useful for pipeline hygiene

For actual token spend and Cloud Billing data on the backing project, pair this with gcp-radar rather than duplicating that surface here.

from gemini_radar import RadarClient, Runner

# Reads GEMINI_API_KEY (or GOOGLE_API_KEY) from environment
client = RadarClient()
result = Runner.run_sync(client)

print(result.summary())
result.export_csv("./out/")
result.export_drawio("./out/gemini_arch.drawio")

CLI

# Full scan — findings table to stdout
gemini-radar run

# CSVs + draw.io diagram
gemini-radar run --csv-dir ./out --drawio-file arch.drawio

# JSON instead of a table
gemini-radar run --output json --out-file scan.json

# Skip batch jobs or File Search Stores
gemini-radar run --no-batches --no-file-search

# Findings only
gemini-radar findings

# Print the version
gemini-radar version

Flags follow the Radar suite convention: --output/-o selects table or json, --out-file writes the JSON payload, --csv-dir writes per-resource CSVs.


Findings engine

Rule ID Severity Condition
CACHE_001 HIGH Cached content expiring within 24h while still holding tokens
CACHE_002 MEDIUM Cached content is idle (zero tokens) but still billed hourly
TUNED_001 MEDIUM Tuned model stuck in FAILED state
BATCH_001 HIGH Batch job failure rate > 10% across recent jobs
FSS_001 MEDIUM File Search Store larger than 5 GB (storage cost driver)
FILE_001 LOW Uploaded file expiring within 6h (auto-deleted at the 48h TTL)

Service relationship detection

cachedContents is the one Gemini resource that stores a real systemInstruction, so detect_relationships() mines that text (plus tuned-model and file-search-store display names) for the same external-service signal set as the rest of the Radar suite, and emits ServiceRelationship edges (dashed lines in the draw.io diagram):

Kind Signals
AWS aws, s3, ec2, lambda, dynamodb, sqs
GCP gcp, bigquery, gcs, google cloud, cloud storage
AZURE azure, blob.core.windows, cosmosdb
DATABASE postgres, mysql, mongo, redis, neon, supabase
SLACK slack
EMAIL sendgrid, mailgun, smtp
WEBHOOK webhook, http://

SDK structure

src/gemini_radar/
├── client.py               # RadarClient (single-key auth)
├── runner.py                 # Runner, RunConfig, RunResult
├── findings.py                # FindingEngine, Finding, Severity
├── relationships.py           # systemInstruction-based service relationship detection
├── models/base.py             # Pydantic v2 models for all resource types
├── scanners/                  # models.py, cached_contents.py, files.py, batches.py
├── exporters/                 # csv_exporter.py, drawio_exporter.py
└── cli.py                     # gemini-radar CLI

Part of the Hyperscaler Radar suite

aws-radar · gcp-radar · azure-radar · oci-radar · openai-radar · anthropic-radar · gemini-radar · datadog-radar · coreweave-radar

License

MIT

Metadata

Release files for gemini-radar 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gemini-radar 0.2.1
File Size Uploaded
gemini_radar-0.2.1.tar.gz 11.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gemini-radar 0.2.1
File Interpreter ABI Platform
gemini_radar-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.5 kB

Release files / gemini_radar-0.2.1.tar.gz

Download URL gemini_radar-0.2.1.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1d0fb65843f2cda999a61a66d838ca319d05e8c68c7f1bcb790f4f09f2c0b583
BLAKE2b-256 checksum
How to use checksums
23362db6b871d2258161004a9ac6fb12d98fabca1d0e2295733574961bd3eb55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / gemini_radar-0.2.1-py3-none-any.whl

Download URL gemini_radar-0.2.1-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41e29f84abac98271e9fba0d5be459c3d9b138b84a5cdc1c6fc0476f5c4125aa
BLAKE2b-256 checksum
How to use checksums
b98fcc58d02aba3c779c0ab9dbc74b70fcc2e1c604420804fc89ffb612f404cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page