feat(session): serve Anthropic Messages through SessionCore - #2358
Merged
Merged
Conversation
guapisolo
requested review from
Shi-Dong,
Zhichenzzz,
fzyzcjy,
jybsuper,
maocheng23 and
yueming-yuan
as code owners
August 10, 2026 21:27
guapisolo
force-pushed
the
jiajun/anthropic-session-api
branch
from
August 19, 2026 23:18
264bb23 to
ac27c7d
Compare
Route Anthropic Messages through the existing Miles session core while keeping canonical records OpenAI-shaped. Preserve request policy, reasoning replay, response identity, errors, and eager fake SSE at the HTTP adapter boundary. Keep conversion ownership in the paired SGLang runtime.
guapisolo
force-pushed
the
jiajun/anthropic-session-api
branch
from
August 22, 2026 06:50
011a039 to
46b3db8
Compare
Shi-Dong
approved these changes
Aug 24, 2026
guapisolo
force-pushed
the
jiajun/anthropic-session-api
branch
from
August 29, 2026 02:05
46b3db8 to
9d5232b
Compare
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.
ci-sglang-pr: #35127
Summary
Serve Anthropic Messages through Miles sessions while preserving canonical OpenAI records.
Motivation
Claude Code uses
/v1/messages, while Miles session/TITO previously handled only/v1/chat/completions. Add a strict Anthropic HTTP adapter that reuses the existingSessionCore, retains canonical OpenAI records and response identity, and returns Anthropic JSON or eager fake SSE without moving session lifecycle or TITO ownership.Usage
Design Notes
SessionCore, stores the canonical record, then converts the committed response back to Anthropic JSON or eager fake SSE.anthropic_adapter.pyowns parsing, fixed-feature policy, reasoning replay, and wire framing.sessions.pykeeps route ordering, lifecycle, and core calls.1ed0c902c28ba0c5bf3c79515c940ad8c759e100owns Anthropic/OpenAI conversion.Verification
tests/fast/router/test_session_anthropic.pyandtests/fast/utils/test_utils/test_mock_sglang_server.pyonmiles-h200-dev-2:68 passed, 1 skippedon source46b3db8e.9d5232b3: range-diff equivalent to the tested source; upstream changed none of the five PR files.git diff --check c7d81d47...9d5232b3: passed.Review Focus
anthropic_adapter.py: policy and reasoning-history conversion boundaries.sessions.py: route ordering, commit semantics, and response-ID identity.