通过远程 MCP 自动发现并调用 RoxyAPI 的计算工具,而非依赖 LLM 编造占星数据
astrology-ai-chatbot — Next.js 启动器模板
作者 RoxyAPI
基于 Next.js 的 AI 占星聊天机器人启动器,通过远程 MCP 调用 RoxyAPI 的真实计算工具,覆盖西方占星、吠陀占星、塔罗、命理等多个领域。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 3
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
默认启用 18 个产品、约 255 个工具,覆盖 17 个灵性领域及地点地理编码
支持 Google Gemini、Anthropic Claude、OpenAI GPT 三种 LLM 提供商,通过环境变量切换
工具调用结果可在聊天回复中渲染为可视化组件,如塔罗牌面与本命盘轮盘
提供明暗主题、可折叠会话列表,组件样式通过 --roxy-* 设计令牌跟随应用调色板
采用 MIT 许可,公开代码可免费使用、修改、商用和分发
模板详细介绍
这是一个开源的 AI 占星聊天机器人启动器,使用 Next.js 构建。它的核心思路是让大语言模型负责理解与解读,而把行星位置、塔罗牌面、命理计算等交给 RoxyAPI 通过远程 MCP(Model Context Protocol)提供的真实计算工具完成,以避免模型凭空编造数据。项目在运行时自动发现 RoxyAPI 的工具,默认启用全部 18 个产品、约 255 个工具,覆盖西方占星、吠陀占星、预测时间线、人类图、中国八字、风水、中美洲占星、Vastu、数字命理、卡巴拉、塔罗、生物节律、阿育吠陀、易经、水晶、梦境、天使数字以及地点地理编码。
使用前需要配置两类密钥:RoxyAPI 的 API Key,以及至少一个 LLM 提供商的密钥。项目通过 Vercel AI SDK 的统一接口支持 Google Gemini、Anthropic Claude 和 OpenAI GPT,切换提供商只需修改环境变量。聊天界面支持明暗主题、可折叠会话列表,并能根据模型调用的工具在回复气泡中渲染对应的可视化组件,例如塔罗牌面和本命盘轮盘;这些组件由 @roxyapi/ui-react 按工具名映射,样式通过 --roxy-* 设计令牌跟随应用调色板。
项目采用 MIT 许可,公开仓库中的代码可免费使用、修改、商用和分发,但外部服务(RoxyAPI、LLM 提供商、域名、托管等)可能另行收费,演示图片、字体、图标等第三方素材需单独核对许可。README 中提到的部分付费版本或功能不包含在本次收录的免费代码内。
适合你的项目吗?
适用场景
- 搭建面向用户的 AI 占星或灵性咨询聊天应用
- 验证 MCP 工具调用与 LLM 解读结合的聊天机器人架构
- 需要真实天文与命理计算而非模型生成内容的占星类产品原型
- 在 Next.js 项目中集成 RoxyAPI 的多领域计算工具与可视化组件
适合人群
- 熟悉 Next.js 并希望快速启动占星聊天应用的开发者
- 需要接入真实占星计算数据、避免 LLM 幻觉的团队
- 计划使用 RoxyAPI 与 MCP 构建多领域灵性工具产品的项目
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
克隆仓库后执行 npm install,复制 .env.example 为 .env.local 并填入密钥
- 2
需要 RoxyAPI API Key,用于所有占星与命理计算
- 3
需要至少一个 LLM 提供商密钥(Google、Anthropic 或 OpenAI),并通过 LLM_PROVIDER 环境变量选择
- 4
可通过 ROXYAPI_PRODUCTS 环境变量启用部分产品;启用占星类图表产品时建议同时保留 location 以解析出生地坐标
- 5
外部服务(RoxyAPI、LLM、托管等)可能产生费用,第三方素材需单独核对许可
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 使用前必须配置两类密钥:RoxyAPI 的 API Key 以及至少一个 LLM 提供商(Google、Anthropic 或 OpenAI)的密钥,否则无法运行。
- 所有占星、塔罗、命理等计算均依赖 RoxyAPI 外部服务,需按其定价获取 API Key,可能产生费用。
- 解读功能依赖外部 LLM 提供商(Google、Anthropic 或 OpenAI),需相应账号与 API Key,可能产生调用费用。
- 在 Vercel Hobby 计划(10 秒限制)下可能因 MCP 初始化超时而运行不稳定,需升级到 Pro 或减少启用的产品数量。
- RoxyAPI 的免费测试密钥需通过联系页面申请,并非默认提供;正式使用需按其定价付费。
- 项目资料提及可选付费版本或功能;本次仅收录公开免费代码,不包含付费升级。
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
You need two keys:
README 原文
**RoxyAPI** | [roxyapi.com/pricing](https://roxyapi.com/pricing), powers all readings and calculations
README 原文
**LLM** | Google, Anthropic, or OpenAI, interprets the data (see below)
README 原文
If you are on the Vercel Hobby plan (10s limit), upgrade to Pro or reduce the number of products.
README 原文
https://github.com/RoxyAPI/astrology-ai-chatbot/blob/main/LICENSEhttps://github.com/RoxyAPI/astrology-ai-chatbot/blob/main/README.mdyou can [request a free test key](https://roxyapi.com/contact) to try it out
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-04。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料较完整 · 92 / 100
- 技术栈
- Next.js · Astro · React
- 网站类型
- 启动器
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2026-09-30
- 截图检查日期
- 2026-10-04
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Next.js。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: [email protected] · 2026-10-04
查看当时使用的来源资料
SHA-256: 7a9c9c2239dd4b4a9903f48f5f472a43e533fe9ac472d7144491f4e66000669a
2026-10-04T00:25:38.394Z
来源文件 / 仓库<p align="center">
<a href="https://roxyapi.com">
<img src="https://raw.githubusercontent.com/RoxyAPI/astrology-ai-chatbot/main/assets/hero.png" alt="Open source AI astrology chatbot starter. Real calculations, multi-MCP, multi-LLM, MIT licensed." width="100%">
</a>
</p>
# AI Astrology Chatbot: Western, Vedic, Tarot & More
> Open source AI chatbot that runs real Western astrology, Vedic kundli, numerology, tarot, Human Design, forecast timelines, biorhythm, I Ching, crystals, dreams, and angel numbers calculations. Powered by [RoxyAPI](https://roxyapi.com), not LLM hallucinations.
[](https://roxyapi.com/pricing)
[](https://roxyapi.com/api-reference)
[](https://roxyapi.com/docs/quickstart)
[](https://roxyapi.com/docs/mcp)
[](https://roxyapi.com/methodology)
[](https://roxyapi.com/templates)
[](https://vercel.com/new/clone?repository-url=https://github.com/RoxyAPI/astrology-ai-chatbot&env=ROXY_API_KEY,GOOGLE_GENERATIVE_AI_API_KEY&envDescription=API%20keys%20for%20RoxyAPI%20and%20your%20LLM%20provider&envLink=https://roxyapi.com/pricing)
Ships with auto-discovered remote MCP tools, multi-provider LLM support (Gemini, Claude, GPT), and an interface built to be shown to customers: light and dark, a collapsible conversation list, and every chart drawn in the palette you choose.
**Clone. Add keys. Deploy. Live AI astrology chatbot in 30 minutes.**
| Dark | Light |
|---|---|
| <img src="https://raw.githubusercontent.com/RoxyAPI/astrology-ai-chatbot/main/screenshots/screenshot-01.png" alt="AI astrology chatbot opening screen in dark mode" width="100%"> | <img src="https://raw.githubusercontent.com/RoxyAPI/astrology-ai-chatbot/main/screenshots/screenshot-02.png" alt="AI astrology chatbot opening screen in light mode" width="100%"> |
## Why This Exists
Most AI astrology chatbots hallucinate planet positions, make up tarot spreads, and invent numerology results. This one calls [the 255+ verified tools at RoxyAPI](https://roxyapi.com/api-reference) via [MCP](https://roxyapi.com/docs/mcp) (Model Context Protocol), gets real computed data from astronomical ephemeris engines and mathematical models, then has the LLM interpret it. Every birth chart, every tarot draw, every Life Path calculation is backed by actual computation.
**17 spiritual domains plus location geocoding. Auto-discovered tools via MCP. Multilingual. Any LLM.**
| Domain | What You Can Ask |
|--------|-----------------|
| **Western Astrology** | Natal chart, daily/weekly/monthly horoscopes, transits, synastry, compatibility score, moon phases |
| **Vedic Astrology** | Janam Kundli, Vimshottari Dasha, Gun Milan, detailed Panchang, Manglik/Kalsarpa/Sadhesati doshas, KP system, Navamsa |
| **Forecast** | Cross-domain timeline merging Western transits, Vedic dasha periods, and biorhythm critical days, with significance-scored key dates |
| **Human Design** | Full bodygraph, energy type, strategy, authority, profile, centers, channels, gate activations, two-person connection, transit overlay |
| **Chinese Astrology** | BaZi Four Pillars chart, Day Master strength, ten year luck pillars, annual forecast, zodiac animal and compatibility, lunisolar date conversion, the 24 solar terms, Tong Shu almanac and auspicious date selection |
| **Feng Shui** | Kua number and Eight Mansions directions, flying star natal chart, annual and monthly star overlays, bagua sectors, annual afflictions, the nine periods |
| **Mesoamerican Astrology** | Tzolkin day sign, full Mayan chart with Haab and Long Count, Long Count conversion, nawal compatibility, trecenas, Aztec tonalpohualli |
| **Vastu** | Entrance pada, Vastu Purusha Mandala, plot analysis, Ayadi proportions, room compliance, griha pravesh dates, the eight directions |
| **Numerology** | Life Path, Expression, Soul Urge, Personal Year, full chart, compatibility |
| **Kabbalah** | Gematria with every Hebrew spelling shown, name and birth profiles, the 72 names, Tree of Life and sephirot, Hebrew letters, name comparison |
| **Tarot** | Three-card spreads, Celtic Cross, love spread, daily card, yes/no oracle |
| **Biorhythm** | Physical, emotional, intellectual cycle charts, multi-day forecasts, critical-day alerts |
| **Ayurveda** | Constitution from the birth chart, dinacharya day routine, ritucharya season, daily reading, the three doshas, six tastes, twenty qualities |
| **I Ching** | Hexagram readings, daily cast, full 64-hexagram catalog with changing lines |
| **Crystals** | Stones by zodiac, by chakra, birthstones by month, healing properties |
| **Dreams** | 2,000+ dream symbols, recurring patterns, archetypes |
| **Angel Numbers** | Spiritual meaning of 111, 222, 333, 444, 1111, and any positive integer via digit-root fallback |
| **Location** | City autocomplete with latitude, longitude, IANA timezone: turns "born in Mumbai" into chart-ready coordinates so users never type lat/long |
Responds in the language the person writes in: Hindi, Spanish, French, German, Japanese, and more.
## Quick Start
```bash
git clone https://github.com/RoxyAPI/astrology-ai-chatbot.git
cd astrology-ai-chatbot
npm install
cp .env.example .env.local
# Add your keys to .env.local
npm run dev
```
Open [localhost:3000](http://localhost:3000) and start chatting.
You need two keys:
| Key | Where to get it |
|-----|----------------|
| **RoxyAPI** | [roxyapi.com/pricing](https://roxyapi.com/pricing), powers all readings and calculations |
| **LLM** | Google, Anthropic, or OpenAI, interprets the data (see below) |
## Choose Your LLM
Swap providers with one env var. All three use the unified interface in the Vercel AI SDK, same code, different model:
| Provider | Env Var | Model | Cost / 1M tokens |
|----------|---------|-------|-------------------|
| **Google Gemini** (default) | `GOOGLE_GENERATIVE_AI_API_KEY` | Gemini 2.5 Flash | $0.30 / $2.50, has free tier |
| Anthropic | `ANTHROPIC_API_KEY` | Claude Haiku 4.5 | $1.00 / $5.00 |
| OpenAI | `OPENAI_API_KEY` | GPT-5 mini | $0.13 / $1.00 |
```env
LLM_PROVIDER=gemini
GOOGLE_GENERATIVE_AI_API_KEY=your_key
```
## How It Works
```
User message → LLM picks a tool → MCP calls RoxyAPI → Real data returned → LLM interprets → Streams to user
```
1. User asks a question ("What does my Saturn placement mean?")
2. The LLM selects the right tool from 160+ auto-discovered MCP tools
3. [RoxyAPI](https://roxyapi.com) computes the answer from verified astronomical/mathematical engines
4. The LLM interprets the structured data into a natural, personalized response
5. Response streams back in real-time with markdown formatting
No prompt-stuffing. No fake data. No hardcoded horoscopes.
## Widgets From Tool Calls
Ask for a tarot card and the card is drawn on screen, art and all, above the reading the model writes. Ask for a natal chart and the wheel renders with its aspect lines, planet list, and aspect grid, in the same message as the interpretation.
| Tarot card, dark | Natal wheel, light |
|---|---|
| <img src="https://raw.githubusercontent.com/RoxyAPI/astrology-ai-chatbot/main/screenshots/screenshot-03-tarot-widget.png" alt="A drawn tarot card above the reading written about it" width="100%"> | <img src="https://raw.githubusercontent.com/RoxyAPI/astrology-ai-chatbot/main/screenshots/screenshot-04-natal-widget.png" alt="A natal wheel with aspect lines above the interpretation" width="100%"> |
Nothing is wired per tool. [`@roxyapi/ui-react`](https://www.npmjs.com/package/@roxyapi/ui-react) carries a lookup from the tool name the model used to the component that draws its result, so every domain you enable renders itself. A tool no component covers, a reference lookup for instance, simply keeps the written answer.
| File | What it does |
|------|--------------|
| [`src/lib/tool-widgets.ts`](https://github.com/RoxyAPI/astrology-ai-chatbot/blob/main/src/lib/tool-widgets.ts) | Turns a chat message into the list of components to draw |
| [`src/components/chat/ToolWidget.tsx`](https://github.com/RoxyAPI/astrology-ai-chatbot/blob/main/src/components/chat/ToolWidget.tsx) | Renders that list above the prose in the assistant bubble |
Widgets wear the chat palette rather than a theme of their own. Every surface, ink, border, status colour, face and corner a drawing paints comes from a `--roxy-*` token, and [`globals.css`](https://github.com/RoxyAPI/astrology-ai-chatbot/blob/main/src/app/globals.css) points the whole set at the app palette in one block, so a chart is the same material as the page it arrives on:
```css
:root {
--roxy-surface: var(--card);
--roxy-accent: var(--primary);
/* and the rest of the set */
}
```
Every value is a reference rather than a colour, so the dark palette moves the drawings with everything else and there is no second copy to keep in step. Recolour the palette and the drawings follow, in both themes and at any width. Restyling a component is never the answer, and `tests/design-tokens.test.ts` fails if a token is given a colour of its own. [THEMING.md](https://github.com/RoxyAPI/ui/blob/main/packages/ui/THEMING.md) covers every token, its light and dark default and what it paints. The [UI components page](https://roxyapi.com/docs/ui) lists every component, and the [AI chat widgets tutorial](https://roxyapi.com/docs/tutorials/ai-chat-widgets) covers the same pattern for other chat frameworks and model vendors.
## MCP Tool Discovery
This chatbot uses [Model Context Protocol (MCP)](https://modelcontextprotocol.io) to automatically discover all available tools from [RoxyAPI](https://roxyapi.com) at runtime. No manual endpoint wiring, all 255+ tools across 17 spiritual domains plus location geocoding are ready to use out of the box.
### How MCP connections work
MCP connections are initialized **once** and cached automatically. The first request after a deploy takes ~1-2 seconds to set up; every request after that reuses the cached tools instantly.
### Choosing which products to enable
By default all 18 RoxyAPI products are enabled (~255 tools across 17 spiritual domains plus location for geocoding). To use a subset, set the `ROXYAPI_PRODUCTS` env var:
```env
# Enable only tarot and astrology (fewer tools = faster model selection)
# Tip: keep `location` enabled whenever you enable a chart product (astrology, vedic-astrology).
# It is what lets the LLM resolve "born in Mumbai" to coordinates before calling the chart.
ROXYAPI_PRODUCTS=tarot,astrology,location
```
Available product slugs: `astrology`, `vedic-astrology`, `forecast`, `human-design`, `chinese-astrology`, `feng-shui`, `mesoamerican-astrology`, `vastu`, `numerology`, `kabbalah`, `tarot`, `biorhythm`, `ayurveda`, `iching`, `crystals`, `dreams`, `angel-numbers`, `location`. Legacy `-api` suffixed slugs (e.g. `tarot-api`) still work for backwards compat. The list that ships is `DEFAULT_PRODUCTS` in [`src/lib/mcp.ts`](https://github.com/RoxyAPI/astrology-ai-chatbot/blob/main/src/lib/mcp.ts), so check there when a new RoxyAPI domain appears.
### Tool count recommendations
| Tool Count | LLM Behavior | Recommendation |
|-----------|--------------|----------------|
| **10-30 tools** | Fast, accurate tool selection | Best for focused use cases (e.g. tarot + astrology only) |
| **30-80 tools** | Good with capable models (Gemini 2.5 Flash, GPT-5 mini, Claude Haiku 4.5) | Good balance for most deployments |
| **80-150 tools** | Works but slower; model may occasionally pick the wrong tool | Increase `MAX_TOOL_STEPS` if needed |
| **255+ tools** | Where the full default catalogue sits, all 18 products enabled. Capable models handle it; smaller ones start picking the wrong tool as descriptions compete for context | Trim `ROXYAPI_PRODUCTS` to the domains you actually need |
> **Tip**: If you are building a focused product (e.g. a tarot-only app), set `ROXYAPI_PRODUCTS=tarot` to give the LLM fewer options and faster, more accurate tool selection.
## Architecture
```
src/
├── app/
│ ├── api/chat/route.ts # Chat endpoint, streamText + MCP tools
│ ├── layout.tsx # Root layout, the two typefaces, theme provider, metadata
│ ├── page.tsx # Home page with structured data
│ └── globals.css # The design system: light palette, dark palette, widget bridge
├── components/
│ ├── chat/
│ │ ├── ChatShell.tsx # Header, sidebar, transcript, conversation switching
│ │ ├── ChatHeader.tsx # Wordmark, connected domains, theme and view controls
│ │ ├── ChatSidebar.tsx # New chat, recent conversations, connected list
│ │ ├── ChatPanel.tsx # One conversation: transcript, composer, attribution
│ │ ├── MessageList.tsx # Transcript, opening screen, four openers
│ │ ├── MessageBubble.tsx # One turn, markdown for the reply
│ │ ├── MessageInput.tsx # Growing composer, send and stop
│ │ └── ToolWidget.tsx # Draws the components a tool result earned
│ ├── theme-provider.tsx # Light and dark, remembered
│ ├── theme-toggle.tsx # The control in the header
│ └── StarField.tsx # The night sky, seeded so it hydrates cleanly
└── lib/
├── ai.ts # Multi-provider LLM config (Gemini/Claude/GPT)
├── mcp.ts # MCP client, connects to RoxyAPI and caches all tools
├── prompts.ts # System prompt, personality, capabilities, multilingual
├── tool-widgets.ts # Maps a tool result to the component that renders it
├── conversations.ts # Recent conversations, kept in the browser only
└── domains.ts # The reading name for each connected product
```
Key design decisions:
- **MCP over REST**: tools are auto-discovered from the RoxyAPI MCP servers. No manual endpoint definitions needed.
- **Persistent MCP connections**: connections are initialized once and cached. No per-request overhead.
- **Server-side only**: all API keys stay in the Next.js API route. Nothing leaks to the client bundle.
- **Model agnostic**: Vercel AI SDK v6 abstracts the LLM. Swap Gemini for Claude or GPT with one env var.
- **SSR + JSON-LD**: structured data and meta tags render server-side for search engine visibility.
## Features
- **Tool result widgets**: a tarot card, natal wheel, or bodygraph renders above the interpretation, in the palette you chose
- **Light and dark**: dark on a first visit, one control in the header, and the choice is remembered. The drawn charts follow the switch
- **Conversation history**: recent conversations listed in the sidebar, kept in the browser under one key and bounded at twenty. Nothing is sent anywhere and there is no account
- **Collapsible sidebar**: a panel on a wide screen, a drawer on a phone, closed with the escape key
- **Markdown responses**: assistant messages render with full markdown support (headings, bold, lists, code blocks, tables, links). A wide table scrolls in its own frame
- **A composer that behaves**: grows with what you type up to a cap, enter sends, shift and enter makes a newline, and a second submit cannot start a second turn
- **Stop button**: cancel a long-running response mid-stream
- **Rate limiting**: built-in per-IP rate limiter (20 req/min) to protect LLM API credits
- **Input validation**: request body validation with message count cap to prevent abuse
- **Security headers**: X-Content-Type-Options, X-Frame-Options, Referrer-Policy
- **Accessible**: zero axe violations in both themes, a visible focus ring on every control, `role="log"` on the transcript, and reduced motion respected
## Stack
| Layer | Tech |
|-------|------|
| Framework | [Next.js 16](https://nextjs.org) (App Router, React 19) |
| AI | [Vercel AI SDK v6](https://ai-sdk.dev), streaming, tool calling, multi-provider |
| Data | [RoxyAPI](https://roxyapi.com): 255+ tools, 17 spiritual domains plus location, Remote [MCP](https://roxyapi.com/docs/mcp) |
| Tool Discovery | [MCP](https://modelcontextprotocol.io) via `@ai-sdk/mcp`, auto-discovers tools at runtime |
| Widgets | [@roxyapi/ui-react](https://www.npmjs.com/package/@roxyapi/ui-react): charts, spreads, and tables that render a tool result |
| UI | [Tailwind CSS v4](https://tailwindcss.com) + [shadcn/ui](https://ui.shadcn.com), one palette in two themes |
| Type | Fraunces and Inter, self hosted through `next/font` |
| Theming | [next-themes](https://github.com/pacocoursey/next-themes), dark by default, remembered |
| SEO | Server-rendered JSON-LD (schema.org), Open Graph, keyword meta tags |
## Customize
**AI personality**: edit [`src/lib/prompts.ts`](https://github.com/RoxyAPI/astrology-ai-chatbot/blob/main/src/lib/prompts.ts). Make it mystical, clinical, casual, or match your brand.
**Which domains**: set the `ROXYAPI_PRODUCTS` env var, or edit the product list in [`src/lib/mcp.ts`](https://github.com/RoxyAPI/astrology-ai-chatbot/blob/main/src/lib/mcp.ts).
**Colours**: the whole product is two blocks in [`globals.css`](https://github.com/RoxyAPI/astrology-ai-chatbot/blob/main/src/app/globals.css), `:root` for light and `.dark` for dark. Edit those and everything follows, the drawn charts included, because every `--roxy-*` token is a reference into the same palette. `npm test` fails if a token goes missing from one theme.
**Typefaces**: two families in [`layout.tsx`](https://github.com/RoxyAPI/astrology-ai-chatbot/blob/main/src/app/layout.tsx), loaded through `next/font` as CSS variables. Swap a face there and in the matching line of `globals.css`.
**Layout and copy**: the screen is in [`src/components/chat/`](https://github.com/RoxyAPI/astrology-ai-chatbot/blob/main/src/components/chat/). The openings offered on an empty screen are in [`src/lib/domains.ts`](https://github.com/RoxyAPI/astrology-ai-chatbot/blob/main/src/lib/domains.ts), each tagged with the product that answers it, so trimming `ROXYAPI_PRODUCTS` never offers a reading your deployment cannot give. Everything is Tailwind, no CSS-in-JS.
**Tool step limit**: set `MAX_TOOL_STEPS` in your env to control how many tool-call round-trips the LLM can make per message (default: 5).
## Environment Variables
| Variable | Required | Default | Description |
|----------|----------|---------|-------------|
| `ROXY_API_KEY` | Yes | none | Your RoxyAPI API key ([get one](https://roxyapi.com/pricing)) |
| `LLM_PROVIDER` | No | `gemini` | LLM provider: `gemini`, `anthropic`, or `openai` |
| `GOOGLE_GENERATIVE_AI_API_KEY` | If Gemini | none | Google AI API key |
| `ANTHROPIC_API_KEY` | If Anthropic | none | Anthropic API key |
| `OPENAI_API_KEY` | If OpenAI | none | OpenAI API key |
| `ROXYAPI_MCP_URL` | No | `https://roxyapi.com/mcp` | Base URL for MCP endpoints |
| `ROXYAPI_PRODUCTS` | No | All 18 products | Comma-separated list of product slugs to enable |
| `MAX_TOOL_STEPS` | No | `5` | Max tool-call round-trips per message |
## Deploy
One-click deploy to Vercel:
[](https://vercel.com/new/clone?repository-url=https://github.com/RoxyAPI/astrology-ai-chatbot&env=ROXY_API_KEY,GOOGLE_GENERATIVE_AI_API_KEY&envDescription=API%20keys%20for%20RoxyAPI%20and%20your%20LLM%20provider&envLink=https://roxyapi.com/pricing)
Or deploy anywhere that runs Node.js:
```bash
npm run build && npm start
```
## Security
- API keys are server-side only, never exposed to the browser
- All RoxyAPI calls happen in the Next.js API route via MCP, not the client
- Per-IP rate limiting on the chat endpoint (20 requests/minute)
- Request body validation with message count limits
- Security headers (X-Content-Type-Options, X-Frame-Options, Referrer-Policy)
- Markdown rendered safely via `react-markdown` (no `dangerouslySetInnerHTML`, HTML is escaped)
- External links use `rel="noopener noreferrer"` to prevent tab-nabbing
## FAQ
### How many tools can the LLM handle?
The default setup exposes ~255 tools from 18 RoxyAPI products (17 spiritual domains plus location for geocoding). Modern models like Gemini 2.5 Flash, GPT-5 mini, and Claude Haiku 4.5 handle this well. If you see the model picking the wrong tool or making excessive tool calls, reduce the product count via `ROXYAPI_PRODUCTS`, fewer tools means faster, more accurate selection.
### The chatbot is unstable or sometimes does not respond
This is almost always caused by MCP initialization timing out. The default `maxDuration` is 60 seconds, which should be enough. If you are on the Vercel Hobby plan (10s limit), upgrade to Pro or reduce the number of products. Also check that your `ROXY_API_KEY` is valid.
### Do MCP connections stay open forever?
MCP connections persist for the lifetime of your server process. On Vercel, they are refreshed automatically when your function recycles after a period of inactivity. You do not need to manage connection lifecycle manually.
### Why is the first message slow?
The first request after a deploy (or after your server has been idle for a while) initializes all MCP connections and fetches tool definitions (~1-2 seconds). Every request after that is instant.
### How do I change the AI personality?
Edit the system prompt in [`src/lib/prompts.ts`](https://github.com/RoxyAPI/astrology-ai-chatbot/blob/main/src/lib/prompts.ts). The default personality is a warm, knowledgeable spiritual advisor. You can make it more mystical, clinical, casual, or match your brand voice.
### Can I disable specific product domains?
Yes. Set `ROXYAPI_PRODUCTS` in your environment to only include the slugs you want:
```env
ROXYAPI_PRODUCTS=tarot,numerology
```
### Is this free to use?
The code is free and open source. You will need a [RoxyAPI key](https://roxyapi.com/pricing) (you can [request a free test key](https://roxyapi.com/contact) to try it out) and an LLM provider key (Gemini has a free tier).
## Links
| Resource | URL |
|----------|-----|
| RoxyAPI Homepage | [roxyapi.com](https://roxyapi.com) |
| Quickstart | [roxyapi.com/docs/quickstart](https://roxyapi.com/docs/quickstart) |
| Live API Reference | [roxyapi.com/api-reference](https://roxyapi.com/api-reference) |
| MCP Integration | [roxyapi.com/docs/mcp](https://roxyapi.com/docs/mcp) |
| Methodology (NASA JPL verified) | [roxyapi.com/methodology](https://roxyapi.com/methodology) |
| Pricing | [roxyapi.com/pricing](https://roxyapi.com/pricing) |
| All Products | [roxyapi.com/products](https://roxyapi.com/products) |
| Starter Apps | [roxyapi.com/templates](https://roxyapi.com/templates) |
---
Built with [RoxyAPI](https://roxyapi.com), the data engine behind real astrology, tarot, and numerology calculations.
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

ai-website-cloner-template
Clone any website with one command using AI coding agents
Next.js · 启动器

Next.js SaaS Starter
Next.js SaaS Starter 是 Next.js 官方维护的 SaaS 起点模板,定位介于学习资源和可直接部署的脚手架之间。
Next.js · SaaS

Next.js Commerce
Next.js Commerce 是 Vercel 团队维护的电商启动模板,基于 Next.js App Router 构建,采用服务端渲染、React Server Components、Server Actions …
Next.js · 电商

Next-js-Boilerplate
Next-js-Boilerplate 是一个面向 Next.js 16、Tailwind CSS 4 和 TypeScript 的启动器,核心定位是开发者体验优先。
Next.js · 启动器

tailwind-nextjs-starter-blog
tailwind-nextjs-starter-blog 是一个面向个人技术博客的 Next.js 与 Tailwind CSS 启动模板,其 v2 版本基于 App Router 与 React Server Comp…
Next.js · 博客

next-forge
Production-grade Turborepo template for Next.js apps.
Next.js · 启动器
