-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: adding default headers and testing for litellm fetcher #5242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
…atting - Reorder header spread in router-provider.ts so user-provided openAiHeaders can override DEFAULT_HEADERS - Remove unnecessary blank lines after imports for consistency - This matches the pattern used in openai.ts where DEFAULT_HEADERS come first
daniel-lxs
approved these changes
Jun 30, 2025
Member
daniel-lxs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @andrewshu2000 for your contribution!
Looks good
mrubens
approved these changes
Jul 1, 2025
hannesrudolph
pushed a commit
that referenced
this pull request
Jul 3, 2025
* chore: adding x-title header and testing for litellm * chore: indentation fi and headers order fix * chore: spacing fix * chore: removed white space * fix: allow user headers to override default headers and clean up formatting - Reorder header spread in router-provider.ts so user-provided openAiHeaders can override DEFAULT_HEADERS - Remove unnecessary blank lines after imports for consistency - This matches the pattern used in openai.ts where DEFAULT_HEADERS come first --------- Co-authored-by: Brendan-Z <[email protected]> Co-authored-by: Daniel Riccio <[email protected]>
utarn
pushed a commit
to modelharbor/ModelHarbor-Agent
that referenced
this pull request
Jul 4, 2025
…Inc#5242) * chore: adding x-title header and testing for litellm * chore: indentation fi and headers order fix * chore: spacing fix * chore: removed white space * fix: allow user headers to override default headers and clean up formatting - Reorder header spread in router-provider.ts so user-provided openAiHeaders can override DEFAULT_HEADERS - Remove unnecessary blank lines after imports for consistency - This matches the pattern used in openai.ts where DEFAULT_HEADERS come first --------- Co-authored-by: Brendan-Z <[email protected]> Co-authored-by: Daniel Riccio <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
lgtm
This PR has been approved by a maintainer
PR - Needs Review
size:S
This PR changes 10-29 lines, ignoring generated files.
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.
Related GitHub Issue
Closes: #1300
Description
This PR adds support for sending default headers with all LiteLLM API requests to track the originating app. PR #1300 previously added these headers for other providers but they were missed for LiteLLM.
Implementation details:
RouterProviderto include DEFAULT_HEADERS in the OpenAI client initializationThe implementation ensures that both the OpenAI client used by the RouterProvider (which LiteLLMHandler extends) and the direct axios requests in the LiteLLM model fetcher include the default headers.
Test Procedure
cd src pnpm vitest run api/providers/fetchers/__tests__/litellm.spec.tsHTTP-RefererandX-Titleheaders are present in requestsPre-Submission Checklist
Screenshots / Videos
N/A - This change affects backend API requests only, with no visual changes.
Documentation Updates
Additional Notes
The DEFAULT_HEADERS object contains:
These headers help with tracking and attribution of API requests.
Get in Touch
Discord: 183852721751719936, 189214917033852928
Important
Adds
DEFAULT_HEADERSto LiteLLM API requests and updates tests to verify header inclusion.DEFAULT_HEADERSto LiteLLM API requests inlitellm.tsandrouter-provider.ts.litellm.spec.tsto verify inclusion ofDEFAULT_HEADERSin requests.This description was created by
for 3ab37c7. You can customize this summary. It will automatically update as commits are pushed.