Feature Guide
How to build
AI / LLM Integration
Adding AI features to your SaaS: chat, content generation, RAG, embeddings, and AI-powered workflows.
intermediate
1–3 weeks (manual)
2–5 days (with AI)
Best tools to use
[01]
Vercel AI SDK
Streaming AI responses with React hooks. Supports OpenAI, Anthropic, and more.
[02]
LangChain
Framework for chaining LLM calls, RAG, and agents. Large ecosystem.
[03]
OpenAI API direct
Direct API calls for simple use cases. Chat completions and embeddings.
[04]
Anthropic Claude API
Claude models via API. Great for long-context and reasoning tasks.
[05]
Ollama
Run open-source LLMs locally. Good for privacy-sensitive applications.
Key considerations
- ✓Use streaming responses — users hate waiting for full completions
- ✓Implement token usage tracking and rate limiting per user/plan
- ✓Cache common AI responses to reduce costs
- ✓Use RAG (Retrieval Augmented Generation) instead of fine-tuning for most use cases
- ✓Set up fallback providers — if OpenAI is down, route to Anthropic
Common mistakes
- ✗Not streaming responses (poor UX with loading spinners)
- ✗No usage limits — one user can burn your entire API budget
- ✗Sending too much context (expensive and slow)
- ✗Not caching repeated queries
- ✗Using fine-tuning when RAG would work better and cheaper
Products that nailed this
Cursor
Jasper
Copy.ai
Perplexity
Related features
Skip the research.
SassCloner generates implementation specs for ai / llm integration — including database schema, API routes, and UI components. Paste into Cursor and start building.
Generate My PRD