@nilskluewer/pi-vertex-gemini-search

Vertex AI Gemini grounded web search, research, and direct URL extraction tools for Pi, using Google Cloud Agent Platform credentials.

Packages

Package details

extension

Install @nilskluewer/pi-vertex-gemini-search from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@nilskluewer/pi-vertex-gemini-search
Package
@nilskluewer/pi-vertex-gemini-search
Version
0.2.0
Published
Aug 13, 2026
Downloads
264/mo · 26/wk
Author
nilskluewer
License
MIT
Types
extension
Size
37.8 KB
Dependencies
0 dependencies · 3 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions/vertex-gemini-search.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@nilskluewer/pi-vertex-gemini-search

Web search & research tools for the Pi coding agent, backed by Vertex AI Gemini with Google Search grounding and Google Cloud Agent Platform credentials.

This is a Vertex AI variant of the Gemini search extension. It does not use a Gemini API key.

Tools

Registers three tools the model can call:

  • web_search — quick fact-check / verification. Returns a concise synthesized answer + source URLs.
  • web_research — in-depth research on complex topics. Returns a structured answer with documentation details, code snippets, and source URLs.
  • web_fetch — reads one public webpage through Gemini url_context and extracts its substantive content into Markdown.

The search and research tools:

  • Ground answers with Google Search.
  • Can read specific URLs passed in the query via Gemini url_context.
  • Use high thinking for the configured Gemini 3.5 Flash-Lite and Gemini 3.6 Flash models.
  • Resolve Gemini vertexaisearch.cloud.google.com redirect links to clean destination URLs.
  • Render source URLs as OSC-8 terminal hyperlinks in the Pi TUI when supported by your terminal.
  • Prefix results with a compact, brutalist high-contrast Vertex AI provenance/cost summary in Pi TUI, including the actual flex pricing or standard pricing tier used for that call.

web_fetch uses URL Context only, without Google Search. It asks Gemini to:

Extract all information from this webpage into Markdown.

The result is model-generated Markdown, not a byte-for-byte copy of the original webpage.

Vertex AI authentication

Authentication order:

  1. VERTEX_ACCESS_TOKEN environment variable, if set
  2. gcloud auth print-access-token

Run this first if needed:

gcloud auth login

Configuration

Required:

  • VERTEX_PROJECT_ID — your Google Cloud project ID with Vertex AI enabled.

Defaults:

  • VERTEX_REGION=eu
  • GEMINI_MODEL_SHORT=gemini-3.5-flash-lite — model for web_search
  • GEMINI_MODEL_LONG=gemini-3.6-flash — model for web_research
  • GEMINI_MODEL_FETCH=gemini-3.1-flash-lite — model for web_fetch

web_search and web_research use Vertex Gemini thinking level HIGH. web_fetch uses the lower-cost fetch model without an explicit thinking level.

Set or override these environment variables before starting pi. The model IDs must be available in the configured Vertex region.

Cost estimate configuration

Each result includes a compact estimated cost summary, for example:

◆ Gemini Search [gemini-3.5-flash-lite, eu, €0.0131/$0.0141, 2 sources, standard pricing]

Defaults:

  • GEMINI_SEARCH_GROUNDING_USD_PER_1000=14
  • USD_TO_EUR=0.93
  • VERTEX_FLEX_TOKEN_DISCOUNT=0.5

The estimate uses response token counts from Vertex AI and approximate list token rates. Regional endpoint pricing may differ. URL Context results report token costs, but the estimate does not add a Google Search grounding charge because web_fetch does not use Google Search. Flex is preferred by default via the Vertex AI Flex PayGo headers. If the project or region does not support Flex, the extension falls back to the standard tier and reports standard pricing in that result.

Pricing-tier command

Use the Pi command below to inspect or change the pricing preference for the current session:

/search-pricing
/search-pricing flex
/search-pricing standard

flex is the default and falls back to standard when Flex is unavailable. standard bypasses Flex entirely. The command does not persist across Pi sessions.

Install

From npm:

pi install npm:@nilskluewer/pi-vertex-gemini-search

From a local checkout:

pi install /path/to/pi-vertex-gemini-search

License

MIT