litellm/ui
moe-berri 56009d32dd feat(auto_router): add a shunt preset that bounds large reads and delegates codegen
Ports the shunt technique for Claude Code
(https://engineering.atspotify.com/2026/9/portal-by-spotify-cut-my-claude-code-token-usage-by-90)
into the auto router, server-side, so it works for any client with no plugin to install.

shunt intercepts large file reads and boilerplate generation at the client with PreToolUse
hooks and hands them to a cheap worker model. This makes the same decision on the proxy: a
new always-on ShuntGuardrail injects bulk_read and code_write tool definitions pre-call, then
post-call rewrites large Read/Bash/bulk_read/code_write tool_use blocks into a Bash command
carrying shunt's own wc -l conditional, so small files still get read directly and only large
ones are delegated. Two new endpoints, /v1/bulk_read and /v1/code_write, run the worker call
through llm_router.acompletion with shunt's verbatim system prompts, so worker spend is
tracked against the calling key and team like any other request.

The guardrail arms per request off an auto-router marker's own litellm_params
(auto_router_shunt_min_lines and the two worker-model fields), the same shape
auto_router_compression already uses, so no guardrails: config entry is needed. It stays
inert when the resolved model has no shunt config.

In the UI, "Shunt" is one entry in the existing preset dropdown. Its tiers resolve through
fallback chains against whatever models the proxy actually has, so it greys out only when
there are no chat models at all, never merely because the named models are absent, and all
three settings stay editable under Advanced.

Streaming buffers the whole response before rewriting, matching tool_permission.py, because
input_json_delta fragments split mid-token. An unparseable stream passes through untouched:
shunt is an optimization, not a safety control, so a request should never fail because the
rewrite could not run.

The CLI's Bash allow rules only reduce prompts for the generated commands. Claude Code
matches rule text before the first wildcard with no host-aware matching, so they cannot pin
the destination, and the docs recommend a PreToolUse hook where a real boundary is needed.
2026-09-07 13:37:28 -07:00
..
litellm-dashboard feat(auto_router): add a shunt preset that bounds large reads and delegates codegen 2026-09-07 13:37:28 -07:00
Dockerfile fix(docker): bump nginx runtime to 1.31.5-alpine3.24 and pin digest to resolve critical CVEs (#39561) 2026-09-03 08:46:07 -07:00
nginx.conf fix(ui): boot the UI image as an arbitrary uid by anchoring nginx writes under /tmp (#37982) 2026-08-24 11:57:36 -07:00