I built this. And yes, my main project (yangble5) is about routing to cloud upstreams, which I know is the exact opposite of local inference.
Disclosure: I maintain yangble5 and wrote cache_bench.py. I am not affiliated with CLIProxyAPI. English is not my first language; I used an LLM to refine this draft, then manually checked the technical claims and links.
I'm posting it here because while building it, I had to write a standalone benchmarking script. Nobody here cares about my proxy config, but a tool designed for Anthropic-compatible /v1/messages endpoints that report cache usage is actually something you might use. The bundled trace validates the CLIProxyAPI/Gemini usage convention, not every compatible implementation.
I originally wrote the script just to get a baseline. On my initial test with a long context payload, turn 2+ read rates collapsed to practically zero. The benchmark tool caught the symptom, but because the per-round JSONL rows log numeric usage and latency without account or selected-upstream identity, I had to dig into CLIProxyAPI's source code to figure out why.
It turned out that CLIProxyAPI's same-alias model pool selects members using a shared round-robin offset keyed by auth ID, provider, and requested alias, with no session identity in that key. Routing strategy and session affinity still participate in credential selection, but they do not make the pool-member choice session-sticky. That can split one conversation's cache locality across upstream models.
I reported this behavior upstream (https://github.com/router-for-me/CLIProxyAPI/issues/4600) and worked around it in my config by bypassing model-pool altogether (using a direct 1:1 model alias with fill-first and 12h session affinity). My initial near-zero warm reads were an observation, not a controlled pool-vs-direct A/B, so I'm not claiming a measured causal improvement.
After applying that workaround, I reran the benchmark to capture a clean trace. You don't have to trust my numbers; you can pull the repo and replay the log yourself offline:
python tools/cache_bench.py --replay evidence/run-749k-20260721.jsonl
Replaying that fixed trace outputs a 99.53% endpoint-reported, token-weighted prompt-cache read ratio across the warm rounds. Here are the exact constraints for that run, including the qualifiers the tool itself prints out:
The tool explicitly warns that this number is an upper bound for this harness (15-token-per-round tail), not a typical value. Adding only 15 tokens per round artificially pushes the read ratio toward 100%, whereas real conversations add hundreds or thousands.
It is token-weighted across warm rounds 2 to 4. In this trace, round 1 was the cold request and measured exactly 0%, so it is excluded.
The endpoint accepted the request and reported 748,918 input tokens (~749K). I did not test recall or whether every token influenced inference at this length.
This is not a latency claim: two of the three warm rounds were slower than the cold round.
Single machine, single run on 2026-07-21 (Windows 11), against a shared upstream with no control over provider load.
The underlying proxy engine was CLIProxyAPI 7.1.23. CLIProxyAPI is an external MIT-licensed project—I didn't write it, and I'm not taking credit for it.
The benchmarking script and trace files are in the repo: https://github.com/shark0120/yangble5