Getting started
Astro AI Docs is a Starlight site with one extra component: an Ask AI button in the header that answers questions from the pages on the site.
Create a site
Section titled “Create a site”npm create astro@latest my-docs -- --template fengyiqicoder/astro-ai-docscd my-docsnpm installnpm run devOpen http://localhost:4321. The site runs without any key; the Ask AI dialog tells readers it is not set up yet until you add one.
Add your key
Section titled “Add your key”-
Get a free key. Fill in your email at onetagai.com, or POST it from the terminal; either way the key arrives in that inbox, one key per email:
Terminal window curl -X POST https://onetagai.com/api/signup -H "Content-Type: application/json" -d '{"email":"you@example.com"}'An AI coding tool can run that request for you and ask you to paste the key.
-
Create a
.envfile in the project root:
PUBLIC_ONETAG_KEY=ot_your_key_here- Restart
npm run dev. Open the dialog with the button or withCtrl+/.
This key is designed to be public: it ends up in the built HTML, like any analytics ID. Every account has an allowance of 1,000,000 tokens; the dialog shows a plain message when it is used up.
npm run buildnpm run previewRetrieval uses the Pagefind index that astro build creates, so the full “search the whole site, then answer” flow only works on a built site. In npm run dev the dialog answers from the current page instead.
Next steps
Section titled “Next steps”- How Ask AI works, and what is sent where.
- Deploy to GitHub Pages, Vercel or Netlify.
- Customize the name, colors and sidebar.
Built with Astro AI Starter. Powered by OneTag AI: answers come from your own pages, no backend.