Antimatter

Docs

Files and memory

Search your documents and keep what matters between conversations.

MemoryPOST/v1/memories

Long term memory for your agents and apps. Facts are kept across sessions in a memory space on your key's account and searched by meaning. POST /v1/memories takes memories (texts) or messages (a conversation). From messages, a model reads the facts worth keeping, at most 20, each with a confidence. Then every fact that resembles an existing memory (cosine 0.6 or more) goes to a second step that decides, as mem0 does, whether it is new (ADD), changes a memory (UPDATE), says one is no longer true (DELETE) or is already kept (NONE). A fact nothing resembles is added without asking, and words already kept are NONE without any call. Both steps are chat requests on the cheapest priced text model from a well known lab that writes JSON, under strict JSON, billed as your key, which needs the chat scope. With infer: false nothing is extracted or decided and the key needs only the embeddings scope. Every embedding is an embeddings request on your account. The answer lists each change and x-antimatter-cost-micros is the sum of every call. async: true queues the conversation and returns 202 with a /v1/memory_extractions/{id} to follow.

curl https://useantimatter.com/v1/memories \
  -H "Authorization: Bearer $ANTIMATTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"user": "ada", "messages": [
        {"role": "user", "content": "I moved to Lyon last spring and I am vegetarian."}]}'

curl https://useantimatter.com/v1/memories/search \
  -H "Authorization: Bearer $ANTIMATTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"user": "ada", "query": "where does she live", "top_k": 5}'

A space (POST /v1/memory_spaces) holds up to 5,000 memories and embeds with one model. A request that names none uses your key's default space, made on first use. An agent's key reaches only its agent's spaces. user is your own end user's id. One user's memories are never used in another user's decision or search. Every change is in GET /v1/memories/{id}/history, kept 365 days, after the memory itself is deleted too.

On a chat completion, x-antimatter-memory: default (or a space id) recalls the 5 memories nearest the last user turn, scored 0.3 or more, into one system message after yours, for the request's user. x-antimatter-memory-write: 1 queues the conversation and the answer for extraction after the answer. Both are billed as their own requests and named in the answer's x-antimatter-memory. The same two headers work on /v1/messages, where the recall ends system and the end user is metadata.user_id, and on /v1/responses, where it ends instructions and the end user is user (else safety_identifier). A stream is read as it passes. In a hosted agent run a tool {"type": "memory"} gives the model remember and recall on the agent's own space, billed to its wallet.