llm-host/llmhost
neil a250812d42 MLX: count prompt tokens while prefill runs, not when the request ends
The proxy only added a request's prompt tokens from the final usage chunk, so a
long prefill showed as a flat prompt rate and then one spike (prompt size over a
2 s sample), and requests the client abandoned mid-prefill were never counted.
mlx_lm.server already streams ": keepalive <done>/<total>" after each prefill
step; count those as they pass through, and top up from the usage chunk. Also
leave out prompt-cache hits (cached_tokens), which take no processing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QaE1hpvyZTJixEbUUMj9Ca
2026-11-02 13:50:10 -08:00
..
backends MLX: count prompt tokens while prefill runs, not when the request ends 2026-11-02 13:50:10 -08:00
web Dashboard: time to first token tile and chart 2026-11-02 08:12:07 -08:00
__init__.py Initial llm-host: hardware-aware local LLM server with dashboard 2026-11-02 03:51:06 -08:00
__main__.py Initial llm-host: hardware-aware local LLM server with dashboard 2026-11-02 03:51:06 -08:00
catalog.json Add Ornith 1.5 9B for 16 GB Macs and 16 GB GPUs 2026-11-02 05:32:35 -08:00
cli.py MLX: cap KV caches and recover from crashes; add llmhost watch 2026-11-02 07:45:12 -08:00
hfcache.py MLX: cap KV caches and recover from crashes; add llmhost watch 2026-11-02 07:45:12 -08:00
hw.py Initial llm-host: hardware-aware local LLM server with dashboard 2026-11-02 03:51:06 -08:00
opencode.py Offer to install opencode and connect it to the local server 2026-11-02 05:37:35 -08:00
paths.py Initial llm-host: hardware-aware local LLM server with dashboard 2026-11-02 03:51:06 -08:00
plan.py MLX: cap KV caches and recover from crashes; add llmhost watch 2026-11-02 07:45:12 -08:00
service.py Initial llm-host: hardware-aware local LLM server with dashboard 2026-11-02 03:51:06 -08:00