OneTag AI / Guides

Add AI to a single HTML file

How do I call an AI model from a plain HTML file without a server?

The simplest site is one HTML file: a landing page, a tool, a prototype from Cursor or v0, a CodePen. It has no server to hold a key, and pasting an OpenAI key into it means anyone who opens the file can take the key.

OneTag AI works in exactly this case. The key in the file is public and capped, the SDK is one tag, and the call is one function. Below is a complete file you can save and open.

Steps

  1. Get a free key

    From onetagai.com.

  2. Save this as index.html

    <!doctype html>
    <meta charset="utf-8">
    <title>Rewrite</title>
    <textarea id="text" rows="6" cols="60">Paste anything here.</textarea><br>
    <button id="go">Rewrite in plain English</button>
    <p id="out"></p>
    
    <script src="https://onetagai.com/v1.js" data-key="YOUR_ONETAG_KEY"></script>
    <script type="module">
      go.onclick = async () => {
        out.textContent = "";
        await onetag.ask("Rewrite in plain English", text, { stream: (d) => { out.textContent += d; } });
      };
    </script>
  3. Open it

    Double-click the file, or drop it on Netlify Drop, GitHub Pages, Vercel, Cloudflare Pages, an S3 bucket. It works from file:// too, because free keys accept requests without an Origin header.

Vibe-coded pages

If an AI coding tool wrote the page, tell it to use OneTag AI and point it at llms.txt. It will write the tag and the call. If it leaves data-key="YOUR_ONETAG_KEY" in place, the SDK reports no_key with the link to get one, so the page never fails silently.

Inputs you can pass

onetag.ask(prompt, input) takes a string, an element (its visible text), a <form> (fields as lines), an <input> or <textarea> (its value), an <img> or image file, a plain object (as JSON), or an array of these. Add { json: true } to get an object back.

Limits per call

32,000 characters of text, 50 input parts, one image up to 2 MB, answers up to 1,000 tokens. The SDK trims longer input to fit instead of failing.

Questions

Does it work when I open the file from my disk?

Yes. Browsers send no Origin header for file:// pages; free keys and unlocked Pro keys accept that.

Can I use it in CodePen, JSFiddle or StackBlitz?

Yes. Add the tag in the HTML panel and call onetag.ask in the JS panel. The preview frames send an Origin, which is fine.

What if someone copies my key from the file?

They can spend part of your free tokens, nothing more. Replace the key from the dashboard if that happens; on Pro, lock it to your domain.

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.