Next.jsReactSaaS启动器

free-nextjs-ai-agent-boilerplate — Next.js SaaS模板

作者 emrahsinekli

基于 Next.js App Router、Tailwind CSS、TypeScript 和 Vercel AI SDK 的免费 AI 聊天界面模板,支持 token 流式输出、停止按钮和多家模型提供商切换。

看看你的网站会是什么样

浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。

2 个预览视图
桌面端首页1 / 2
桌面端截图首屏预览

由服务器浏览器实际访问页面后截取。

全部页面与视图 2

截图用于了解视觉与布局,交互效果请以实际项目为准。

采集于 2026-10-14查看来源

值得关注的模板亮点

从已有项目资料中,快速了解它的特点。

01

基于 Next.js App Router、Tailwind CSS、TypeScript 和 Vercel AI SDK 构建

02

支持逐 token 流式输出,并提供可用的停止按钮

03

通过 AI_PROVIDER 环境变量在 Anthropic、OpenAI 和 Google 之间切换

04

API 密钥仅在服务端使用,不会暴露到浏览器

05

MIT 许可,README 说明可商用且无需署名

06

README 提供自定义系统提示词、主题颜色和添加工具调用的示例

模板详细介绍

这是一个 MIT 许可的免费 AI 聊天 UI 模板,README 说明其使用 Next.js 16(App Router)、Tailwind CSS v4、TypeScript 和 Vercel AI SDK v5 构建。核心功能包括逐 token 流式输出、可用的停止按钮,以及通过环境变量在 Anthropic、OpenAI 和 Google 之间切换提供商。项目结构清晰:src/app/api/chat/route.ts 提供流式 POST 端点,src/components/chat.tsx 包含完整聊天界面,src/lib/model.ts 集中管理模型名称与系统提示词。README 明确说明该免费仓库不包含认证、数据库和支付功能,这些属于其商业版本 AgentShipKit;同时说明 API 密钥仅保留在服务端,不会发送到浏览器。

使用方式为克隆仓库、安装依赖、复制 .env.example 到 .env.local,并配置 AI_PROVIDER 及对应提供商的 API 密钥和模型名称,然后运行 npm run dev。README 还提供了自定义系统提示词、通过 OKLCH 主题令牌调整颜色、以及使用 AI SDK 的 tool 函数添加工具调用的示例。部署方面,README 说明可推送到 GitHub 后在 Vercel 导入并配置环境变量。README 未提供关于测试、可访问性、浏览器兼容性或性能的说明。

Next.jsSaaS启动器

适合你的项目吗?

适用场景

  • 搭建一个可流式输出的 AI 聊天界面原型
  • 在 Anthropic、OpenAI 和 Google 模型之间切换进行对比测试
  • 作为学习 Vercel AI SDK useChat 与 streamText 用法的起点
  • 在 Vercel 上部署一个仅含聊天 UI 的演示应用

适合人群

  • 需要免费 AI 聊天 UI 基础代码的开发者
  • 使用 Next.js App Router 和 TypeScript 的项目
  • 希望自行接入认证、数据库或支付功能的团队
  • 想了解 Vercel AI SDK 流式聊天实现方式的读者

上手与定制指南

结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。

  1. 1

    克隆仓库后运行 npm install,并将 .env.example 复制为 .env.local

  2. 2

    在 .env.local 中设置 AI_PROVIDER(anthropic、openai 或 google)及对应提供商的 API 密钥和模型名称

  3. 3

    运行 npm run dev 后访问 http://localhost:3000

  4. 4

    部署到 Vercel 时需在项目设置中添加 AI_PROVIDER 和 API 密钥环境变量

  5. 5

    README 说明该免费仓库不包含认证、数据库和支付功能

查看仓库使用说明

授权与来源资料

使用条件与限制

免费使用 · 保留许可声明

本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。

使用时需要遵守

  • 允许免费使用、修改、商用和分发该版本代码。
  • 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
  • 代码按现状提供;担保与责任限制以原许可证及适用法律为准。

