Skip to content

Repository files navigation

Next-Ollama-Chat

![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.

✨ Features

  • 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

🚀 Getting Started

Prerequisites

Installation

  1. Clone the repository

    git clone https://github.com/sattarrasouli/ollama-chat-stream.git
    cd ollama-chat-stream
  2. Install dependencies

    npm install
    # or
    yarn install
    # or
    pnpm install
  3. Start the development server

    npm run dev
    # or
    yarn dev
    # or
    pnpm dev
  4. Open http://localhost:3000 in your browser

🔧 Configuration

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.

📋 API Usage

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"
}

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

About

Lightweight Next.js proxy for local Ollama LLM, enabling real-time AI chat with streaming responses and easy model switching.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages