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?" }
  ]
}
  • messages — alternating user / assistant turns. The last turn must be from the user.
  • 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.

StatusMeaning
400messages missing or contains no user turn.
503The 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.

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 }));
}