fix gigachat passthrough url, authenticator, get_api_base

This commit is contained in:
KnyazSh 2026-04-17 08:31:03 +03:00
parent 211388ac51
commit c4e5dbc38b
3 changed files with 1 additions and 12 deletions

View file

@ -130,12 +130,6 @@ async def get_access_token_async(
litellm_params: Optional[dict] = None,
) -> str:
"""Async version of get_access_token."""
credentials = credentials or _get_credentials()
if not credentials:
raise GigaChatAuthError(
status_code=401,
message="GigaChat credentials not provided. Set GIGACHAT_CREDENTIALS or GIGACHAT_API_KEY environment variable.",
)
if not litellm_params:
litellm_params = {}

View file

@ -36,12 +36,8 @@ class GigaChatPassthroughConfig(BasePassthroughConfig):
if base_target_url is None:
raise Exception("GigaChat api base not found")
litellm_metadata = litellm_params.get("litellm_metadata") or {}
model_group = litellm_metadata.get("model_group")
if model_group and model_group in endpoint:
endpoint = endpoint.replace(model_group, model)
complete_url = f"{base_target_url}/{endpoint.lstrip('/')}"
complete_url = f"{base_target_url}/chat/completions"
return (
httpx.URL(complete_url),
base_target_url,

View file

@ -30,6 +30,5 @@ def convert_usage(usage_data: dict[str, int]) -> Usage:
)
@staticmethod
def get_api_base(api_base: Optional[str] = None) -> Optional[str]:
return api_base or get_secret_str("GIGACHAT_API_BASE") or GIGACHAT_BASE_URL