Start of the prompt
The system prompt, tool definitions, reference documents and the earlier turns of the conversation, in the same order on every call.
Prompt caching
No request parameter turns it on. Tokens served from cache are billed at the cached-input rate, 5 to 50 times lower than the input rate depending on the model. The script sends one long system prompt twice and prints how many prompt tokens each response took from cache.
BASE_URL=https://direct.api.mnma.ai/v1
P=$(python3 -c \
"print('Fixed text. ' * 4000)")
for q in "Reply OK." "Reply YES."; do
jq -n --arg p "$P" --arg q "$q" '{
model: "deepseek-v4.1-flash",
max_tokens: 64,
messages: [
{role: "system", content: $p},
{role: "user", content: $q}]}' |
curl -s $BASE_URL/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d @- |
jq -c '.usage | {prompt_tokens, cached:
.prompt_tokens_details.cached_tokens}'
done
# A 14,044-token prompt:
{"prompt_tokens":14044,"cached":0}
{"prompt_tokens":14044,"cached":13952}
The check
deepseek-v4.1-flash, with no cache parameter in the request.
| Model | Test | Repeat calls that hit | Cached tokens on a hit |
|---|---|---|---|
| deepseek-v4.1-flash | Same 14,000-token system prompt; the user message differs by one digit | 2 of 2 | 13,952 of 14,044 |
| glm-5.3-flash | Same 14,000-token system prompt; the user message differs by one digit | 2 of 2 | 13,824 of 14,465 |
On glm-5.3-flash the repeat call came back in 1.5 s instead of 3.5 s. Your hit rate, by model and key, is under “Cache hit rate” on the console dashboard.
Cached-input rates
Published prices in USD per 1 million tokens. Output is billed at the output rate whether or not the prompt hit the cache.
| Model | Input / 1M | Cached input / 1M | Input ÷ cached |
|---|---|---|---|
| deepseek-v4.1-flash | $0.30 | $0.006 | 50 |
| glm-5.3 | $1.40 | $0.26 | 5.4 |
| glm-5.3-flash | $0.15 | $0.03 | 5 |
| kimi-k3.1-pro | $1.715 | $0.198 | 8.7 |
| qwen3.8-2.4t | $2.00 | $0.25 | 8 |
A bill
So the formula takes the hit rate h as an input. Each response's usage has your own P, U and O: cached_tokens, the rest of prompt_tokens, and completion_tokens.
cost per call = (
h × P × c
+ (1 − h) × P × i
+ U × i
+ O × o ) / 1,000,000
P prompt prefix repeated every call
U new prompt tokens per call
O output tokens, reasoning included
h cache hit rate, from 0 to 1
i input price per 1M tokens
c cached-input price per 1M tokens
o output price per 1M tokens
( 0.8 × 14,000 × 0.006
+ 0.2 × 14,000 × 0.30
+ 1,000 × 0.30
+ 500 × 1.20 ) / 1,000,000
= (67.2 + 840 + 300 + 600) / 1,000,000
= $0.0018072 per call
× 100,000 calls = $180.72
| 100,000 calls | deepseek-v4.1-flash | glm-5.3 | glm-5.3-flash | kimi-k3.1-pro | qwen3.8-2.4t |
|---|---|---|---|---|---|
| 0% hit rate | $510.00 | $2,320.00 | $250.00 | $3,064.15 | $3,300.00 |
| 50% hit rate | $304.20 | $1,522.00 | $166.00 | $2,002.25 | $2,075.00 |
| 80% hit rate | $180.72 | $1,043.20 | $115.60 | $1,365.11 | $1,340.00 |
| 100% hit rate | $98.40 | $724.00 | $82.00 | $940.35 | $850.00 |
Every figure is computed from the published rates.
Cache-friendly prompts
The cache reuses the identical beginning of a prompt, so one changed token early on makes everything after it new input.
Start of the prompt
The system prompt, tool definitions, reference documents and the earlier turns of the conversation, in the same order on every call.
End of the prompt
Timestamps, request IDs, user names and the new question.