Integrate in a few lines
One SDK, two lanes. Web2 spends credits against an API key; Web3 pays per call over x402 and needs no account.
// npm i @decentrify/memory-sdk import { DecentrifyMemory } from "@decentrify/memory-sdk"; // create an API key on the Account page once you're signed in const memory = new DecentrifyMemory({ baseUrl: "https://memory.decentrifylabs.com", apiKey: process.env.DECENTRIFY_API_KEY, encryptionKey: process.env.DECENTRIFY_ENCRYPTION_KEY, }); const saved = await memory.save("User prefers concise answers.", ["prefs"]); await memory.search("prefs"); // matches topics await memory.get(saved.id); // decrypted locally await memory.verify(saved.id); // integrity proof await memory.delete(saved.id);
// an agent that pays per call over x402 (Base Sepolia) import { DecentrifyMemory } from "@decentrify/memory-sdk"; import { wrapFetchWithPayment, x402Client } from "@x402/fetch"; import { ExactEvmScheme } from "@x402/evm/exact/client"; import { privateKeyToAccount } from "viem/accounts"; const signer = privateKeyToAccount(process.env.PRIVATE_KEY); const client = new x402Client().register("eip155:84532", new ExactEvmScheme(signer)); const memory = new DecentrifyMemory({ baseUrl, paymentFetch: wrapFetchWithPayment(fetch, client), encryptionKey: process.env.DECENTRIFY_ENCRYPTION_KEY, owner: signer.address, }); await memory.save("agent memory", ["x402"]); // 402 paid + retried automatically
// claude_desktop_config.json — memory tools inside Claude or Cursor { "mcpServers": { "decentrify-memory": { "command": "npx", "args": ["-y", "@decentrify/mcp"], "env": { "DECENTRIFY_API_KEY": "dk_your_key", "DECENTRIFY_ENCRYPTION_KEY": "your-passphrase" } } } }
# create a key on the Account page, then call the gateway
URL=https://memory.decentrifylabs.com
KEY=dk_your_key
curl -s -XPOST $URL/gw/memory/save \
-H "authorization: Bearer $KEY" -H "content-type: application/json" \
-d '{"content":"remember this","topics":["notes"]}'Encryption changes what search can see
With client-side encryption on — the SDK default — the server stores ciphertext and cannot index your content. Search matches topics only. Tag anything you intend to find later.
Topics stay plaintext by design, which is the trade that keeps search working at all. Lose the passphrase and the content is unrecoverable, including by us.
Two ways to pay
Credits — sign in, create a key, spend prepaid credits. Free to start, and you can request more from inside the app.
x402 — an agent signs a micropayment per call and settles on Algorand, Base or Solana. No account, no key. Base is the easiest rail: payments are gasless via EIP-3009, so the wallet needs only test USDC.
Get an API keyEndpoints
| Call | Web2 (credits) | Web3 (x402) | Credits |
|---|---|---|---|
| Save | POST /gw/memory/save | POST /v1/memory/save | 5 |
| Search | GET /gw/memory/search | GET /v1/memory/search | 2 |
| Get | GET /gw/memory/:id | GET /v1/memory/:id | 2 |
| Verify | POST /gw/memory/verify | POST /v1/memory/verify | 1 |
| Delete | DELETE /gw/memory/:id | DELETE /v1/memory/:id | 1 |
Free and unauthenticated: GET /health,
GET /catalog. Web2 calls also accept your browser session, which is
how the console works.