fix(model-metadata): fall back to LITELLM_KEY for endpoint metadata#4914
Open
malaiwah wants to merge 1 commit into
Open
fix(model-metadata): fall back to LITELLM_KEY for endpoint metadata#4914malaiwah wants to merge 1 commit into
malaiwah wants to merge 1 commit into
Conversation
Contributor
Author
|
Ran the full test suite locally as a follow-up. Current result on this branch/base state is |
23 tasks
3 tasks
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.
What does this PR do?
Falls back to
LITELLM_KEYinfetch_endpoint_model_metadata()when no explicitapi_keyis passed. This fixes custom endpoint metadata and pricing lookups that currently send unauthenticated/modelsrequests and fail with 401s.Related Issue
Fixes #4913
Type of Change
Changes Made
LITELLM_KEYas a fallback inagent/model_metadata.pywhenapi_keyis emptytests/agent/test_model_metadata.pythat verifies theAuthorizationheader is sentHow to Test
source venv/bin/activatepython -m pytest tests/agent/test_model_metadata.py tests/test_model_metadata_local_ctx.py -qfetch_endpoint_model_metadata(..., api_key="")sendsAuthorization: Bearer <LITELLM_KEY>whenLITELLM_KEYis setChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/A