NashHQDocs Open the app

Server API

The NashHQ server keeps each agent token's memory, serves the agents' metadata and fixed pictures, and runs chats with the holder's own AI key. The app talks to it over HTTPS.

Note

The server is live at https://api.nashai.tech; <base> below stands for it. Plain HTTP is never accepted.

Conventions:

  • Every agent ID is an integer from 1 to 10,000.
  • Errors are JSON: { "error": "text" }.
  • Tiers: flux = $NASH (Nash Flux), core = $NASHAI (NashAI Core), super = Super Agent (a later stage). The same wallet holding #id in both $NASH and $NASHAI is Twin Equilibrium (twin).
Status Meaning, on every route
400 Bad ID, tier or body
401 Not signed in, or the session expired (see Sign-in)
403 The wallet does not hold this token
413 Body too large
429 A limit was reached; Retry-After gives the seconds to wait
503 The server could not read BNB Chain. Nothing was changed: ownership checks fail closed

Limits on the sign-in routes are counted per network block (an IPv6 /48 for sign-in, a /64 elsewhere; one IPv4 address). A full block answers 429 to the new request and never ends anyone's session or pending sign-in.

Who holds #id#

The server's one ownership rule, read on chain before every chat and every change of skill settings: the holder of $NASH #id (ownerOf), of $NASHAI #id (ownerAt), or of Super Agent #id (NashSuperAgent.holderOf, zero when #id is not fused). While #id is fused, both agents are owned by the fusion vault, and the vault is never a holder.

Sign-in#

The holder signs in once per browser session with Sign-In with Ethereum (EIP-4361, personal_sign, no gas). The wallet itself checks the first line against the page it runs on, so a signature asked for by another site cannot be used on NashHQ.

  1. POST /api/auth/nonce (no body) returns { "nonce": "…", "expiresAt": <unix ms> }. The nonce is 128 random bits, lives 10 minutes and is accepted once.

  2. The wallet signs exactly this text (line breaks \n, no trailing spaces):

    <app host> wants you to sign in with your Ethereum account:
    <checksummed address>
    
    Sign in to NashHQ to chat with your agents and save their skill settings. This does not send a transaction or cost gas.
    
    URI: https://<app host>
    Version: 1
    Chain ID: 56
    Nonce: <nonce>
    Issued At: <ISO 8601 UTC>
    Expiration Time: <ISO 8601 UTC, at most 24 h after Issued At>
    

    <app host> is app.nashai.tech, the only app host the server accepts.

  3. POST /api/auth/verify with { "message": "<the text>", "signature": "0x…" }. The server parses the text strictly (exactly these lines, in this order) and checks: the host is one of its own app hosts and URI matches it; Version 1; Chain ID 56; the nonce is one it issued, unused and unexpired (this call spends it, whatever the result); Issued At is within 5 minutes of the server clock; Expiration Time is in the future and at most 24 h after Issued At; the signer is the address in the text. It returns { "token": "<43 characters>", "address": "0x…", "expiresAt": <unix ms> }.

  4. Every chat and skill-settings request sends Authorization: Bearer <token>. The token lasts 8 hours or until Expiration Time, whichever comes first. The server keeps only a hash of it, in memory, so a server restart signs everyone out. The app keeps the token in session storage and drops it when the wallet or account changes.

  5. POST /api/auth/logout with the bearer token forgets it: { "success": true }.

Signing in proves the wallet only. Ownership is still read on chain before every chat and every settings change. The signature goes to verify once and is never sent again.

Note

Smart-contract wallets (ERC-1271, for example a Safe) cannot sign in yet. Use the wallet's own key account for chat and pictures.

Memory#

One memory per token: the key is (tier, number), so $NASH #id (tier flux) and $NASHAI #id (tier core) have two separate memories. The server picks the memory from ownership, checked on chain before every chat, never from the request:

The wallet holds Mode Context sent to the model A transferable turn is written to
$NASH #id only flux the last 12 rows of the flux memory the flux memory
$NASHAI #id only core the last 12 rows of the core memory the core memory
both (Twin Equilibrium) twin the last 30 rows of both memories merged both memories
Super Agent #id (fused) super the same as twin both memories
  • Only transferable turns are written. Each turn is 2 rows: user, then assistant.
  • ephemeral turns are never written.
  • Twin merge: all rows of both memories sorted by created_at, flux before core on a tie, each memory keeping its own order; a row equal in role, content and created_at to one already taken (a Twin turn, stored in both) is taken once; then the last 30.
  • Twin Equilibrium and a Super Agent get 2× the daily chat limit. The limit itself is not decided yet and is published here once it is.

Hold for a new holder#

A memory stays with its token when the number is burned and minted again, so the next holder inherits it. To make that slower to abuse, a memory is neither read nor written for a wallet that has held its token for less than 1 hour (flux: $NASH #id; core: $NASHAI #id; super: the Super Agent). A Twin whose one side is still in its hour chats on the settled side only, in flux or core mode. When no memory is past its hold, chat answers 429 with Retry-After. The hour counts from the token's last transfer to that wallet, read on chain; if the server cannot read that, it answers 503 and nothing opens (it fails closed, so a holder who sold and bought back cannot skip the hold). The same hold applies to Core skills settings. One wallet can chat with at most 20 different numbers a day.

Memory root#

memoryRoot = keccak256(utf8(JSON.stringify(rows)))
rows       = every stored row of ONE memory (tier + number), oldest first (by row id), each exactly { "role", "content", "created_at" }
             in that key order; role "user" | "assistant", created_at = unix seconds (integer)

No memory = keccak256("[]"). The app and the server compute the root with the same code.

Memory hash — GET /api/agent/:id/memory-hash?tier=flux|core#

Public, no sign-in: a hash shows nothing of the chats. tier is required (missing or anything else = 400).

{ "tokenId": 42, "tier": "core", "interactionCount": 18, "memoryRoot": "0x…" }

interactionCount is the number of stored rows of that memory.

The holder of $NASHAI #id may seal the core root on chain with NashERC8004Controller.sealMemoryRoot(id, memoryRoot): opt-in, the holder pays the gas, no ERC-8004 activation needed. memoryRoot(id) and getMemoryRoot(id) read the last seal, and the MemorySealed(tokenId, root, sealer, timestamp) events are the history (sealedBy(id) = who made the last seal). Equal roots mean the server's core memory of #id is the one that was sealed, so a buyer can check it before buying. The flux root is public too but has no seal. See Contracts.

Chat — POST /api/agent/:id/chat#

Header Value
Authorization Bearer <token> from Sign-in
x-llm-provider openrouter · openai · anthropic · gemini · deepseek
x-llm-model the model name
x-llm-key the holder's key: used for this request only, never logged, never written to disk

Body:

{ "message": "…", "tier": "flux", "memory": "transferable" }
  • tier: "flux" or "core". A hint only: the server decides from what the wallet holds (table under Memory).
  • memory: "transferable" (saved to the agent's memory) or "ephemeral" (Private: not saved).

The server maps the provider to its URL itself. There is no header for a base URL, so a request can never point the server, with your key, at any other host.

x-llm-provider URL the server calls
openrouter https://openrouter.ai/api/v1/chat/completions
openai https://api.openai.com/v1/chat/completions
anthropic https://api.anthropic.com/v1/chat/completions
gemini https://generativelanguage.googleapis.com/v1beta/openai/chat/completions
deepseek https://api.deepseek.com/chat/completions

These URLs were checked against each provider's own documentation on 2026-11-28. Anthropic describes its OpenAI-compatible route as meant for testing, not as a long-term production route. Any other provider = 400. Redirects are refused, a call times out after 60 seconds and an answer over 1 MB is dropped (502). The provider's own error text is never passed back (it can echo the key); the app gets { "error": "The AI provider refused the request (401)." } with the provider's status only.

Response:

{
  "reply": "…",
  "mode": "flux",
  "isTwinEquilibrium": false,
  "memoryHits": 3,
  "updatedMemoryRoots": { "flux": "0x…" }
}
Field Meaning
mode "flux", "core", "twin" (Twin Equilibrium) or "super" (Super Agent)
isTwinEquilibrium true in twin and super
memoryHits how many stored rows were sent to the model as context for this reply
updatedMemoryRoots the root after this turn of each memory the chat used: flux or core, both in twin and super (unchanged after a Private turn)

401 = the token is unknown or expired: the app signs in again once and retries. 403 = the wallet does not hold the agent.

Action nonce — POST /api/auth/action-nonce#

Every change of Core skills settings needs a fresh one-use action nonce. No second wallet prompt.

{ "action": "skill-save", "tokenId": 42, "tier": "core" }

Sent with Authorization: Bearer <token>. action is "skill-save" or "skill-clear". The response is { "actionNonce": "<32 characters>", "expiresAt": <unix ms> }. The nonce is tied to that session, action, number and tier, lives 5 minutes and is accepted once (spent by the first request that names it, whatever the result). So a captured request cannot be replayed or pointed at another number, or at the other token of the same number.

Pictures the server serves#

An agent's picture and name are fixed, like those of any NFT: there is no upload, no custom name and no picture route that takes anything from anyone. <tier> is flux, core or super; <id> is 1 to 10,000, digits only; anything else = 404.

Path What it is
GET /avatars/<tier>/<id>.webp The picture of that token, a fixed file. Flux until the traits reveal: the Flux default picture (the original Flux model, the same for every number); after it: the card of #id, the same bytes as the file on IPFS. Core and Super: that tier's default picture
GET /avatars/default/flux.png, core.png, super.png (and .webp) The fixed picture of each tier. super is used only once Super Agents are live

The server draws nothing while it runs: every file it serves was made before it started (the default pictures shipped with it, the Flux cards rendered once at the reveal). All pictures are public and sent with X-Content-Type-Options: nosniff and Content-Security-Policy: default-src 'none'.

Metadata — GET /api/metadata/:id?tier=flux|core|super#

The tokenURI of both agent tokens and of the Super Agent while their base URI points at this server ($NASH until the Flux reveal, then IPFS). No sign-in. Standard NFT fields only. See Agent metadata for the response and the move to IPFS.

ERC-8004 registration file — GET /api/agent-card/:id.json#

The agent URI that NashERC8004Controller registers for an activated Core agent (agentCardBaseURI + id + ".json"). Public. Only $NASHAI numbers activated on chain have one; any other number = 404. Its chain read (is #id activated) runs from a cache with a small fixed budget: when that budget is spent it answers 503 and the reader tries again later. See Agent metadata.

Core skills#

Warning

Live, except alerts. The routes are live. The watcher that writes alerts is not running yet, so no alert is written for now. See Core skills for what the skills do.

Skills watch public BNB Chain data for a Core agent's holder and plan on paper. No skill route builds, signs, sends or returns a transaction: no calldata, no approval, no permit, no typed-data or signature request. A skill is fixed code, never a tool of the AI model. Every simulated number travels inside an object with "simulation": true, and no route returns a returns figure, an APY or a profit field. Not financial advice.

  • Who: the holder of $NASHAI #id (?tier=core, so a Twin too) or, once Super Agents exist, of Super Agent #id (?tier=super), read on chain before every request. ?tier=flux = 403. The 1-hour hold for a new holder applies as for chat (429 with Retry-After).
  • Whose data: settings and alerts belong to (tier, number, holder wallet). When #id changes hands, the old holder's settings and alerts for that token are deleted and never shown to the new holder.
  • Sign-in: every route below except the skill list needs Authorization: Bearer <token>. A save or clear also needs x-action-nonce from the action nonce route with skill-save or skill-clear.

Skill list — GET /api/skills#

Public, no sign-in. The fixed list the server knows, with each setting's type and bounds, so the app draws its forms from it:

id Level What it watches or plans
launch-watch L1 watch New launches on Four.meme (Flap once its contracts are read), flagged by fixed rules
lp-range L1 watch One of the five NashHQ pools against a range the holder typed in
arb-watch L1 watch Price gaps between two routes through the NashHQ pools
inventory L1 watch The holder's token shares against targets
venus-guard L1 watch The holder wallet's Venus health factor
mm-paper L2 paper A market-making simulation with a paper budget
grid-paper L2 paper A dynamic grid simulation on a made-up price path, with a paper budget

Each entry has live (a skill with live: false answers 409 "Not live yet") and fields, each setting's type and bounds.

Settings#

  • GET /api/agent/:id/skills?tier=core|super: the skills this holder saved for that token.
  • PUT /api/agent/:id/skills/:skill?tier=core|super with x-action-nonce (skill-save): the settings object, JSON, at most 4 KB. Every field is required, typed and bounded; an unknown, missing or out-of-range field = 400 and nothing changes. Response { "success": true, "updatedAt": <unix s> }.
  • DELETE /api/agent/:id/skills/:skill?tier=core|super with x-action-nonce (skill-clear), no body: removes the setting and its alerts. Response { "success": true }.

At most one setting per skill per token, 30 writes per wallet per hour. No setting holds free text or an address: only numbers, booleans, values from fixed lists and, for grid-paper, decimal strings (digits with one optional dot, checked against a fixed pattern; never letters, signs, spaces or an exponent).

Skill Settings
launch-watch sources (["four"] for now), minLevel ("watch" or "high"), alertOnCopycatOfMine (a new token using the symbol of a token this wallet holds)
lp-range pool (one of nashx-wbnb, nashx-nash, nashx-nashai, nash-wbnb, nashai-wbnb), profile ("narrow", "balanced", "wide"), lowerTick < upperTick within −887200 … 887200
arb-watch minGapBps: 350 … 5000 (under about 300 bps the three pool fees take the whole gap)
inventory targets: 1 to 5 of { token, targetPct } with token one of NASH, NASHAI, NASHX, WBNB, USDT, sum ≤ 100; driftPct: 1 … 50
venus-guard minHealth: 1.05 … 3.00
mm-paper pool, spreadBps 10 … 2000, riskAversion 0.01 … 10, inventoryCap 1 … 100 (% of the paper budget), dailyLossKillPct 1 … 50, paperBudgetUsd 100 … 100000 (paper only, never a real balance)
grid-paper see Dynamic grid settings below

Dynamic grid settings#

The grid maths is ported from the team's own grid terminal and runs in the browser at 50 significant digits. The field names follow that terminal's grid configuration, so the port can be checked against it; that is why they are snake_case. Values kept as decimals travel as decimal strings (^\d{1,13}(\.\d{1,20})?$, at most 20 significant digits), never as JSON numbers, so nothing is rounded on the way. Integers are JSON integers (a float, a boolean or a string = 400). Every field is required; an unknown key = 400.

Field Type and bounds
pool one of bnb-usdt, nash-wbnb, nashai-wbnb, nashx-wbnb; the server maps the id to its own pool address, never one from the request
min_price, max_price decimal strings, 1e-12 to 1e12, min_price < max_price <= 20 × min_price; quote per base of pool
spacing "auto" | "manual"
rungs integer 2 to 500 when spacing is auto, else null
spacing_bps decimal string 0.01 to 5000, at most 2 decimals, when spacing is manual, else null
placement integer −100 to 100; 0 when spacing is manual
take_profit_bps decimal string 0.01 to 5000, at most 2 decimals
total decimal string 1 to 10,000,000, at most 2 decimals: the paper capital in the pool's quote token, never a real balance
shape "spot" | "curve" | "bid_ask"
weighting integer −100 to 100
concentration integer 0 to 100
dynamic.mode "trailing" | "rebalance_on_exit" | "schedule"
dynamic.trailing_trigger_bps, dynamic.schedule_min_move_bps decimal strings 0 to 5000, at most 2 decimals
dynamic.exit_grace_seconds, dynamic.cooldown_seconds integers 0 to 86,400
dynamic.schedule_minutes integer 5 to 10,080
dynamic.max_rebalances_per_day integer 1 to 100
run.moves boolean: the range moves (dynamic) or stays (static) in the paper run
run.days integer 1 to 30
run.volatility_pct integer 1 to 50
run.seed integer 1 to 1,000,000

The paper run walks a seeded, made-up price path: it shows how the grid would behave on that path and is not a forecast. "Dynamic" means the re-centre and the rebalance rule; there is no volatility-based spacing. An optional "suggest a range" in the app comes from NashHQ's own LP range skill and is labelled so. The only alert this skill may ever raise is "the range would move now" (rebalance_due on the live pool price), never an order.

Alerts#

  • GET /api/agent/:id/alerts?tier=core|super&after=<alert id>: newest first, at most 50. Each alert has id, skill, kind, createdAt, seen and a data object of numbers, fixed ids and checksummed addresses.
  • POST /api/agent/:id/alerts/seen?tier=core|super with { "upTo": <alert id> } marks alerts seen (bearer only). Response { "success": true }.
Skill kind
launch-watch flagged-launch (with the rule ids that flagged it and the token's own symbol)
lp-range out-of-range, back-in-range
arb-watch price-gap
inventory drift
venus-guard health-low
mm-paper paper-kill (with "simulation": true)

A launch's symbol is text chosen by a stranger: at most 16 printable characters, shown as text only, never as HTML or a link. Alerts are kept 7 days, at most 200 per token. They are delivered in the app only, which asks every 30 seconds while it is open (at most 6 reads per wallet per minute). No e-mail, no Telegram, no push: the server stores no contact details. The watcher that writes alerts is its own process with a read-only connection to BNB Chain and no key.

Skills in chat#

In core, twin or super chat, the server may add the holder's 10 newest alerts of that token to the model's context as quoted data, never as instructions, and without any launch's symbol. The model can explain them. It cannot start a skill, change a setting or ask for a transaction: chat has no tools and a reply is text only.