Persistent semantic memory for legal AI agents

Pay per call. No signup. Namespace-isolated. Audit-logged.

PYTHON
import httpx

# Store a legal memory
httpx.post("https://api.lawmem.ai/store",
    headers={"Authorization": "Bearer YOUR_KEY"},
    json={
        "text": "Plaintiff alleges breach of NDA. "
                "Disclosure occurred Feb 14 2024. "
                "Seeking $500k damages under NY law.",
        "matter_id": "case-2024-001",
        "agent_id":  "gpt-4-legal"
    }
)

# Recall semantically similar memories
r = httpx.post("https://api.lawmem.ai/recall",
    headers={"Authorization": "Bearer YOUR_KEY"},
    json={"query": "NDA breach damages", "top_k": 5}
)
# → ranked results with cosine similarity scores
Why LawMem.ai

Built for legal AI — not retrofitted from general purpose tools

🔒

Privilege Protected

Namespace isolation ensures one firm's memories never touch another's. Every API key maps to a dedicated tenant_id — enforced at the query level, not the application level.

📋

Audit Ready

Every store and recall is logged with timestamp, wallet, agent ID, and query. PostgreSQL audit trail designed for e-discovery and compliance review. DPA available on request.

⚖️

Legal-Domain Embeddings

Powered by nomic-embed-text — 768-dimensional cosine similarity optimised for dense legal text: contracts, pleadings, depositions, and case notes.

Quick Start

Integrate in under 5 minutes

First 1,000 calls are free — no API key purchase required. After the free tier, x402 payment on Base network handles billing automatically.

Store a memory

curl -X POST https://api.lawmem.ai/store \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Client retained firm for M&A due
      diligence. Target: Acme Corp. NDA
      signed 2024-01-15. Closing Q2 2024.",
    "matter_id": "matter-acme-2024",
    "agent_id":  "due-diligence-agent",
    "source_doc": "retainer_letter.pdf"
  }'

# Returns: { "id": "uuid", "created_at": "..." }

Recall memories

curl -X POST https://api.lawmem.ai/recall \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query":     "M&A due diligence NDA",
    "matter_id": "matter-acme-2024",
    "top_k":     5
  }'

# Returns ranked results with cosine scores
# Each result includes text_preview, score,
# matter_id, agent_id, source_doc, created_at

# After 1,000 free calls → HTTP 402
# Agent pays $0.005 USDC on Base, retries
# with X-PAYMENT header

Store a memory

import httpx

BASE = "https://api.lawmem.ai"
KEY  = "YOUR_KEY"
HDR  = {"Authorization": f"Bearer {KEY}"}

def store(text, matter_id, agent_id="agent",
          source_doc=None):
    r = httpx.post(f"{BASE}/store",
        headers=HDR,
        json={
            "text":       text,
            "matter_id":  matter_id,
            "agent_id":   agent_id,
            "source_doc": source_doc,
        }
    )
    if r.status_code == 402:
        # Free tier exhausted — pay via x402
        handle_payment(r)
        return
    r.raise_for_status()
    return r.json()["id"]

Recall memories

def recall(query, matter_id=None, top_k=5):
    r = httpx.post(f"{BASE}/recall",
        headers=HDR,
        json={
            "query":     query,
            "matter_id": matter_id,
            "top_k":     top_k,
        }
    )
    if r.status_code == 402:
        # x402: pay $0.005 USDC on Base
        # Retry with X-PAYMENT header after
        # submitting tx to eip155:8453
        handle_payment(r)
        return []
    r.raise_for_status()
    return r.json()["results"]

# results[0] → {
#   "id": "...", "score": 0.87,
#   "text_preview": "...",
#   "matter_id": "...", "created_at": "..."
# }

Store a memory

const BASE = "https://api.lawmem.ai";
const KEY  = "YOUR_KEY";

async function store(text, matterId, agentId) {
  const res = await fetch(`${BASE}/store`, {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${KEY}`,
      "Content-Type":  "application/json",
    },
    body: JSON.stringify({
      text:      text,
      matter_id: matterId,
      agent_id:  agentId,
    }),
  });

  if (res.status === 402) {
    const body = await res.json();
    // body.accepts[0].payTo  → USDC receiver
    // body.accepts[0].maxAmountRequired → units
    // body.accepts[0].network → eip155:8453
    await handleX402Payment(body);
    return;
  }

  return (await res.json()).id;
}

Recall memories

async function recall(query, matterId, topK=5) {
  const res = await fetch(`${BASE}/recall`, {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${KEY}`,
      "Content-Type":  "application/json",
    },
    body: JSON.stringify({
      query:     query,
      matter_id: matterId,
      top_k:     topK,
    }),
  });

  if (res.status === 402) {
    // x402: free tier exhausted
    // Submit USDC tx on Base mainnet
    // Retry with X-PAYMENT: 
    await handleX402Payment(await res.json());
    return [];
  }

  const { results } = await res.json();
  return results; // sorted by cosine score
}
Pricing

Start free. Pay only when you scale.

Subscription plans via Stripe. Pay-as-you-go via x402 on Base. No credit card for free tier.

Free
$0
No payment, no signup
  • 1,000 lifetime calls
  • All endpoints included
  • Namespace isolation
  • Audit logs
  • 768-dim embeddings
Pay-as-you-go
$0.005/call
x402 on Base mainnet
  • No monthly commitment
  • USDC on Base (eip155:8453)
  • Automatic x402 payment
  • Audit logs
  • No cap
Legal Pro DPA
$499/mo
$0.0033/call — save 33% vs pay-as-you-go
  • 150,000 calls/month included
  • Overage at $0.005/call via x402
  • Namespace isolation
  • DPA included
  • Priority support
Enterprise
Custom
For large-scale deployments
  • Custom volume & pricing
  • Custom SLA
  • SOC 2 docs on request
  • Procurement support
  • [email protected]
Trust & Security

Built for compliance from day one

🔐

SSL Secured

TLS 1.3 via Let's Encrypt. Auto-renewed. HSTS enabled.

🏛️

Namespace Isolated

Every API key is bound to a tenant_id. No cross-tenant data leakage — enforced at query level.

📄

Audit Logged

Every store, recall, and delete recorded in PostgreSQL with wallet, timestamp, and query hash.

📑

DPA Available

Data Processing Agreement available to Legal Pro members.

⛓️

Live on Base Network

Receiver wallet: 0x5F503…1fEAD ↗

🗑️

Right to Erasure

DELETE /memory/{id} performs a hard delete from both vector store and PostgreSQL for legal compliance.