Add AI in five minutes
One script tag and one call. No API key, no server, no billing code.
ChargeMyAI works on any web page. You add one script tag, call charge.ai.chat() where you want AI, and your users pay for their own replies by UPI.
1. Add the script tag
Put it once on every page that uses AI, usually just before </body> or in your layout.
index.html
<script src="https://cdn.chargemy.ai/v1/charge.js"></script>
2. Ask for a reply
index.html
<textarea id="text"></textarea>
<button id="go">Summarise</button>
<p id="out"></p>
<script type="module">
go.onclick = async () => {
go.disabled = true
try {
const reply = await charge.ai.chat('Summarise in two lines: ' + text.value)
out.textContent = reply.text
} catch (e) {
if (e.code !== 'cancelled') out.textContent = e.message
} finally {
go.disabled = false
}
}
</script> 3. That's it
- If the browser can answer on its own (Chrome on capable laptops), the reply is made right there, for free.
- Otherwise it goes to a cloud model. The first time, your user signs in once and gets 10 free replies; after that they top up by UPI.
- ChargeMyAI shows the sign-in and payment screens itself, then sends the message. You write no extra code for it.
Never add an API key. There isn't one, and nothing secret ever sits in your page.
Read next
Still stuck? Talk to us and we'll help.