OneTag AI / Guides

Add AI to a GitHub Pages site

How do I add AI to a GitHub Pages site without a backend?

GitHub Pages serves static files only: no server, no environment variables, no place to hide an API key. Calling OpenAI or Anthropic directly from the browser means publishing your secret key in the page source, where anyone can copy it and run up your bill. OneTag AI solves this with a public key that can only spend a fixed token budget, and a script tag that works from any static page.

This guide takes a plain GitHub Pages site (user site, project site, or Jekyll-built) and adds a working AI feature in about five minutes. No build step, no Actions workflow, no secrets.

Steps

  1. Get a free key

    Enter your email at onetagai.com. The key arrives by email with a dashboard link. One key per email, 1,000,000 free tokens, usable on any number of sites.

  2. Add the script tag

    Put this in the <head> of any page, or in _includes/head.html if the site is built with Jekyll:

    <script src="https://onetagai.com/v1.js" data-key="YOUR_ONETAG_KEY"></script>

  3. Call onetag.ask

    Anywhere after the tag, in a module script:

    <button id="tldr">Summarize this page</button>
    <p id="summary"></p>
    
    <script type="module">
      tldr.onclick = async () => {
        summary.textContent = "Thinking…";
        summary.textContent = await onetag.ask("Summarize in 3 bullets", document.querySelector("main"));
      };
    </script>

  4. Commit and push

    GitHub Pages redeploys in about a minute. Open the page, click the button. The answer streams from the model through OneTag AI; your key is public, your bill is capped by the key's quota.

What you can build on GitHub Pages with this

Jekyll and GitHub Pages themes

If GitHub builds your site with Jekyll, add the tag once to _includes/head.html (or _layouts/default.html) and every page gets onetag. Themes like minima, just-the-docs and Chirpy all have such an include. Jekyll does not change the script, so there is nothing else to configure. See the Jekyll guide for a full example.

Custom domains and the domain lock

Free keys work from any domain, including username.github.io and a custom domain. If you upgrade to Pro and lock the key, lock it to the domain visitors see in the address bar. example.com also covers www.example.com and every other subdomain.

Questions

Can GitHub Pages call the OpenAI API directly?

Only by putting the secret key in the page, which anyone can read and reuse. OneTag AI keys are public by design and capped by a token budget, so copying one gains nothing but a share of your free tokens.

Do I need a GitHub Actions workflow or a build step?

No. The script tag is plain HTML. It works on sites that GitHub serves straight from the repository and on sites built by Jekyll or a custom workflow.

Does it work on project sites under a subpath, like username.github.io/repo?

Yes. The SDK does not care about the path. Use absolute URLs for the tag (https://onetagai.com/v1.js) so it loads from any page depth.

Can visitors see my key in the source?

Yes, and that is fine: it is a public key with a fixed budget. If it is abused, replace it from your dashboard in one click; the old key stops working at once.

Does it cost anything?

A free key has 1,000,000 tokens with no monthly reset, enough for a few hundred summaries. Pro is $9.9 a month for 100,000,000 tokens a month and the domain lock.

Which model answers?

A fast, inexpensive model from OpenRouter, chosen for sub-second first tokens and good instruction following. You do not pick a model; the point is one tag that keeps working.

What happens to the text my visitors send?

It goes to the model and comes back. OneTag AI stores token counts per key for the quota and keeps no prompts, inputs or answers. The access log carries no IP addresses.

Try it on your sitefree

Get a free key by email, paste one tag, call onetag.ask. 1,000,000 tokens, no card.

Get a free key

Updated 2026-11-09. Something wrong or missing? Email support@odysseyx.app.