Skip to content

feat(openrouter): inject session_id for session grouping - #3477

Open
Lee-Si-Yoon wants to merge 1 commit into
charmbracelet:mainfrom
Lee-Si-Yoon:feat/openrouter-attribution
Open

feat(openrouter): inject session_id for session grouping#3477
Lee-Si-Yoon wants to merge 1 commit into
charmbracelet:mainfrom
Lee-Si-Yoon:feat/openrouter-attribution

Conversation

@Lee-Si-Yoon

@Lee-Si-Yoon Lee-Si-Yoon commented Aug 1, 2026

Copy link
Copy Markdown

Summary

Crush does not inject session_id into the request body when using OpenRouter, so downstream providers cannot group requests by session.

Changes

  • injectOpenrouterSessionID: Helper that injects session_id into ProviderOptions.ExtraBody via session.HashID(). No-op for non-OpenRouter providers (type assertion guards internally).
  • Applied to three request paths: run(), Summarize(), and runSubAgent().

…cky routing

Add HTTP-Referer and X-Title headers to OpenRouter requests so usage
is attributed to Crush on the OpenRouter dashboard. Inject session_id
into the request body via ProviderOptions.ExtraBody for sticky routing
and downstream provider session grouping.

Resolves charmbracelet#3467
@Lee-Si-Yoon
Lee-Si-Yoon force-pushed the feat/openrouter-attribution branch from 09967c0 to d90b949 Compare August 1, 2026 08:54
@Lee-Si-Yoon Lee-Si-Yoon changed the title feat(openrouter): send app attribution headers and session_id for sticky routing feat(openrouter): send HTTP-Referer/X-Title headers and session_id for sticky routing Aug 1, 2026
@Lee-Si-Yoon Lee-Si-Yoon changed the title feat(openrouter): send HTTP-Referer/X-Title headers and session_id for sticky routing feat(openrouter): inject session_id for session grouping Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant