Cost lint
Paste a prompt to find what a prefix cache cannot reuse, and what that costs per request.
Mortar checks the text in this request and keeps none of it: nothing is stored, logged or put in a URL. Remove secrets and personal data before you paste.
What this checks
| Pattern | How it is found | Status |
|---|---|---|
A value that changes per request comes before stable text: a timestamp, UUID, request, session or user ID, a name or a generated token cache_hostile_ordering |
Recognised in one prompt. Measured across 2 or more real requests. | Checked |
The same JSON with its keys in a different order per request nondeterministic_ordering |
Measured across 2 or more real requests, by re-encoding JSON with sorted keys. | Checked with 2 or more requests |
| A reusable prefix shorter than a hosted provider's cache minimum | Compared with the reference minimums below. | Shown as a note |
| Tool definitions reordered or changed between requests | These need whole request bodies, which this page does not accept yet. | Not checked yet |
| A model switched in the middle of a conversation | Not checked yet | |
| Conversation history rewritten instead of appended to | Not checked yet |
Hosted providers' cache minimums
The reference figures the check compares a reusable prefix with. Providers set them per model and change them, so the source is the authority.
- OpenAI and Azure OpenAI: 1,024 tokens (source for OpenAI and Azure OpenAI).
- Anthropic: 512–4,096 tokens, depending on the model (source for Anthropic).
- Google Gemini: 2,048–4,096 tokens, depending on the model (source for Google Gemini).
The check cannot see images, cache expiry, or how your provider routes requests to its cache.
Run this from your code
The same check is one API call, with no key, limited to 30 checks a minute per address. Send 2 or more real requests as variants for a measured result.
curl https://api.mortar.one/v1/cost/analyze \
-H "Content-Type: application/json" \
-d '{
"model": "Qwen/Qwen2.5-7B-Instruct",
"variants": ["first real request", "second real request"],
"requestsPerMonth": 1000000
}'
Analyze a prompt documents the request and response, and Write cache-friendly prompts explains how to order a prompt so a cache can reuse it.