Skip to content

Connect Gemini on Vertex AI

The gemini preset registers Gemini 3.8 Flash and Gemini 3.5 Flash Lite on Google Cloud's Vertex AI. It takes no API key: calls use your Google Cloud credentials, and Vertex AI runs and bills them in a project you name.

Terminal window
gcloud auth application-default login

That writes your Application Default Credentials (~/.config/gcloud/application_default_credentials.json). The account needs access to Vertex AI in the project.

kindgi dev gives the runtime Google credentials only when you say which, with KINDGI_DEV_GOOGLE_CREDENTIALS in the pack's .env (or .env.local, for a path that's only yours), or in the shell:

.env
KINDGI_DEV_GOOGLE_CREDENTIALS=adc

adc is the login above. An absolute path names another credentials file, such as a service-account key, and off (the default) gives none. kindgi dev mounts the file read-only, and names it and whose it is when it starts:

✓ Google credentials: /Users/you/.config/gcloud/application_default_credentials.json (your gcloud application-default login, a user account), mounted read-only for Vertex AI

Without the setting, a gemini provider has no credentials and its calls fail. kindgi dev says so when it starts, and kindgi doctor says the same:

⚠ Provider gemini (Vertex AI) has no Google credentials: set KINDGI_DEV_GOOGLE_CREDENTIALS=adc (or a credentials file), in the pack's .env or the shell, and restart kindgi dev.

A GOOGLE_APPLICATION_CREDENTIALS in your shell isn't used unless you name it: KINDGI_DEV_GOOGLE_CREDENTIALS=$GOOGLE_APPLICATION_CREDENTIALS.

Terminal window
kindgi providers register --preset=gemini --project=<gcp-project>

--project is the Google Cloud project Vertex AI runs and bills in; the preset refuses to register without it:

Error: preset "gemini" needs --project=<…> (The Google Cloud project Vertex AI bills and authorises against.)

--models registers only some of the models:

Terminal window
kindgi providers register --preset=gemini --project=<gcp-project> --models=gemini-3.8-flash

The preset's models answer with up to 65,536 tokens, thinking included. --max-output-tokens=<n> registers them with another limit.

To have kindgi dev register it on every boot, declare it in the pack's config instead: { preset: 'gemini', project: '<gcp-project>' } in kindgi.config.ts's providers, or a [[tool.kindgi.providers]] table with preset = "gemini" and project = "<gcp-project>" in pyproject.toml. See Declare them in your pack's config.

{
"providerId": "gemini"
}
✓ Registered gemini: gemini-3.8-flash (default)
Terminal window
kindgi providers get gemini

The provider's id is gemini and its region global, where Vertex AI serves Gemini 3.8 Flash (it isn't served from us-central1). Both models list tool-use, structured-output and long-context:

Model Context window Per 1K input / output tokens
gemini-3.8-flash (default) 1,048,576 $0.00075 / $0.00375
gemini-3.5-flash-lite 1,048,576 $0.0003 / $0.0025
  • Gemini 3.8 Flash thinks before it answers, and Vertex AI bills the thinking as output tokens. Kindgi counts them in the turn's output tokens and its cost: in a check on 2026-10-07, a one-word answer used 94 output tokens, 93 of them thinking. Gemini 3.5 Flash Lite answered without thinking.
  • Its price is Google's launch price, through 2026-12-31. From 2027-01-01 Google charges $0.0015 / $0.0075 per 1K tokens, and a turn's totalCostUsd still uses the price the provider was registered with.

To send an agent to Gemini when other providers are registered too, set preferredProvider: 'gemini' (preferred_provider="gemini" in Python), or require it: see Choose the model an agent uses.

Earlier releases' preset registered gemini-2.5-pro and gemini-2.5-flash. Vertex AI retires both on 2026-10-20; after that, a turn routed to them fails. Move to this release's CLI, then:

  • A provider you registered with kindgi providers register: unregister it and register the preset again (a registration can't be edited):

    Terminal window
    kindgi providers unregister gemini
    kindgi providers register --preset=gemini --project=<gcp-project>
  • A provider the pack's config declares: restart kindgi dev. It registers the preset's new models in place of the old ones:

    Providers from kindgi.config.ts:
    ✓ gemini: registered again (changed in kindgi.config.ts)

    A declaration whose models names a Gemini 2.5 model stops kindgi dev from starting, as --models does with kindgi providers register. Name one of the new models instead:

    kindgi dev: `providers` in kindgi.config.ts: entry 1: preset "gemini" has no model gemini-2.5-flash — it has gemini-3.8-flash, gemini-3.5-flash-lite

An agent that prefers or requires a Gemini 2.5 model needs a new version that names one of these: a preference falls to the next model in line, and a requirement matches nothing.

A deployed runtime has no login of yours: it calls Vertex AI as its own service account (on Cloud Run, the service's). That account needs roles/aiplatform.user in the project, and the project needs the Vertex AI API turned on. Without the role, every model call fails with Permission 'aiplatform.endpoints.predict' denied. Deploy on Google Cloud Run sets this up.