All integrationsLLM Provider
OpenAI Integration
Connect to GPT-4o and the full OpenAI API in minutes.
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.
Setup in 4 steps
- 1Add OPENAI_API_KEY to your .env file
- 2Set LLM_PROVIDER=openai in config
- 3Call llm.chat() — streaming works automatically
- 4Token usage tracked per request for Stripe metering
What's included
- GPT-4o, GPT-4, GPT-3.5-turbo — switch with one env var
- Streaming SSE responses built in (no custom wiring)
- Per-request token tracking for cost visibility and billing
- Automatic retry with exponential backoff on rate limits
- System prompt configuration per endpoint
Code example
# .env
OPENAI_API_KEY=sk-...
LLM_PROVIDER=openai
LLM_MODEL=gpt-4o
# Streaming chat endpoint — works out of the box
response = await llm.chat(
messages=[{"role": "user", "content": prompt}],
stream=True,
track_tokens=True, # feeds billing metering
)Full documentation: /docs/llm-providers
OpenAI integration pre-wired and ready.
FastAPI AI Kit ships with OpenAI 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
