Assistant API
The Intelena dapp ships an AI assistant grounded in the whitepaper. It is exposed by the dapp's Worker as a streaming endpoint.
POST /api/ai/chat
Request
{
"messages": [
{ "role": "user", "content": "What is a Leak Score?" }
],
"model": "opus"
}
messages— alternatinguser/assistantturns. The last turn must be from the user.model— optional:opus(default, Claude Opus 5 with adaptive thinking),sonnet, orhaiku.- History is capped server-side (last 20 turns, 4,000 characters per message).
Response
200 text/plain — the reply is streamed as UTF-8 text chunks as they are generated. Read the body as a stream and append chunks to the UI.
| Status | Meaning |
|---|---|
400 | messages missing or contains no user turn. |
429 | Rate limited — 20 requests / minute per IP, 300 / minute globally. Honour Retry-After. |
503 | The assistant is not configured (ANTHROPIC_API_KEY unset). |
Behaviour
- Answers are grounded in the whitepaper. Figures that are not yet published (token supply, audits, the $INTEL contract address) are reported as such rather than invented.
- The assistant never asks for private keys, seed phrases, viewing keys, or note data.
- It does not give investment advice.
- It never states or guesses a $INTEL contract address, and does not describe any fee, tax or buyback mechanism.
In the app, conversations, the active chat and the chosen model are kept in your browser only; replies render Markdown with copyable code blocks.
Client example
const res = await fetch("/api/ai/chat", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ messages }),
});
const reader = res.body!.getReader();
const decoder = new TextDecoder();
for (;;) {
const { value, done } = await reader.read();
if (done) break;
append(decoder.decode(value, { stream: true }));
}