Quickstart

Memcone gives your AI app persistent memory in three API calls. No vector database to provision, no embedding index schema, and no migrations — you send text over HTTP; Memcone handles extraction, deduplication, and contradiction handling.

Base URL

Use https://api.memcone.com for every /v1/* request. That hostname is the public API contract: authentication, metering, and retrieval all run on Memcone's side. You never configure a separate backend URL in your app.

Install

No SDK required. Hit the REST API directly.

bash
MEMCONE_API_KEY=mem_live_...
MEMCONE_API_KEY=mem_live_...

Get your key from the dashboard.

Add memory to a chat endpoint

typescript
// app/api/chat/route.ts
export async function POST(req: Request) {
  const { userId, message } = await req.json()

  // 1. Fetch context before your LLM call
  const { result: memory } = await fetch('https://api.memcone.com/v1/context', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.MEMCONE_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ scopeId: userId, task: 'reply to user' }),
  }).then(r => r.json())

  // 2. Inject into your system prompt
  const reply = await openai.chat.completions.create({
    model: 'gpt-4o',
    messages: [
      { role: 'system', content: `About this user: ${memory}` },
      { role: 'user', content: message },
    ],
  })

  // 3. Store the new message async — never blocks your response
  fetch('https://api.memcone.com/v1/remember', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.MEMCONE_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ scopeId: userId, event: message }),
  })

  return Response.json(reply)
}
// app/api/chat/route.ts
export async function POST(req: Request) {
  const { userId, message } = await req.json()

  // 1. Fetch context before your LLM call
  const { result: memory } = await fetch('https://api.memcone.com/v1/context', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.MEMCONE_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ scopeId: userId, task: 'reply to user' }),
  }).then(r => r.json())

  // 2. Inject into your system prompt
  const reply = await openai.chat.completions.create({
    model: 'gpt-4o',
    messages: [
      { role: 'system', content: `About this user: ${memory}` },
      { role: 'user', content: message },
    ],
  })

  // 3. Store the new message async — never blocks your response
  fetch('https://api.memcone.com/v1/remember', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${process.env.MEMCONE_API_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ scopeId: userId, event: message }),
  })

  return Response.json(reply)
}

The three endpoints

| Endpoint | What it does | |---|---| | POST /v1/remember | Extract facts from text and store them | | POST /v1/recall | Semantic search over stored memory | | POST /v1/context | One-call compressed context for LLM injection |

Scopes

Every call takes a scopeId — a string you control. Use it to namespace memory:

bash
scopeId: "user_123"           # per-user
scopeId: "user_123:project"   # per-user per-project
scopeId: "org_456"            # org-wide shared memory
scopeId: "user_123"           # per-user
scopeId: "user_123:project"   # per-user per-project
scopeId: "org_456"            # org-wide shared memory

Memory is always isolated within a scope.

Next steps