static audit · 2026-10-25T22:32:13.198Z

mem0ai/mem0

120 source files scanned · 30 LLM call site(s) · ~7% of LLM spend looks recoverable (static heuristics)

$3.2per 10k runs today (gpt-4.1-nano, ~2000 prompt tokens)
$2.98per 10k runs with fixes applied

badge   ![TokenZero audit](https://tokenzero.sh/v1/badge/audit/aud_2btQaJlHcMRYGzpp9jGndQ.svg)

repo badge   [![LLM spend audited by TokenZero](https://tokenzero.sh/v1/badge/repo/mem0ai/mem0.svg)](https://tokenzero.sh/audit/mem0ai/mem0)

Models referenced

gpt-4.1-nano-2025-04-14 ×2
gpt-4o ×1 (cheaper sibling: gpt-4o-mini)

Findings

SeverityWhereFindingEst.
mediummem0-ts/src/oss/src/prompts/index.ts:2829 static prompt template(s), ~22,148 tokens, and no caching directive anywhere in the repo
Most call sites use providers with automatic prefix caching, which only pays off when these templates are sent as a byte-identical prefix: static template first, nothing volatile (dates, ids, user data) interpolated into it.
Fix: Keep templates first and static; TokenZero adds a stable `prompt_cache_key` so related requests land on the same cache.
12%

Fix all of it with one line

OPENAI_BASE_URL=https://tokenzero.sh/v1
ANTHROPIC_BASE_URL=https://tokenzero.sh

Keys pass through untouched. Cache formatting and exact caching are on by default; cascade routing stays opt-in. How it works