SmartMem runs inside your system. It scores each request locally, picks the cheapest model that can still do the job, and reports only the savings. Your prompts and your customers' answers never touch our servers.
One 10 KB file, zero dependencies. Wrap your existing model call — that's the whole integration. Every request after it is routed and counted.
import { SmartMem } from "https://getsmartmem.com/sdk/smartmem.js";
const sm = new SmartMem({ apiKey: "sm_live_..." });
// before: openai.chat.completions.create({ model: "gpt-5.6-sol", messages })
const reply = await sm.complete(
{ messages },
(model) => openai.chat.completions.create({ model, messages })
);Works in Node 18+, serverless functions, edge runtimes and the browser. The file is served straight from this site at /sdk/smartmem.js and is small enough to read in full before you ship it.
Sign up, mint a key on your dashboard. It's shown once and stored only as a hash.
sm.complete() routes locally and calls your provider function with the chosen model.
Each request posts token counts and the routing outcome to your dashboard. Numbers only.
The exact classifier from the embed, running in your browser. Paste a prompt you actually run — it scores it and prices both options side by side.
This runs entirely in your browser. Nothing you type here leaves your device.
Classified as simple (0.041) — needs capability ≥ 0.70. Gemini 3.1 Flash Lite is the cheapest model clearing that bar for a extraction task.
You add one file to your system. It carries the classifier and the price catalog — no network hop to us.
Length, code, multi-step reasoning and task type turn into a difficulty score between 0 and 1, inside your process.
The embed hands your function the cheapest model clearing the capability bar. Your call, your account, your data path.
Only token counts, the model and the cost figures travel to us. Your dashboard totals the savings.
| Model | Capability | $/1M in | $/1M out | Typical latency |
|---|---|---|---|---|
| Claude Opus 5 | 0.99 | $15 | $75 | 3200 ms |
| GPT-5.6 Sol | 0.97 | $1.25 | $10 | 2600 ms |
| Claude Sonnet 5 | 0.94 | $3 | $15 | 1800 ms |
| GPT-5.6 Terra | 0.90 | $0.6 | $4 | 1200 ms |
| Gemini 3.8 Flash | 0.87 | $0.3 | $2.5 | 900 ms |
| GPT-5.6 Luna | 0.81 | $0.15 | $1.2 | 600 ms |
| Gemini 3.1 Flash Lite | 0.74 | $0.075 | $0.3 | 420 ms |
| GPT-5 Nano | 0.70 | $0.05 | $0.4 | 350 ms |
| Grok 4 | 0.95 | $3 | $15 | 2400 ms |
| Grok 4 Fast | 0.84 | $0.2 | $0.5 | 700 ms |
| Grok 3 Mini | 0.76 | $0.3 | $0.5 | 500 ms |
Most production traffic is classification, extraction, formatting and short answers. A top-tier model handles those perfectly — and charges up to 200x more than a small model that handles them just as well.
Every request gets a difficulty score and a minimum capability it must clear. Hard requests still go to the strongest model. Cheap models only get work they can actually finish.
The router is code on your side. Classification happens inside your process, the provider call uses your own account, and the only thing SmartMem ever receives is a savings number.
Your dashboard totals what you would have spent against what the routed model costs, broken down by day and by model. Export-ready numbers, no guesswork.
Routing is a pure scoring function over a price table that runs in your process. No extra network round trip between you and your users, no added latency.
The embed costs nothing to use. No card, no per-request fee, no tier gates on the dashboard.
Sign up, mint a key, wrap one call. The dashboard starts counting immediately.
Get a free key