Skip to content
Ask the docs

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.

Terminal window
npm create astro@latest my-docs -- --template fengyiqicoder/astro-ai-docs
cd my-docs
npm install
npm run dev

Open 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.

  1. 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.

  2. Create a .env file in the project root:

PUBLIC_ONETAG_KEY=ot_your_key_here
  1. Restart npm run dev. Open the dialog with the button or with Ctrl + /.

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.

Terminal window
npm run build
npm run preview

Retrieval 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.

Built with Astro AI Starter. Powered by OneTag AI: answers come from your own pages, no backend.