FastAPI integration guides
Provider-specific setup, code examples, and implementation guidance for production FastAPI backends.
Most AI backends spend their first few days just wiring up third-party services — reading provider docs, handling auth, writing retry logic. FastAPI AI Kit ships each of the integrations below already connected: the client is configured, the environment variables are documented, and the error handling is written. You add your own API keys and the integration works the same day you clone the repo.
LLM Provider
OpenAI
FastAPI AI Kit ships with a pre-wired OpenAI integration. Drop in your API key and you're streaming GPT-4o responses with token tracking from your first endpoint.
Integration guideAnthropic
Switch to Anthropic Claude with a single environment variable change. The kit's unified LLM abstraction handles Claude's message format, streaming protocol, and token counting automatically.
Integration guideGoogle Gemini
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.
Integration guideGroq
Groq exposes an OpenAI-compatible API for open-weight models running on their LPU hardware. Point the kit's LLM base URL at Groq's endpoint for dramatically faster token generation on supported models.
Integration guideOpenRouter
OpenRouter proxies dozens of providers behind a single OpenAI-compatible API. Useful when you want per-request model selection without managing separate API keys for every provider.
Integration guideDatabase
PostgreSQL
FastAPI AI Kit uses SQLAlchemy 2.0 async with PostgreSQL. Alembic migrations, connection pooling, pgvector for embeddings, and JSONB for flexible storage — all configured.
Integration guideSupabase
FastAPI AI Kit works seamlessly with Supabase. Point DATABASE_URL at your Supabase Postgres instance and everything — SQLAlchemy, Alembic migrations, pgvector — works out of the box. Optionally use Supabase Auth and Storage instead of the kit's built-in layers.
Integration guideNeon
Neon is standard PostgreSQL under the hood, including the pgvector extension. Point DATABASE_URL at your Neon connection string and SQLAlchemy, Alembic migrations, and the RAG pipeline all work exactly as they do against self-hosted Postgres.
Integration guideCache & Queue
Redis
Redis powers three distinct systems in FastAPI AI Kit: per-key rate limiting, session/response caching, and the Celery task queue for background jobs. All configured with sensible defaults.
Integration guideUpstash Redis
Upstash speaks the standard Redis protocol over TLS, so it's a genuine drop-in replacement for self-hosted Redis. Point REDIS_URL at your Upstash instance and rate limiting, caching, and Celery's broker all work unchanged.
Integration guideVector Store
Qdrant
FastAPI AI Kit supports both pgvector and Qdrant for vector storage. Switch between them by changing VECTOR_STORE in your config — no code changes required.
Integration guidePinecone
FastAPI AI Kit ships pgvector and Qdrant adapters behind a common RAG interface. Pinecone isn't a pre-wired option, but implementing a third adapter against the same interface is a well-defined, contained change if you're already committed to Pinecone.
Integration guideChromaDB
ChromaDB runs embedded or as a lightweight local service, making it a convenient option for local development or small single-node deployments where running Postgres or Qdrant feels like overkill.
Integration guideDeployment
Railway
FastAPI AI Kit ships with a Railway-ready Dockerfile and deploy guide. Postgres, Redis, and the FastAPI worker all deploy with `railway up` — environment variables are the only config needed.
Integration guideRender
The included render.yaml blueprint provisions your FastAPI service, Postgres database, and Redis instance in one click. Alembic migrations run automatically on each deploy.
Integration guideBackground Jobs
Celery
FastAPI AI Kit ships with Celery + Redis pre-configured. Offload long-running LLM chains, document processing, or email sending to workers — with retry logic and failure handling.
Integration guideTemporal
The kit ships Celery + Redis for background jobs, which covers most async LLM/RAG workloads well. Temporal is a heavier alternative worth considering when workflows involve many steps, long-running human-in-the-loop waits, or need guaranteed exactly-once execution semantics.
Integration guideAuthentication
Better Auth
FastAPI AI Kit's built-in auth is JWT + API keys, aimed at API-to-API and programmatic access. Better Auth is a TypeScript auth library for user-facing sign-in flows (OAuth, passkeys, magic links). The two solve different problems and typically sit at different layers.
Integration guideClerk
Clerk handles user-facing authentication (sign-up, sign-in, session management, orgs). FastAPI AI Kit's JWT + API key system handles backend API access. Most teams run both: Clerk in front, kit-issued API keys behind it.
Integration guideAuth0
Auth0 is a strong fit when you need enterprise SSO, SAML, or complex identity federation for human users. FastAPI AI Kit's JWT/API-key layer stays focused on what it's built for: authenticating and rate-limiting programmatic API calls.
Integration guideStorage
AWS S3
FastAPI AI Kit's document ingestion endpoints accept file uploads and hand them to the RAG pipeline; where the raw file itself is persisted is left to you. S3 is the most common choice for durable, cheap object storage in production.
Integration guideCloudflare R2
R2 implements the S3 API, so the same upload code you'd write for AWS S3 works against R2 with just an endpoint change. The main draw is eliminating egress costs, which matter if your RAG pipeline re-reads source documents frequently.
Integration guideModel Hosting
Replicate
Replicate hosts thousands of community and custom models behind a simple HTTP API. It's a reasonable fit when you need a model outside the kit's built-in OpenAI/Anthropic layer — image generation, fine-tuned open models, or niche inference tasks.
Integration guideFal.ai
Fal.ai specializes in low-latency inference for diffusion and generative media models. If your product needs image or video generation alongside the kit's text LLM features, Fal's API is a common pairing, called from a background worker like any other long-running job.
Integration guideRunPod
RunPod rents GPU pods for self-hosted model inference — useful when you're running a fine-tuned or open-weight model yourself for cost, latency, or data residency reasons rather than calling a hosted API.
Integration guide