Google Gemini (AI Studio)
The fastest path to Gemini — API key only, no GCP project required. Use this for quick testing or when you don't have GCP set up.
For enterprise / regulated workloads, prefer Vertex AI (data stays in your GCP project, IAM-governed).
Configuration
~/.insightworker/.env:
LLM_PROVIDER=gemini
GEMINI_API_KEY=AIza...
GEMINI_MODEL=gemini-2.0-flash-001
Get an API key
- Visit aistudio.google.com/apikey
- Sign in with your Google account
- Create API key — pick or create a project
- Copy the key (starts with
AIza)
Recommended models
| Use case | Model |
|---|---|
| General apps, tool use | gemini-2.0-flash-001 |
| Long context, hard reasoning | gemini-2.5-pro (2M context!) |
| Cheap classification | gemini-2.0-flash-lite |
Gemini 2.5 Pro has a 2 million token context window — useful for apps that need to load lots of documents at once. InsightWorker's per-model output cap scales accordingly (~800k chars).
Where data goes
AI Studio is a consumer-tier endpoint. Prompts go to Google's cloud, governed by Google AI Studio's data terms. For regulated workloads, use Vertex AI instead (same models, in your GCP project).
Tool calling and schema
Gemini's function-calling schema is OpenAPI 3.0-ish — stricter than full JSON Schema. InsightWorker sanitizes tool schemas automatically (strips $ref, oneOf, additionalProperties and other features Gemini doesn't support).
If a custom tool fails on Gemini but works on OpenAI, the issue is likely an unsupported schema feature. Simplify the input_schema (avoid $ref and oneOf) and re-test.
Common gotchas
| Symptom | Cause | Fix |
|---|---|---|
| 400 on tool call | Schema feature not supported by Gemini | Simplify your tool's input_schema |
| 429 rate-limited | Free tier quota | Add a paid tier or switch to Vertex |
| Empty content with tool calls | Gemini sometimes returns tool-only responses | Agent handles this; if visible to you, it's a bug — file an issue |
See also
- vertex-ai.md — same Gemini models in your GCP project
- authentication/google-cloud.md — for the Vertex auth flow
- overview.md — full provider matrix
Source: docs/providers/gemini-ai-studio.md in the public repo. Open a PR with corrections.
