Conversation
Signed-off-by: Deepak Jain <deepujain@users.noreply.github.com>
|
Understand this PR’s impact Explore downstream dependencies and potential security impact with Blast Radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: NVIDIA-NeMo/Switchyard/.coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. WalkthroughThe upstream response-header allowlist now forwards ChangesResponse header forwarding
Priority: ➖ Normal Estimated code review effort: 1 (Trivial) | ~5 minutes Severity of issue fixed: Medium 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
A rabbit checks the headers in a row Comment |
|
I checked this against LiteLLM’s docs. |
|
Agreed, thanks for checking against their docs. The PR forwards the header verbatim only when LiteLLM sends it and makes no claim about streaming cost accuracy; no behavior change is needed on that front. I can add a note to the PR description capturing the streaming caveat if that would be useful. |
|
LGTM. Approved. We’ll merge this once the 0.3 release code freeze ends. Thank you for the contribution! |
What
Adds
x-litellm-response-costto the forwarded upstream response headers, so LiteLLM's per-request cost header reaches Switchyard clients the same way it does on direct LiteLLM routes. One regression test covers the allowlist.Why
Fixes #805. The header was dropped by the allowlist gate, so cost tracking broke on
switchyard/...routes while directopenai/openai/...routes carried it.Notes for reviewers
Start at
FORWARDED_UPSTREAM_HEADERSincrates/switchyard-server/src/lib.rs. The header is a plain numeric cost, not a credential, so it is safe to expose downstream. Validated with rustc 1.96.1:cargo fmt --all -- --check,cargo clippy -p switchyard-server --all-targets(plus--features prefill-router),cargo test -p switchyard-server(56 passed),cargo clippy --workspace --all-targets,cargo test --workspace(all suites green), andcargo test -p switchyard-runner --features prefill-router(green). The new test fails with the allowlist entry removed.Summary by CodeRabbit
New Features
x-litellm-response-costheader.Bug Fixes