Mini apps
Overview
Build a branded app that runs inside TokenHarbor chat, and share its link with your own customers.
Mini apps
A mini app is a small web app that runs inside TokenHarbor chat, with your name, your icon and your colours. You write one HTML page; TokenHarbor gives it the models. You share a link such as tokenharbor.ai/a/your-app, and anyone who opens it signs in with their own TokenHarbor account.
Two examples to open and take apart: Menu Snap, which turns a photo of a menu in any language into an interactive English menu with pictures of the dishes, and Harbor Tales, a story where the reader picks what happens next.
Who pays for what
- The person using your app pays for their own use, from their own account. You pay nothing when your app is used, however popular it gets.
- Apps run on TH-Rudder, which is free — text, reading photos, and pictures within the daily picture allowance. The limits are the same as in the chat: see Web chat limits.
- Using an app always needs a signed-in TokenHarbor account. Signed-out visitors are sent to sign in and brought straight back.
How you build one
- Open Dashboard → Mini apps, choose an address and a name. You land in a chat: your app's own project.
- Say what the app should do — "a page where I photograph a menu and get it in English, with the best dishes first". The app is written, and it runs in the preview beside the chat. On a phone, tap Preview.
- Keep talking to change it: "make the buttons bigger", "add a dark mode", "remember my last three menus". Each change is saved as a new version and the preview reloads. Undo goes back one version.
- When it works, Publish sends it for review. Once approved, everyone with the link gets that version, and your app is listed under Mini apps in the chat sidebar, where anyone signed in can find it.
Nobody but you can open your app until it is reviewed, and later changes reach everybody else only after the next review — your published version keeps running meanwhile.
Building runs on TH-Rudder, free. For a bigger change you can switch the chat to a stronger model, paid from your balance like any other chat.
Prefer to write the page yourself? Every app also has a code editor (Settings on the app), and an API for deploying from your own tools. Whatever writes the page, it only has to use the SDK.
Your first app
This is the whole of a working app. It asks the model a question and shows the answer as it streams in.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Hello</title>
</head>
<body>
<h1 id="hi">Hello</h1>
<textarea id="q" placeholder="Ask anything"></textarea>
<button id="go">Send</button>
<div id="out" style="white-space: pre-wrap"></div>
<script>
th.ready().then(function (info) {
if (info.user.name) document.getElementById("hi").textContent = "Hello, " + info.user.name;
});
document.getElementById("go").addEventListener("click", function () {
var out = document.getElementById("out");
out.textContent = "";
th.chat
.send({
text: document.getElementById("q").value,
onDelta: function (d) { out.textContent += d; },
})
.then(function (r) { out.textContent = r.text; });
});
</script>
</body>
</html>
th is there before your first script runs; you do not include anything.
What an app can and cannot do
Your page runs in a sealed frame. It can use HTML, CSS and JavaScript freely, but:
- It cannot reach the internet. No
fetch, no external scripts, no external images except pictures the chat made. Put everything the page needs inside the one file. - It cannot see the user's account: not their email, their balance, their other chats, or their login.
- It talks to TokenHarbor only through the SDK: send a message, get a reply and pictures back, keep a little data on the user's device.
That is what lets a person open an app made by someone they have never met.
Review
Every version is looked at by a person before it goes public. We turn away apps that:
- pretend to be TokenHarbor or another company, or ask for passwords, card numbers or other secrets;
- try to get around the limits above;
- are made for content that the chat itself would refuse.
If an app is sent back, the reason is shown on its page in the dashboard. Published apps that break these rules later are taken down.
Next
- SDK reference — every call your page can make.
- API — create and update apps from your own scripts or CI.