Hide your API key: call an AI model from an HTML or JavaScript app with no key
How do I hide my API key in an HTML or JavaScript app? A key inside a page cannot really be hidden, because anyone who opens the page can read its code. Publish the app here instead, and it calls an AI model through us. There is no key in your app at all, and we pay for the calls.
How to hide your API key in 3 steps
- Copy the instruction below.
- Paste it into your coding agent and ask it to publish your app. It declares your app's prompts and replaces the direct API call.
- Try the draft it gives you, then tell it to publish and send the link.
Each new app is checked before it goes public.
Fetch https://alittle.app/agent-setup/prompt.md and do what it says.What calling an AI model from here includes
- No key in your HTML or JavaScript, so there is no key to leak.
- No bill for you. We pay for the calls.
- Each person who uses your app has a daily allowance.
- One link that stays up, with free hosting.
- Anyone can open the link, with no account and nothing to install.
Publish with Claude Code, Codex or Cursor
If a coding agent helped you build the app, it can also take the key out. Paste the instruction into Claude Code, Codex, Cursor or any other coding agent, and ask it to publish your app. It finds the place where your code calls an LLM API, declares the prompts your app sends, and swaps the direct call for one that goes through us.
You do not move a key to a server. When the draft works, publish it. Each new app is checked before it goes public.
Questions about hiding an API key
How do I hide my API key?
In a page that runs in the browser, you leave the key out. Published here, your app calls an AI model through us, so the key never has to be in your code.
Can I hide an API key in JavaScript or HTML?
Not really. Code in a web page reaches every person who opens it, and anyone can view the source. In the frontend, the safe key is no key.
Why hide an API key?
A key is like a password for your account with a service. Whoever holds it can make calls that count as yours.
What happens if an API key is exposed?
Someone could use it to make calls on your account, and those calls may land on your bill. If a key has been in public code, turn it off with the service that gave it to you and make a new one.
Are API keys supposed to be private?
Yes. Keep them out of anything other people can open, including web pages and public code.
Is there a free AI API key?
You do not need one here. Publish your app and it calls an AI model with no key, and we pay for the calls.
Who pays for the calls?
We do. You get no bill. Each person who uses your app has a daily allowance, and when it runs out the app waits until the next day.
Does this work for other kinds of API keys?
No. This covers calls to an AI model. Keys for maps, weather or payments are not covered, and an app that asks an AI model here does not connect to other services.
More help
- Free HTML hosting: put your HTML file online and get a link
- HTML to link: turn an HTML file into a link you can send
- Publish a Claude artifact: a public link anyone can open
- Open an HTML app on iPhone or Android and add it to the home screen
- How do I keep the data in an app I made with AI?
- How can my friends or family use my app together?
Updated November 16, 2026