fix(router): resolve litellm_credential_name in get_deployment_credentials_with_provider

When models are created via UI with pre-existing credentials, they use
litellm_credential_name to reference credentials stored separately.

The batch file upload endpoint uses get_deployment_credentials_with_provider()
to retrieve model credentials, but this method was returning the credential
reference name instead of resolving it to actual API keys and endpoints.

This fix adds credential resolution using CredentialAccessor.get_credential_values()
to ensure UI-created models work the same as YAML-configured models for batch
file uploads and other passthrough endpoints.

Fixes: Batch file uploads failing with 'Missing credentials' error for UI models
This commit is contained in:
Milan 2026-02-19 00:54:39 +02:00
parent a9058bb584
commit b601d8855b

View file

@ -6750,6 +6750,13 @@ class Router:
**deployment.litellm_params.model_dump(exclude_none=True)
).model_dump(exclude_none=True)
# Resolve litellm_credential_name to actual credentials
if deployment.litellm_params.litellm_credential_name is not None:
credential_values = CredentialAccessor.get_credential_values(
deployment.litellm_params.litellm_credential_name
)
credentials.update(credential_values)
# Add custom_llm_provider
if deployment.litellm_params.custom_llm_provider:
credentials[