feat(openrouter): pass session_id in extra_body for sticky routing
OpenRouter supports a session_id field in extra_body that pins multi-turn conversations to the same provider endpoint, enabling prompt cache reuse across turns. The session_id was already threaded through to build_extra_body() but never included in the returned dict. Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
kshitij
co-authored by
Claude Opus 4
parent
0554ef1aa3
commit
e8b9369a9d
@@ -98,6 +98,11 @@ class TestOpenRouterProfile:
|
||||
body = p.build_extra_body(provider_preferences={"allow": ["anthropic"]})
|
||||
assert body["provider"] == {"allow": ["anthropic"]}
|
||||
|
||||
def test_extra_body_session_id(self):
|
||||
p = get_provider_profile("openrouter")
|
||||
body = p.build_extra_body(session_id="test-session-123")
|
||||
assert body["session_id"] == "test-session-123"
|
||||
|
||||
def test_extra_body_no_prefs(self):
|
||||
p = get_provider_profile("openrouter")
|
||||
body = p.build_extra_body()
|
||||
|
||||
Reference in New Issue
Block a user