Skip to content

NextJS Template that uses LM Studio to leverage local compute and local LLM models

License

Notifications You must be signed in to change notification settings

afarhadi99/nextjs-chat-lmstudio

Repository files navigation

Next.js 14 and App Router-ready AI chatbot.

An open-source AI chatbot app template built with Next.js, the Vercel AI SDK, LMStudio, and Vercel KV.


Features

Requirements

Start Guide

  1. Go to LM Studio and download the latest release [https://lmstudio.ai/]
  2. Load a model in LM Studio. Pick one of the featured ones or download a model from HuggingFace [https://huggingface.co/]
  3. In LM Studio, turn on the API endpoint so that we can interact with it from our NextJS project
  4. Fork this repo and open it in your IDE
  5. Copy .env.example and rename it to .env
  6. In .env file change MODEL_NAME="LM Studio Community/Meta-Llama-3-8B-Instruct-GGUF" to the name of the model you have loaded into LM Studio and save the file
  7. Open Terminal and tun the following commands to install the dependencies and start the website locally
npm install pnpm -g
pnpm install
pnpm dev
  1. Open your browser and navigate to localhost:3000 where your app is running

Deploying to Vercel

To deploy to Vercel, you will need a few things. First, you will need to tunnel your LM Studio local API endpoint online in order to access it anywhere. This is not secure as LM Studio does not provide you with an API key. Anybody will be able to access your API endpoint.

Upload this project to GitHub as a private repo. Go to Vercel and add a new project using their GitHub integration. Add all the value from your .env file into the environment variables in Vercel.

Follow the steps outlined in the quick start guide provided by Vercel. This guide will assist you in creating and configuring your KV database instance on Vercel, enabling your application to interact with it.

Remember to update your environment variables (KV_URL, KV_REST_API_URL, KV_REST_API_TOKEN, KV_REST_API_READ_ONLY_TOKEN) in the .env file with the appropriate credentials provided during the KV database setup.

About

NextJS Template that uses LM Studio to leverage local compute and local LLM models

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages