hiperbrain

hiperbrain documentation

A brain that computes with 10,000-dimensional vectors

Almost everything labelled "AI" today is one of two things: a giant neural network that is powerful but an opaque black box, or old-school symbolic logic that is transparent but brittle. hiperbrain is built on a long-overlooked third path - Hyperdimensional Computing (HDC), also called Vector Symbolic Architectures. It is transparent like logic, robust like a neural net, and it does something neither of them does gracefully: it thinks in pure algebra.

Every concept becomes a vector of 10,000 numbers. Learning a fact is one addition. Answering a question - even an analogy it was never explicitly taught - is a multiplication. Destroy a third of the numbers and it still remembers. And it all runs on a normal CPU, right in this browser.
On this page

Introduction

The last decade of AI has been a story of two extremes. On one side, deep neural networks - astonishingly capable, but their knowledge is buried in billions of floating-point weights that no human can read. On the other, symbolic systems - rules and logic you can inspect line by line, but rigid and brittle the moment reality does not match the rule book.

Hyperdimensional Computing is the rarely-travelled middle road. It keeps the inspectability of symbols - every concept is a named vector you can print out - while gaining the noise-tolerance and graceful degradation of neural tissue. Crucially, it replaces training with algebra: to know something, you add a vector; to ask something, you multiply. There is no loss function, no backpropagation, no epochs.

This page is the long-form explanation of how that works, grouped into themes. Every claim here maps to code you can read in packages/core/src/. Use the menu on the left to jump around, and expand only the parts you care about.

HDC has decades of serious research behind it, but it has lived in academic papers and embedded-hardware labs - not as something the public can touch. Compare the paradigm to mainstream "AI":

Large language models
  • -Black box - billions of opaque weights
  • -Training costs millions; updates are slow
  • -Runs on GPU clusters, per-call API cost
  • -Hallucinates; reasoning is implicit
  • -Knowledge frozen at training time
hiperbrain (HDC)
  • -Transparent - read the whole engine yourself
  • -Learns a new fact in one step, instantly
  • -Runs on a plain CPU - no GPU, no model
  • -Reasoning is explicit, inspectable algebra
  • -Knowledge grows live as people teach it

The foundations

The single most counter-intuitive idea in HDC is that bigger is simpler. We represent each concept with a vector of D = 10,000 dimensions. Why so many? Because of the blessing of dimensionality.

In very high-dimensional space, two vectors picked at random are almost always near-orthogonal - their cosine similarity clusters tightly around zero. With 10,000 bipolar dimensions, the chance that two random concepts look alike by accident is astronomically small (the similarity of independent random vectors has a standard deviation of about 1/√D ≈ 0.01). In practice this means there is effectively unlimited room for distinct concepts that never collide.

  • Capacity: millions of distinct symbols can coexist before any two become confusable.
  • Robustness: meaning is spread across all dimensions, so losing some of them barely moves the vector.
  • Stability: small amounts of noise stay small - the geometry does not amplify errors the way low-dimensional spaces do.

Randomness is not a bug here - it is the entire source of capacity. We do not hand-design vectors; we let high-dimensional geometry do the work.

An atomic concept - a word, a symbol, a feature - is represented by a hypervector whose components are each either -1 or +1. This is the bipolar representation, and it is chosen deliberately:

  • Element-wise multiplication of two ±1 vectors is again a ±1 vector - the algebra stays closed and cheap.
  • A bipolar vector is its own inverse under multiplication (x ⊗ x = 1), which is what makes binding reversible.
  • Similarity is just a normalised dot product, computable with integer math - no floating point required for the core.

A single 10,000-dimensional bipolar vector packs into about 1.25 KBif stored as bits. The whole "mind" is a handful of these vectors plus a dictionary mapping names to them - small enough to ship to every browser.

The whole system rests on three operations. That is the entire instruction set of this brain:

  • bind (a ⊗ b) - element-wise multiply. The result is dissimilar to both inputs and is used to associate things, like a role with a value: capital ⊗ Tokyo. Binding is its own inverse, so you can "unbind" later to ask a question.
  • bundle ([a + b + c]) - an element-wise majority vote. It superimposes many vectors into one that stays similar to each input. This is how sets, records and memories are formed - many ideas living inside a single vector at once.
  • permute (ρ a) - a cyclic shift of the components. It makes a dissimilar vector while preserving structure, which lets us encode order, position and time.
OperationOutput similar to input?Reversible?
bindNo - becomes dissimilarYes - bind again to undo
bundleYes - stays similar to allNo - lossy superposition
permuteNo - becomes dissimilarYes - shift back

Bind, bundle, permute. From these three primitives - and nothing else - you can build records, sequences, graphs, and the reasoning below.

Combining many vectors produces a result that is only approximately equal to the clean originals. An item memory (also called cleanup memory) stores every known atomic vector and, given a noisy query, returns the closest one by cosine similarity.

This is the brain's moment of recognition: it takes a smeared, in-between vector that came out of some computation and snaps it back to the nearest real concept. Without cleanup, HDC would drift into noise after a few operations; with it, you can chain operations and still land on crisp, discrete answers.

query  = noisy vector (~70% correct)
cleanup(query) = argmax over all known
                 symbols of cosine(query, symbol)

The three operations compose into rich data structures - all living inside single fixed-size vectors:

  • Records (key-value): bind each field to its value and bundle them. [ name ⊗ Ada + born ⊗ 1815 ]. To read a field, unbind by its key and clean up: cleanup(record ⊗ name) -> Ada.
  • Sequences (order): permute each element by its position before bundling. [ ρ⁰a + ρ¹b + ρ²c ]. Permutation makes position matter, so abc and cba become different vectors.
  • Sets: just bundle the members. Order-independent, membership testable by similarity.
  • Graphs: bind node pairs to edge-type vectors and bundle them into one vector that represents an entire labelled graph.

Everything - a fact, a record, an ordered story, a knowledge graph - ends up as one vector of the same length. That uniformity is what makes the algebra so composable.

A bipolar vector carries exactly one bit of information per dimension, yet a byte array spends eight. hiperbrain ships a bit-packed representation that stores each dimension as a single bit, and the two hottest operations collapse into machine-native instructions:

  • bind becomes a bitwise XOR - 32 dimensions per CPU op instead of one multiply at a time.
  • similarity becomes popcount(a XOR b) - the Hamming distance maps exactly onto cosine via (D − 2·hamming) / D, so the ranking is identical.

The result is an 8xsmaller memory footprint (a 10,000-d vector drops from ~10 KB to ~1.25 KB) and a large speed-up when cleaning a query against many candidates - which is exactly what everyask, analogy and neighbour search does. The readable ±1 form remains the canonical API; the packed path is a transparent accelerator exposed as packBits, bindPacked and similarityPacked.

Reasoning & intelligence

Here is where it stops feeling like a database and starts feeling like a mind. Encode each country as a record: a bundle of bound role/value pairs.

USA    = [ capital ⊗ Washington
         + currency ⊗ Dollar
         + language ⊗ English ]

Mexico = [ capital ⊗ MexicoCity
         + currency ⊗ Peso
         + language ⊗ Spanish ]

Now bind the two whole records together. Every aligned role cancels (because r ⊗ r = 1), leaving a single vector that swaps each country's fillers for the other's. Apply it to Dollar and clean up the result:

cleanup( Dollar ⊗ (USA ⊗ Mexico) )  ->  Peso

Nobody told the brain that "Dollar relates to Peso." It was never taught that pairing. The answer emerges from the algebra itself. This is live on the home page - just type USA is to Dollar as Mexico is to ? and watch it reason.

Black-box models give you an answer and ask you to take it on faith. hiperbrain can show the step in between. When it solves USA is to Dollar as Mexico is to ?, the very first thing the algebra does is recover the relation that connects Dollar to the USA - the role currency - purely as a vector:

role  = cleanup( Dollar ⊗ record(USA) )   ->  currency
answer = cleanup( role  ⊗ record(Mexico) ) ->  Peso

Both steps are exposed: recoverRelation()returns the deduced relation, so the interface can print "deduced relation: currency" beneath the answer. No rules, no lookup table, no prompt - the reasoning is literally two multiplications you can audit.

Every entity also gets a holographic record - one vector that superimposes all of its (relation ⊗ object) pairs. Two entities that share properties (same currency, same continent, same category) end up with similar records, automatically.

So "which concepts are like France?" becomes a single similarity sweep over records - no clustering algorithm, no embeddings model, no training. Type concepts like France on the home page and the brain surfaces its nearest neighbours, ranked by how much of their meaning overlaps. It is emergent structure falling straight out of the algebra.

A recall is only as useful as your ability to trust it. Because the cosine similarity of two random hypervectors has a standard deviation of about 1/√D ≈ 0.01, hiperbrain can express any answer's strength in noise sigmas - how many standard deviations above pure chance the top match sits.

Instead of a hand-picked threshold, every answer is scored on two axes: how far it rises above the noise floor, and how far it leads the runner-up. Only results that clear both are marked confident; everything else is flagged as a guess. That is why the home page can say not just what it thinks, but how sureit is - and why a crowded relation degrades into an honest "unsure" rather than a confident wrong answer.

sigma   = topScore / (1/√D)        // signal vs. chance
margin  = (top - second) / (1/√D)  // lead over runner-up
confident = sigma >= 4 && margin >= 2

It is one function - recallConfidence() - and it is exported from the SDK so your own apps can make the same call.

The same three operations that store facts also store knowledge of a very different shape. Two examples run live, right here, entirely on your CPU.

One-shot language identification

The brain learns four languages from a handful of sentences each - one bundling step per language, no training loop - then labels anything you type by which prototype its n-gram fingerprint is closest to:

detected language
English
English
0.132
French
0.056
Spanish
0.049
German
0.043

Each language is a single prototype vector bundled from its examples. Classifying is one cosine comparison per class - the same trick scales to sentiment, topic or intent with your own labels.

Sequence memory and prediction

An entire ordered list is folded into a single vector by permuting each element by its position; a transition memory predicts what comes next. Pick an item and watch it reason about order:

pick an item - the brain predicts the next
Mondaypredict next →Tuesday
the whole list, replayed from one vector
Monday → Tuesday → Wednesday → Thursday → Friday → Saturday → Sunday

Memory & robustness

Representations are distributed and holographic: every concept is smeared across all 10,000 dimensions, so no single component is essential - exactly like a hologram, where each fragment still contains the whole image, just blurrier. Damage a large chunk of the vector and the memory still resolves correctly.

This is the graceful degradation seen in biological neural tissue, and it is nothing like a normal computer, where flipping a few bits corrupts the data entirely. Don't take our word for it - pick a concept and destroy up to half of its bits; the brain still recognises it:

original
corrupted - 30% of bits flipped
recovered concept
France OK
similarity to original: 0.400
cleanup score: 0.400 (next: Germany 0.012)

Even with a third of its 10,000 dimensions destroyed, the vector still points unmistakably at the right concept. No single bit matters - meaning is smeared across all of them.

There is no training loop, no gradient descent, no model to download. "Learning" a fact is literally one bundling step - a single addition into a memory vector. The brain knows it the instant you teach it.

This is closer to how a person remembers a new name on hearing it once than to how a neural network is trained over millions of examples. It also means there is no catastrophic forgetting in the usual sense: adding a new fact never overwrites an unrelated one, it just superimposes another faint layer onto the relevant memory.

Each relation keeps one bundled memory vector, and a bundle can only hold so much before recall gets fuzzy. So as a relation fills up, answers degrade gradually rather than failing all at once - the same capacity-limited, lossy behaviour as biological associative memory.

To keep recall sharp, hiperbrain stores knowledge two ways at once. Facts are bucketed by relation - all capital-of facts share one vector, all currency-of facts another - so a memory never competes with facts of a different kind. And every subject keeps its own holographic record that superimposes just its (relation ⊗ object) pairs.

When you ask a question, recall prefers the subject's record- whose load is only the handful of facts about that one subject - and falls back to the relation bundle only when that signal is weak, keeping whichever is stronger. That is why currency of France stays razor-sharp even when the brain knows thousands of currencies: the competing load is facts-about-France, not every-fact-with-a-currency. The two paths live in KnowledgeBrain.ask().

The collective system

Because bundling is commutative and order-independent, contributions from thousands of people fold into the same memory without any coordination. Every fact a visitor teaches is stored as a tiny text triple (subject, relation, object) and shared with everyone.

The brain is assembled from those triples on the server and answers your questions there, so it can hold the entire collective memory - hundreds of thousands of facts - without every visitor having to download and rebuild it. New facts stream in live as other people teach them. The vector math is identical for everyone; only the knowledge is shared, and it grows every minute. The brain you interact with is, quite literally, the sum of everyone who came before you. (With the @hiperbrain/core SDK you can rebuild and run that very same brain locally, too.)

The architecture splits storage from recall so the shared brain can scale to the whole collective memory:

  • Server (recall): holds the shared facts and builds the collective brain from them in memory (cached per instance), then answers ask, analogy and neighbour queries with pure hypervector algebra - bind, bundle, permute, cleanup. No GPU, no model. This keeps a hundreds-of-thousands-of-facts brain off every visitor's device.
  • Client (your browser): sends small queries, renders the answers and shows a live sample of the brain. Nothing heavy is downloaded. With the @hiperbrain/core SDK you can run all the same math locally for your own brain, fully offline.
  • Database (Supabase / Postgres): stores the facts as text triples and broadcasts new ones over a realtime channel.
  • Live sync: when anyone teaches a fact, it is written to Postgres, broadcast to every connected browser, and folded into the server brain so recall reflects it.
  • Moderation: every write passes server-side input validation, a content blocklist, per-IP rate limiting, duplicate detection and a global capacity cap before it is accepted.

Reads are cached briefly and the brain is reused between queries, so the shared brain can grow far beyond a single database page while recall stays fast.

A brain the whole internet can write to needs a way to stay clean. Every taught fact carries provenance - where it came from (seed, community or the metered api), who taught it (the wallet, for API writes), a fact-checker verdict and a numeric confidence. An optional citation URL (source_url) and the moment a checker confirmed the claim (verified_at) can ride along too. None of this touches the vectors; it lives alongside the triple so the knowledge can be audited.

Before anything is stored it passes an AI fact-checker, and the gate is deliberately conservative. A claim the checker is confident is false is rejected outright. Only a confident true is trusted straight into the active brain. Anything uncertain - whether the model itself was unsure or the checker was unreachable - is held back as disputed: it is recorded, but it does not feed recall until an admin approves it. So the contradiction-resolution layer is fail-closed for trust (junk never silently enters recall) while still fail-open for availability (nothing is ever lost or hard-blocked).

Worth being precise about: this checker only ever guards what gets written. It never produces an answer. Every recall the brain returns is still pure vector algebra over the hypervectors - there is no language model anywhere in the answer path. hiperbrain is not an LLM; it merely uses one as an optional gatekeeper at the door.

The interesting case is contradiction. Some relations are single-valued: a country has exactly one capital. If someone teaches “the capital of France is Lyon” while the brain already holds Paris, the two cannot both be true. Rather than silently averaging them into a corrupted vector, hiperbrain asks the checker to adjudicate which value is correct:

  • New wins — the new value becomes active and the old one is marked superseded (the brain changed its mind).
  • Existing wins — the established value stays; the new claim is recorded as superseded for the record.
  • Uncertain — the established value is kept active and the new claim is logged as disputed, so a single unverified submission can never knock a good answer out of recall.

Crucially, only active facts feed the brain's math. Superseded and disputed claims are preserved for the /logsconflict view but never pollute a relation's bundled memory. Multi-valued relations (languages spoken, neighbours, members) skip adjudication entirely - a second value there is an addition, not a conflict.

The same guarantee holds when a moderator approves a held fact from the admin queue: if its relation is single-valued, approval automatically supersedes any previous active value, so a manual decision can never leave two competing answers in recall either.

You drive the brain with one input box and a tiny, predictable grammar. There are four things you can say:

  • Teach - state a fact: Tokyo is the capital of Japan or capital of Japan is Tokyo.
  • Ask - query a relation: capital of Japan or what is the capital of Japan.
  • Analogy - reason across records: Japan is to Tokyo as France is to ?.
  • Neighbours - explore meaning: concepts like France or similar to Gold.

On top of that, a small curated relation-alias layer lets you phrase questions the way you actually speak. money of Japan resolves to currency, capital city of Spain to capital, and verb questions like who leads Tesla? or who wrote Hamlet? map onto ceo and author. The mapping is a tiny, explicit table (lib/relation-aliases.ts) - only unambiguous synonyms, never a guess - applied on both write and read so the store stays consistent.

The parser is intentionally simple and transparent - it lives in lib/parse-command.ts - so you always know exactly how your words become vectors. No hidden interpretation, no language model guessing your intent. And if you misspell a name, a typo-tolerant resolver quietly offers the closest known concept.

The engine is famously tolerant of noise inside its vectors - so why should a single typo in your inputdefeat it? It shouldn't. hiperbrain encodes every known name into a character-n-gram fingerprint and resolves what you type to the nearest one.

Misspell Frnace, captial or currancyand the resolver still lands on the concept you meant, then offers a one-tap correction. The unigram component makes it robust to transposed letters, while bi- and tri-grams keep genuinely different words apart. It is the brain's fault tolerance applied to the keyboard - shipped as ConceptResolver in the SDK.

Reference

Bold claims deserve a number. The /benchmark page runs a fixed set of known-answer questions against the live brain, every time you open it - nothing is precomputed or cherry-picked.

Because an associative memory should abstain rather than guess, the headline metric is not just accuracy. We report three honest numbers:

  • Accuracy — correct answers over all questions.
  • Precision — correct answers over the questions it answered confidently (using the calibrated sigma threshold).
  • Confident-wrong — the HDC analogue of hallucination: how often it was confident andwrong. A well-calibrated brain keeps this near zero by saying “I don't know” on what it hasn't learned.

That last number is the point: unlike a language model, hiperbrain does not fabricate a plausible answer under pressure. When the signal is weak it abstains, and the benchmark makes that behaviour measurable instead of a marketing claim.

Alongside the scores the page reports the dataset version, how many questions were asked, and the wall-clock latency per query - typically a few milliseconds, because recall is pure hypervector algebra, not a model call.

This is not magic and not an LLM. It does not understand language: beyond a small hand-written alias table for common synonyms, it has no semantic grasp of words, and it cannot chain steps on its own ("the capital of the country whose currency is the Yen").

It knows what it has been taught, and reasons over that with vectors. Recall is probabilistic, so a heavily loaded relation can occasionally return a near-miss. That honesty is the point - everything it does, you can see, measure and verify.

The foundations come from Pentti Kanerva's work on Hyperdimensional Computing and Sparse Distributed Memory, Tony Plate's Holographic Reduced Representations, and later energy-efficient HDC classifiers from Rahimi, Rabaey and others.

The implementation here lives in packages/core/src/ - published as @hiperbrain/core on npm - and is small enough to read end to end, with no hidden weights and no surprises.

Go teach the brain something

Is this a large language model?

No. There is no neural network and no training. Concepts are random ±1 vectors, and answers come from explicit vector algebra you can inspect.

Does it use my GPU or call an API?

Neither. All reasoning is integer-ish vector math that runs on your CPU in the browser. The server only stores and syncs text facts.

What happens to facts I teach?

They are stored as a plain (subject, relation, object) triple, moderated, and shared with everyone so the collective brain grows.

Why does it sometimes get an answer slightly wrong?

Recall is similarity-based. When a relation holds a lot of facts, the bundled memory gets crowded and the nearest match can be a near-miss - graceful degradation, by design.

Can I read the source?

Yes - the entire engine is a few small files in packages/core/src/, published as @hiperbrain/core on npm, and the project is open on GitHub.

Hypervector
A vector with thousands of dimensions (here 10,000), each component -1 or +1, used to represent one concept.
Bind (⊗)
Element-wise multiplication; associates two vectors into a new, dissimilar one. Its own inverse.
Bundle (+)
Element-wise majority vote; superimposes vectors into one that stays similar to all of them.
Permute (ρ)
A cyclic shift of components; encodes order and position.
Item / cleanup memory
A dictionary of known vectors that snaps a noisy query back to the nearest real concept.
Cosine similarity
A normalised dot product measuring how aligned two vectors are, from -1 to +1.
Blessing of dimensionality
The fact that random high-dimensional vectors are almost always near-orthogonal, giving enormous capacity.
Holographic representation
Information spread across all dimensions, so any fragment still contains (a blurrier version of) the whole.
Holographic record
One vector per entity that superimposes all its (relation ⊗ object) pairs - the basis for analogy and semantic-neighbour search.
Noise sigma
How many standard deviations (1/√D) a similarity score sits above the chance level of random vectors - the unit of calibrated confidence.
Bit-packing
Storing each ±1 dimension as a single bit, turning bind into XOR and similarity into popcount for an 8x smaller, faster engine.
Hamming distance
The number of positions at which two packed vectors differ; maps exactly onto cosine similarity for bipolar vectors.

The engine that powers this whole site is published as a tiny, dependency-free npm package - @hiperbrain/core. It is the exact same code that runs in the page you are reading: nothing is held back. Drop it into your own project and you get one-shot learning, analogy and fault-tolerant recall in a few kilobytes of math that runs in the browser, Node, Deno, Bun or at the edge.

npm install @hiperbrain/core

Build your own collective memory in four lines:

import { KnowledgeBrain, recallConfidence } from "@hiperbrain/core";

const brain = new KnowledgeBrain();
brain.learn({ subject: "France", relation: "capital",  object: "Paris" });
brain.learn({ subject: "France", relation: "currency", object: "Euro" });
brain.learn({ subject: "Japan",  relation: "currency", object: "Yen" });

brain.ask("France", "capital");           // -> [{ name: "Paris", ... }]
brain.analogy("Yen", "Japan", "France");  // -> [{ name: "Euro", ... }]
brain.recoverRelation("Yen", "Japan");    // -> [{ name: "currency", ... }]
brain.similarConcepts("France");          // -> nearest entities by record
recallConfidence(brain.ask("France", "capital")); // -> { confident, sigma }

Make input robust with the typo-tolerant ConceptResolver, or reach for the raw primitives - bind, bundle, permute, cosineSimilarity - the bit-packed fast path (packBits, bindPacked, similarityPacked) and the Brain facade for records, text classification and sequence memory. Everything is deterministic: the same input always yields the same vector, so results are reproducible and testable.

This half runs fully offline — it knows only what you teach it locally and never calls a server. To reason over the live collective brain instead, the same package also exports HiperbrainClient, a typed client for the credit-metered hosted API (see Token & API below). Local computation stays free; only the hosted client spends credits.

View on npmSource on GitHub

The SDK runs offline and knows only what you teach it. The hiperbrain token unlocks the other half: a credit-metered HTTP API that reasons over the live collective brain — every fact the whole community has ever taught — from your own apps, scripts and agents. The public brain on the home page stays free; the token only meters this programmatic layer.

It is not a replacement for a language model — it is a different tool. Where an LLM guesses, hiperbrain knows exactly what it was taught, reports how sure it is, and never hallucinates. Four things it does that an LLM can't:

  • A shared, living memory: not a private model but one collective, moderated memory that grows as everyone teaches it, streamed live. Give a Discord bot, a game or an app a shared brain without running any backend.
  • No hallucination, calibrated confidence:every answer comes from auditable vector algebra and reports its certainty in noise-sigmas, degrading into an honest “unsure” instead of a confident wrong answer. Built for compliance, automation and anything where a confident mistake is expensive.
  • A grounding tool for AI agents: let an LLM agent call hiperbrain as a verified-facts memory — only AI-checked facts go in, every recall returns a confidence score, and it never invents a relationship that was never taught.
  • Embeddings-free similarity & classification: find related concepts (similarConcepts) or label text by meaning with no embeddings model and no training run — a few kilobytes of math instead of a GPU bill.

It works as a token sink: you burn tokens on Solana, the burn is verified on-chain, and your wallet is granted off-chain credits. A read (ask) costs 1 credit; a permanent, AI-verified write (teach) costs 10. Every burned token is removed from supply forever.

curl -X POST https://www.hiperbrain.com/api/v1/ask \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"subject":"France","relation":"capital"}'

# -> { "answer": "Paris", "confidence": { "confident": true, ... }, "remaining": 999 }

Prefer JavaScript or TypeScript? The same @hiperbrain/core package ships a typed client for the hosted API — HiperbrainClient. The API key is required, and every call spends credits server-side:

import { HiperbrainClient } from "@hiperbrain/core";

const hb = new HiperbrainClient({ apiKey: "hb_live_..." });

await hb.ask("France", "capital");  // -> { answer: "Paris", remaining: 999 } — 1 credit
await hb.teach({ subject: "Slovenia", relation: "capital", object: "Ljubljana" }); // 10 credits
await hb.balance();                 // -> 989 — free

Connect a wallet, burn for credits and mint an API key on the Token & API page. The flow is wired end-to-end and goes live the moment the token mint is set.

Your keys belong to your wallet, not your browser. They are stored encrypted at rest, so you can sign in on the dashboard at any time to re-viewa key (reveal it with the eye icon), copy it, revoke it, or create more — each one spends the same wallet's credits. Credits themselves are tied to the wallet and never expire, so losing a key is harmless: just sign in again and mint a new one.

Every endpoint shares one base URL — https://www.hiperbrain.com — and one path per action. Metered endpoints require an API key in the Authorization: Bearer <key> header; mint a key on the Token & API page. All request and response bodies are JSON. In JavaScript or TypeScript you can skip the raw HTTP and use HiperbrainClient from @hiperbrain/core, which wraps every metered endpoint and throws a typed HiperbrainApiError (with .outOfCredits) on failure.

POST /api/v1/ask — recall an answer. Costs 1 credit.

// Request body
{ "subject": "France", "relation": "capital", "k": 5 }  // k optional (1-10, default 5)

// 200 OK
{
  "answer": "Paris",
  "matches": [{ "name": "Paris", "score": 0.068 }, ...],
  "confidence": { "score": 0.48, "confident": true, "sigma": 6.84 },
  "remaining": 999            // credits left after this call
}

POST /api/v1/teach — add a fact. Costs 10 credits, but only when the fact is genuinely new and lands active in the brain — duplicates, rejected claims and anything held back for review are refunded automatically, so you only pay for knowledge that actually enters recall. An optional source_url attaches a citation, stored as provenance with the fact.

// Request body (source_url is optional)
{ "subject": "Slovenia", "relation": "capital", "object": "Ljubljana",
  "source_url": "https://en.wikipedia.org/wiki/Ljubljana" }

// 201 Created — fact stored, 10 credits charged
{ "status": "added", "fact": {...}, "total": 6116, "remaining": 989 }

// 200 OK — already known, charge refunded
{ "status": "duplicate", "fact": {...}, "total": 6116, "remaining": 999 }

// 200 OK — uncertain/unverifiable, held for review, charge refunded
{ "status": "disputed", "fact": {...}, "reason": "...", "remaining": 999 }

GET /api/credits/balance — check remaining credits. Free.

// 200 OK
{ "balance": 989 }

The wallet flow uses three more endpoints, all driven by the Token & API page: POST /api/solana/prepare builds an unsigned burn transaction, POST /api/credits/redeem turns a confirmed burn signature into credits (idempotent — one burn credits once), and POST /api/credits/key issues a key after you sign a message proving you own the wallet.

POST /api/credits/keys — list every key on your wallet, and DELETE /api/credits/keys— revoke one. Both are driven by the dashboard and require a fresh signature of the “manage API keys” message (the same signature works for both within a short window), so only the wallet owner can view or revoke keys. Keys are stored encrypted at rest, so listing returns the full key for re-display; revoking is immediate and permanent.

// POST body (list) — DELETE adds the key "id" to revoke
{ "wallet": "<address>", "timestamp": 1718000000000, "signature": "<base58>" }

// 200 OK (list)
{ "keys": [
  { "id": "<hash>", "key": "hb_live_…", "label": null,
    "createdAt": "2026-06-17T…", "lastUsedAt": null }
] }

// 200 OK (delete)
{ "ok": true }

Status codes

  • 200 / 201 — success (201 when a fact is created).
  • 400 — malformed body or invalid fact (length, character-set or nonsense checks).
  • 401 — missing or unknown API key.
  • 402 — out of credits. Burn more tokens to top up; nothing is charged on a 402.
  • 404 — key not found when revoking (it is not on this wallet, or was already removed).
  • 409 — the brain is at capacity (the charge is refunded).
  • 422 — the AI fact-checker is confident the claim is false, so the write was rejected (no charge).