You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/prefix_cache.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,30 @@ Prefix cache is block-granular. If a shared prefix ends in the middle of a block
17
17
18
18
If `--prefix-cache-max-tokens` is omitted, the cache defaults to roughly 25% of GPU KV blocks in this project.
19
19
20
+
## Usage Reporting
21
+
22
+
OpenAI-compatible chat responses include prefix-cache and reasoning token details when they are non-zero:
23
+
24
+
```json
25
+
{
26
+
"usage": {
27
+
"prompt_tokens": 128,
28
+
"completion_tokens": 64,
29
+
"total_tokens": 192,
30
+
"prompt_time_costs": 4,
31
+
"completion_time_costs": 250,
32
+
"prompt_tokens_details": {
33
+
"cached_tokens": 64
34
+
},
35
+
"completion_tokens_details": {
36
+
"reasoning_tokens": 32
37
+
}
38
+
}
39
+
}
40
+
```
41
+
42
+
`prompt_tokens_details.cached_tokens` reports the number of prompt tokens reused from the prefix cache. `completion_tokens_details.reasoning_tokens` reports generated tokens inside reasoning blocks such as `<think>...</think>`. Both detail objects are omitted when their count is zero.
43
+
20
44
## Hybrid Mamba snapshot stride
21
45
22
46
For hybrid Mamba models, prefix reuse also needs compatible snapshot boundaries.
0 commit comments