额外费用与待核对事项

  • 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
  • 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
  • 需要设置 AI_PROVIDER 环境变量,并选择 anthropic、openai 或 google 之一。
  • 使用 Anthropic 提供商时必须配置 ANTHROPIC_API_KEY,需要自行申请 API 密钥。
  • 需要指定 ANTHROPIC_MODEL 模型名称,例如 claude-sonnet-5。
  • 使用 Anthropic 需前往 console.anthropic.com 获取 API 密钥。
  • 使用 OpenAI 需前往 platform.openai.com 获取 API 密钥。
  • 使用 Google 需前往 aistudio.google.com 获取 API 密钥。
  • 免费仓库不包含认证和数据库功能,这些属于付费的 premium kit。
  • 如需使用本地模型(Ollama、LM Studio),需自行添加 @ai-sdk/openai-compatible 并配置本地端点。
  • Supabase Auth 等认证功能仅在付费的 AgentShipKit 中提供,免费仓库不包含。
  • Polar / Stripe 支付功能仅在付费的 AgentShipKit 中提供,免费仓库不包含。
  • 终身更新属于付费 AgentShipKit 的权益,免费仓库不提供。
查看原文依据

Permission is hereby granted, free of charge

许可证原文

AI_PROVIDER=anthropic # anthropic | openai | google

README 原文

ANTHROPIC_API_KEY=sk-ant-...

README 原文

ANTHROPIC_MODEL=claude-sonnet-5

README 原文

