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
feat(telemetry): capture prefix-cache effectiveness (cache_n, cached_tokens) and route-switch counts (#2968)
* feat(telemetry): capture prefix-cache effectiveness and route-switch counts
Closes#2955.
- Record llama-server timings.cache_n and OpenAI-wire
usage.prompt_tokens_details.cached_tokens as cache_tokens
(latest per model + cumulative totals), on streaming and
non-streaming paths, local and cloud.
- Count collection.router decisions and per-conversation route
switches, keyed by a stable conversation fingerprint (hash of
system prompt + first user message; metrics key only).
- Expose everything in GET /v1/stats and Prometheus /metrics.
- TelemetryCallback now passes StreamingProxy::TelemetryData instead
of five scalars so backend-reported fields extend without churn.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(telemetry): address review — stale cache gauge, cloud usage injection, Responses field
- cache_tokens latest gauge resets to unreported (JSON null) on every
recorded request, so a request that reports nothing can no longer
inherit the previous request's value.
- Cloud streaming injects stream_options.include_usage when the client
did not request it and swallows the resulting usage-only frame, so
telemetry gets provider usage while the client-visible stream is
unchanged; client-requested usage frames pass through untouched.
- Streaming parser also reads Responses-API
usage.input_tokens_details.cached_tokens.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(telemetry): atomic per-request recording and non-streaming Responses capture
- Collapse the three per-request telemetry recorders into one
record_request_telemetry_for_model() under a single lock hold, so
concurrent requests can no longer interleave fields (one request's
cache reset landing on another's value).
- TelemetryData carries prompt_tokens; StreamingProxy::extract_telemetry()
parses complete response bodies (usage chat/Responses field names,
cached-token details, llama.cpp timings), replacing the duplicated
handler blocks.
- Non-streaming /v1/responses now records telemetry, including
usage.input_tokens_details.cached_tokens.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
-`prompt_tokens` - Total prompt tokens including cached tokens
1272
+
-`cache_tokens` - Prompt tokens served from the backend's prefix cache on the last request (llama.cpp `timings.cache_n`, or `usage.prompt_tokens_details.cached_tokens` / Responses-API `input_tokens_details.cached_tokens` from OpenAI-compatible cloud providers). `null` when the last request did not report cache usage
1273
+
-`*_total` - Cumulative counters since server start
1274
+
-`routing_decisions_total` - Routing decisions made by `collection.router` dispatch
1275
+
-`routing_switches_total` - Routing decisions that changed a conversation's routed model (a proxy for route ping-pong; conversations are identified by a hash of the system prompt and first user message)
**Date:** July 27, 2026 · **Author:** Lemonade Team
4
+
5
+
> Lemonade v11.5 adds ModelScope as a second model registry, right next to Hugging Face. Same search box, twice the catalog.
6
+
7
+
## Twice the catalog, same search box
8
+
9
+
Starting with v11.5, Lemonade supports [ModelScope](https://modelscope.cn) as a model registry alongside Hugging Face. Search it the same way you search Hugging Face — right from the Model Manager — and download models from whichever registry has what you need. This matters most for users in regions where ModelScope mirrors are significantly faster, and for models that publish to ModelScope first.
10
+
11
+
There's nothing to set up — no accounts, no extra configuration. Type a name, browse the GGUF variants, and hit download.
12
+
13
+
And you won't waste a download on a repo that can't run. Before a result earns a download button, Lemonade inspects the repository's actual file tree and only offers models with GGUF files it can serve. What you see is what will run.
14
+
15
+
## Take it for a spin
16
+
17
+
Open the Lemonade app (or the web app at `http://localhost:13305/app`) and head to the **Model Manager**. Start typing — `Qwen 2.5`, say. After three characters the search goes live, and two new sections appear below your local models: **FROM HUGGING FACE** and **FROM MODELSCOPE**.
18
+
19
+

20
+
21
+
Every result tells you what you're getting before you commit: the repository name, a source badge (**MS** or **HF**), the download size, and how many times the community has pulled it. Want a different quantization? Pick one from the dropdown — Q4_K_M is preselected as a sensible default. Then click download and watch it go.
22
+
23
+

24
+
25
+
When the download finishes, the model registers itself and is ready to use — select it in the chat panel, point your favorite OpenAI-compatible client at it, whatever you'd do with any other Lemonade model. Where it came from stops mattering the moment it lands on your disk.
26
+
27
+

28
+
29
+
## Prefer a terminal?
30
+
31
+
The CLI speaks ModelScope too. Give `lemonade pull` a checkpoint and tell it where to look — or just paste a `modelscope.cn` model URL and it figures out the rest.
Add `format=gguf` to bias results toward GGUF repositories, or `limit` to control how many come back (1–50, default 12). Responses include tags, task, download counts, and a GGUF hint per model — see the [API docs](https://lemonade-server.ai/docs/api/lemonade/) for the full shape.
44
+
45
+
## Go find something new
46
+
47
+
Update to Lemonade v11.5 and search both registries from one box.
48
+
49
+
[Install Lemonade](https://lemonade-server.ai/#getting-started) · [Join the Discord](https://discord.gg/5xXzkMu8Zk)
0 commit comments