![Next-Ollama-Chat]
A streamlined bridge between your Next.js frontend and local Ollama LLM server, enabling real-time AI chat capabilities with minimal latency.
- Real-time streaming - See AI responses as they're generated
- Local processing - All data stays on your machine
- Model switching - Easily swap between any Ollama model
- Lightweight - Minimal overhead with efficient proxying
-
Clone the repository
git clone https://github.com/sattarrasouli/ollama-chat-stream.git cd ollama-chat-stream -
Install dependencies
npm install # or yarn install # or pnpm install
-
Start the development server
npm run dev # or yarn dev # or pnpm dev
-
Open http://localhost:3000 in your browser
By default, the application connects to Ollama at http://localhost:11434. If your Ollama instance is running elsewhere, update the URL in app/api/chat/route.ts.
Send a POST request to /api/chat with the following JSON structure:
{
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "Hello, how are you?" }
],
"model": "tinyllama" // Optional, defaults to "tinyllama"
}This project is licensed under the MIT License - see the LICENSE file for details.