| Anthropic | [console.anthropic.com](https://console.anthropic.com/settings/keys) | `ANTHROPIC_API_KEY` |

README 原文

| OpenAI | [platform.openai.com](https://platform.openai.com/api-keys) | `OPENAI_API_KEY` |

README 原文

| Google | [aistudio.google.com](https://aistudio.google.com/app/apikey) | `GOOGLE_GENERATIVE_AI_API_KEY` |

README 原文

**Why is there no auth or database?** Because that's the hard part, and it's the [premium kit](https://agentshipkit.com). This repo is the honest, useful free half.

README 原文

**Does it work with local models (Ollama, LM Studio)?** Add `@ai-sdk/openai-compatible` and point it at your local endpoint in `src/lib/model.ts`.

README 原文

- ✅ **Supabase Auth** — Google login, sessions, RLS policies, ready

README 原文

- ✅ **Polar / Stripe payments** — checkout + webhooks + entitlement, wired

README 原文

- ✅ **Lifetime updates** — one payment, forever

README 原文
https://github.com/emrahsinekli/free-nextjs-ai-agent-boilerplate/blob/main/LICENSEhttps://github.com/emrahsinekli/free-nextjs-ai-agent-boilerplate/blob/main/README.md

DeepSeek 根据仓库许可证和 README 整理 ·2026-10-14。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。

项目核对记录与介绍依据

模板资料

来源平台
GitHub
资料与维护参考分
资料较完整 · 85 / 100
技术栈
Next.js · React
网站类型
SaaS · 启动器
这个分数如何计算

本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。

这个项目需要核对什么

记录的仓库更新时间
2026-07-12
截图检查日期
2026-10-14

已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。

目录记录的主要技术栈是 Next.js。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。

查看具体选型方法 →

介绍的制作与核对状态

介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。

审核声明: codex-user-requested-batch-review-20261015 · 2026-10-15

查看当时使用的来源资料

SHA-256: 4474b80f8d7f5ab62597a64f797ed36777dcd99cc969c5a4a1646ee3dc0b91e0

2026-10-14T22:25:12.837Z

来源文件 / 仓库
# Free Next.js AI Agent Boilerplate

A clean, production-grade **AI chat UI** built with **Next.js 16 (App Router)**, **Tailwind CSS v4**, **TypeScript** and the **Vercel AI SDK v5**. Token streaming, stop button, provider switching — no bloat, no vendor lock-in.

> ### 🚀 Need Auth, Database and Payments too?
> Don't waste 2 weeks wiring Supabase, Stripe/Polar and a dashboard from scratch.
> **[Get the full commercial-ready boilerplate at agentshipkit.com →](https://agentshipkit.com)**

![License](https://img.shields.io/badge/license-MIT-green) ![Next.js](https://img.shields.io/badge/Next.js-16-black) ![AI SDK](https://img.shields.io/badge/AI%20SDK-v5-blue)

---

## What's inside

| | |
|---|---|
| 💬 **Streaming chat UI** | Real token-by-token streaming with a working stop button |
| 🔌 **Provider-agnostic** | Anthropic, OpenAI or Google — swap with one env var, not a refactor |
| 🎨 **Tailwind v4** | Dark, modern, responsive. No component library to fight |
| 🧠 **AI SDK v5** | `useChat` + `streamText`, the current API — not a stale v3 tutorial |
| 📦 **Zero backend** | One route handler. Deploy to Vercel in a click |
| 🔒 **Keys stay server-side** | The API key never reaches the browser |

## Quick start

```bash
git clone https://github.com/emrahsinekli/free-nextjs-ai-agent-boilerplate.git
cd free-nextjs-ai-agent-boilerplate
npm install
cp .env.example .env.local
```

Open `.env.local` and set **one** provider:

```bash
AI_PROVIDER=anthropic          # anthropic | openai | google
ANTHROPIC_API_KEY=sk-ant-...
ANTHROPIC_MODEL=claude-sonnet-5
```

Then:

```bash
npm run dev
```

Open <http://localhost:3000>. That's it — you have a streaming AI chat app.

### Get an API key

| Provider | Where | Env var |
|---|---|---|
| Anthropic | [console.anthropic.com](https://console.anthropic.com/settings/keys) | `ANTHROPIC_API_KEY` |
| OpenAI | [platform.openai.com](https://platform.openai.com/api-keys) | `OPENAI_API_KEY` |
| Google | [aistudio.google.com](https://aistudio.google.com/app/apikey) | `GOOGLE_GENERATIVE_AI_API_KEY` |

## Project structure

```
src/
├── app/
│   ├── api/chat/route.ts    # Streaming endpoint (POST)
│   ├── layout.tsx
│   ├── page.tsx
│   └── globals.css          # Tailwind v4 theme tokens
├── components/
│   └── chat.tsx             # The whole chat UI, one file, readable
└── lib/
    └── model.ts             # Provider switch — the only place models are named
```

## Customising

**Change the system prompt** — `src/lib/model.ts`:

```ts
export const SYSTEM_PROMPT = "You are a sarcastic pirate. Answer in one sentence.";
```

**Change the colours** — `src/app/globals.css`. The whole theme is six OKLCH tokens.

**Add tools (function calling)** — `src/app/api/chat/route.ts`:

```ts
import { tool } from "ai";
import { z } from "zod";

const result = streamText({
  model: getModel(),
  system: SYSTEM_PROMPT,
  messages: convertToModelMessages(messages),
  tools: {
    weather: tool({
      description: "Get the weather for a city",
      inputSchema: z.object({ city: z.string() }),
      execute: async ({ city }) => ({ city, tempC: 21 }),
    }),
  },
});
```

## Deploy

Push to GitHub, import the repo on [Vercel](https://vercel.com/new), and add your `AI_PROVIDER` + API key as environment variables. Done.

## FAQ

**Is this really free?** Yes. MIT licensed. Use it commercially, no attribution required.

**Why is there no auth or database?** Because that's the hard part, and it's the [premium kit](https://agentshipkit.com). This repo is the honest, useful free half.

**Does it work with local models (Ollama, LM Studio)?** Add `@ai-sdk/openai-compatible` and point it at your local endpoint in `src/lib/model.ts`.

---

## 🚀 Ship the whole SaaS, not just the chat box

This repo gives you the UI. **[AgentShipKit](https://agentshipkit.com)** gives you the business:

- ✅ **Supabase Auth** — Google login, sessions, RLS policies, ready
- ✅ **Polar / Stripe payments** — checkout + webhooks + entitlement, wired
- ✅ **Multi-agent dashboard** — agent runs, tool traces, streaming logs
- ✅ **Agent engine** — tool-calling loop, multi-step orchestration
- ✅ **SEO-ready landing page** — metadata, sitemap, JSON-LD
- ✅ **Lifetime updates** — one payment, forever

### [→ Download the Premium Agent Kit at agentshipkit.com](https://agentshipkit.com)

---

MIT © AgentShipKit

<sub>Keywords: nextjs ai agent template · ai agent boilerplate · ai agent starter kit · nextjs chatgpt clone · vercel ai sdk template · react ai chat ui · typescript llm starter</sub>
反馈内容错误

看看同类模板

对比同技术栈与用途的模板,找到更适合的视觉与内容结构。