Skip to content

Getting Started

An Astro integration that adds AI-powered search and chat to your Astro site. It indexes your built HTML on every deploy, stores content in Upstash Search, and answers questions with OpenAI via the Vercel AI SDK.

RequirementVersion
Astro6.x (^6.0.0 peer dependency)
Node.js22.15+
Output modeserver or hybrid (middleware + API routes)
Upstash SearchREST URL + token
OpenAI API keyAccess to your chosen chat model
  • Semantic search/api/search powered by Upstash Search with reranking
  • RAG chatbot/api/chatbot retrieves relevant pages, then generates answers with citations
  • Model selection — GPT-5.4 family (default gpt-5.4-mini), plus GPT-5, GPT-4.1, and GPT-4o models
  • Reasoning controlsreasoningEffort and textVerbosity for supported OpenAI models
  • Streaming — real-time responses with DATA:-delimited stream protocol
  • Multi-language — filter indexed content and chat by language
  • Auto-indexing — crawls built HTML after astro build and upserts to Upstash
  • Content filtering — exclude routes, CSS selectors, and cap indexed content length

The integration registers two middleware routes automatically:

EndpointMethodsPurpose
/api/searchGET, POSTSemantic search over indexed content (Upstash only)
/api/chatbotPOSTRAG chat with optional streaming (Upstash + OpenAI)

See API endpoint for request/response formats and client examples.

  1. Install the package and set environment variables
  2. Configure model, indexing, and prompt options
  3. Build your site — content is indexed on astro build
  4. Call /api/chatbot from your UI, or use the demo widget for testing

This integration and the docs playground are built with:

PackageRole
Astro 6.3+Framework + middleware
@astrojs/netlify 7.xServer adapter (playground)
@astrojs/starlight 0.39+Documentation site
Vercel AI SDK 6 (ai, @ai-sdk/openai 3.x)Chat + streaming
Upstash SearchVector / semantic index
Tailwind CSS 4.3Playground styling

Recent updates relevant to adopters:

  • Astro 6 support — requires Astro ^6.0.0 and Node >=22.15.0
  • AI SDK 6 — upgraded from AI SDK 5; same streamText API for chat
  • GPT-5.4 modelsgpt-5.4, gpt-5.4-mini (default), gpt-5.4-nano
  • model option — choose the OpenAI model in astro.config
  • reasoningEffort / textVerbosity — tune reasoning-capable models
  • /api/search — dedicated search endpoint (GET ?q= or POST JSON)

MIT Licensed. Made with ❤️ by unfolding.