Fix load credentials in token counter proxy

This commit is contained in:
eycjur 2025-09-23 12:33:39 +00:00
parent be193fbffd
commit b4512cb1e7

View file

@ -35,6 +35,7 @@ from litellm.constants import (
LITELLM_SETTINGS_SAFE_DB_OVERRIDES,
)
from litellm.litellm_core_utils.safe_json_dumps import safe_dumps
from litellm.utils import load_credentials_from_list
from litellm.types.utils import (
ModelResponse,
ModelResponseStream,
@ -5894,6 +5895,7 @@ async def token_counter(request: TokenCountRequest, call_endpoint: bool = False)
pass
if deployment is not None:
litellm_model_name = deployment.get("litellm_params", {}).get("model")
load_credentials_from_list(deployment.get("litellm_params", {}))
# remove the custom_llm_provider_prefix in the litellm_model_name
if "/" in litellm_model_name:
litellm_model_name = litellm_model_name.split("/", 1)[1]