feat(router): add token-aware virtual model routing - #5375
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces an independent, token-aware router for DeepSeek-V4 on Xinference, adding a persistent SQLite-backed configuration store, an in-memory runtime registry, and new REST endpoints for router management and internal runtime coordination. It also integrates a proxy layer into the restful API to route chat completions dynamically based on token budgets or typed rules. The review feedback highlights critical improvement opportunities: avoiding resource leaks on early stream disconnects by using Starlette's BackgroundTask instead of generator finally blocks, reusing a shared httpx.AsyncClient to prevent connection overhead, replacing a slow copy.deepcopy with a shallow copy during message normalization, and fixing a string concatenation typo ("t" "e").
bf47e91 to
44c4d61
Compare
qinxuye
left a comment
There was a problem hiding this comment.
Found several blocking correctness and lifecycle issues in the current head.
3cdc7ee to
e27f701
Compare
Summary
xinference-routerdata-plane process with process-isolated tokenization, admission control, typed first-match routing rules, and HTTP/SSE proxyingllm_chatroute profileXINFERENCE_TOKEN_ROUTER_ENABLEDfeature gate (disabled by default)Validation
pre-commit run --files <modified files>Follow-ups
Tokenizer asset management, bundled assets, Web UI, Agent orchestration, and monitoring are intentionally split into dependent PRs.