Skip to main content
Google Gemini is the Generative AI provider package: generateContent / streaming for chat, and countTokens aligned with the same system-instruction handling as complete.

Why

Gemini fits when you want Google’s models in a multi-provider setup. List model ids such as gemini-2.0-flash in config and route with params.model like any other provider.

Setup

  1. Confirm apps/backend/package.json includes "tooling-ai-google": "workspace:*".
  2. Run make deps-install if needed.
  3. Add google under tools.ai in apps/backend/src/configuration/development.ts:
  1. No compose.yml changes are required — the Generative AI API is HTTP from the backend container.
  2. Add to .env.development (name your variable consistently in config; example):
  1. Verify:

Local observability

Gemini calls are visible through Refract instrumentation (ai logs and metrics). Google Cloud billing and quotas are managed in Google AI Studio / GCP consoles outside this repo.

Adding a new model id

  1. Append the model id to tools.ai.google.models.
  2. Set defaultModel when this id should be the fallback for omitted params.model (and Google is the primary loaded provider).
  3. Run make test module=tooling-ai-google.

Gotchas

  • System-role prompts are passed as systemInstruction on the generative model; conversation contents exclude system messages — keep prompts structured accordingly.
  • countTokens uses toGeminiConversationContents so counts match complete, not a duplicate system-as-user mapping.
  • Final stream chunk includes usage metadata; earlier chunks may show zero tokens until aggregation completes.

What’s next?