All integrationsLLM Provider
Google Gemini Integration
Run Gemini 1.5/2.0 through the kit's OpenAI-compatible LLM layer.
Google's Gemini models expose an OpenAI-compatible chat completions endpoint. Point the kit's existing OpenAI provider at Gemini's compatibility URL and your llm.chat() calls work unchanged — no new provider code required.
Setup in 4 steps
- 1Add GEMINI_API_KEY to your .env file
- 2Set LLM_PROVIDER=openai and LLM_BASE_URL to Gemini's OpenAI-compatible endpoint
- 3Set LLM_MODEL to a Gemini model name (e.g. gemini-2.0-flash)
- 4Existing llm.chat() and streaming calls work unchanged
What's included
- Uses Gemini's official OpenAI-compatible chat completions API
- No new provider adapter needed — reuses the kit's OpenAI client config
- Streaming and token tracking behave the same as the OpenAI provider
- Useful for comparing Gemini's pricing/latency against GPT-4o or Claude
- Swap back to OpenAI or Anthropic by changing three env vars
Code example
# .env — Gemini via OpenAI-compatible endpoint
GEMINI_API_KEY=AIza...
LLM_PROVIDER=openai
LLM_BASE_URL=https://generativelanguage.googleapis.com/v1beta/openai/
LLM_MODEL=gemini-2.0-flash
# No code changes — same call as any other provider
response = await llm.chat(
messages=[{"role": "user", "content": prompt}],
stream=True,
)Full documentation: /docs/llm-providers
Google Gemini integration pre-wired and ready.
FastAPI AI Kit ships with Google Gemini configured out of the box. No manual setup required.
Ready to ship your AI backend this weekend?
Join developers who skipped weeks of boilerplate and went straight to building.
No subscriptions · One-time payment · Lifetime updates
