feat(router): route Anthropic Messages through virtual models - #5391
Open
m199369309 wants to merge 9 commits into
Open
feat(router): route Anthropic Messages through virtual models#5391m199369309 wants to merge 9 commits into
m199369309 wants to merge 9 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces an independent, token-aware router process for DeepSeek-V4 on Xinference, adding new control-plane REST endpoints, schemas, and an Anthropic Messages protocol adapter to integrate token-aware routing with the existing RESTful API. Feedback on these changes highlights critical startup issues where asyncio.Condition and asyncio.Lock are instantiated outside of an active event loop, which will cause immediate crashes. Additionally, a performance concern was raised regarding the creation of a new httpx.AsyncClient instance for every request, which should be replaced with a shared client to avoid latency and socket exhaustion.
Collaborator
Author
|
Additional CI fix included in b6d2d4c:
Validation:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
x-api-key/Bearer credentials at the Supervisor boundary; only a configured internal Router token is forwardedDependencies
This branch intentionally contains both dependency histories so it can be tested before they merge. After the dependencies merge, it will be rebased onto the latest official
mainso this PR's diff contains only the Anthropic Token Router integration.Tests
pytest -q xinference/api/tests/test_token_router_dispatch.py -k anthropicpytest -q xinference/api/tests/test_anthropic_messages.py xinference/api/tests/test_anthropic_protocol.pypre-commit run --files xinference/api/restful_api.py xinference/api/tests/test_anthropic_messages.py xinference/api/tests/test_token_router_dispatch.py