尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
Streaming LLM chat in Next.js 15 + TypeScript — Groq/OpenAI-compatible API, summarise mode, Markdown rendering, Vercel deploy
翻譯準備中
正在載入完整 README。 以下為已儲存的摘錄。
StreamChat is a minimal chat app that streams answers from an LLM token by token. It is built with the Next.js App Router, TypeScript and Tailwind CSS, talks to any OpenAI-compatible API through the openai SDK, and runs the chat endpoint on the Vercel Edge runtime. Responses can be stopped mid-stream, assistant replies are rendered as Markdown, and the conversation is kept in localStorage so it survives a refresh.
• Next.js App Router
• TypeScript
• Tailwind CSS
• OpenAI-compatible API (Groq by default, via the openai SDK)
• GitHub Actions CI (lint, type-check, build)
• Vercel檢視完整 README ↗StreamChat is a minimal chat app that streams answers from an LLM token by token. It is built with the Next.js App Router, TypeScript and Tailwind CSS, talks to any OpenAI-compatible API through the openai SDK, and runs the chat endpoint on the Vercel Edge runtime. Responses can be stopped mid-stream, assistant replies are rendered as Markdown, and the conversation is kept in localStorage so it survives a refresh.
Live: https://streamchat-nextjs.vercel.app
openai SDK)ReadableStream)AbortController)react-markdown)localStorage (survives page refresh)Requires Node.js 20+.
git clone https://github.com/Yashashviarora/streamchat-nextjs.git
cd streamchat-nextjs
npm install
Create .env.local in the project root with the required environment variables:
| Variable | Required | Description |
|---|---|---|
LLM_API_KEY | yes | API key for your LLM provider |
LLM_BASE_URL | yes | Base URL of an OpenAI-compatible API |
LLM_MODEL | yes | Model name to send requests to |
Example (Groq):
LLM_API_KEY=your_key_here
LLM_BASE_URL=https://api.groq.com/openai/v1
LLM_MODEL=openai/gpt-oss-20b
Then start the dev server:
npm run dev
Open http://localhost:3000.
The same checks CI runs on every push:
npm run lint
npx next typegen && npx tsc --noEmit
npm run build
The API route uses the openai SDK, which works with any OpenAI-compatible API. Switch providers by changing env vars only — no code changes:
| Provider | LLM_BASE_URL | LLM_MODEL (example) |
|---|---|---|
| Groq | https://api.groq.com/openai/v1 | openai/gpt-oss-20b |
| OpenAI | https://api.openai.com/v1 | gpt-4o-mini |
Set LLM_API_KEY to the matching provider's key and restart the dev server.
LLM_API_KEY, LLM_BASE_URL, and LLM_MODEL..env.local is never committed; production reads the variables from Vercel's dashboard.