A SvelteKit chat application powered by TanStack AI.
- 🎯 Multiple AI providers (OpenAI, Anthropic, Gemini, Ollama)
- 🛠️ Tool execution (client-side and server-side)
- ✅ Tool approval workflow
- 🎸 Guitar recommendation example
- 💭 Thinking process visualization
- 🎨 Modern UI with Tailwind CSS
- Install dependencies:
pnpm install- Set up environment variables:
If .env doesn't exist, copy from the example:
cp env.example .envThen edit .env and add your API keys:
OPENAI_API_KEY=sk-your-actual-key-here
ANTHROPIC_API_KEY=sk-ant-your-actual-key-here
GEMINI_API_KEY=your-actual-key-hereImportant Notes:
- The
.envfile must be in the project root (examples/ts-svelte-chat/.env) - You must restart the dev server after creating or modifying
.env - Environment variables in SvelteKit are loaded at server startup
- These are server-side only variables (not exposed to the browser)
- Start (or restart) the development server:
pnpm devThis example demonstrates:
- @tanstack/ai-svelte: Svelte 5 hooks for chat functionality
- SvelteKit: Full-stack framework with API routes
- Streaming: Real-time response streaming
- Tools: Both client-side and server-side tool execution
- Approvals: Tool approval workflow
MIT