diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 9c13b1854..9548025d5 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -914,6 +914,7 @@ class LiteLLM_SpendLogs(LiteLLMBase): class LiteLLM_ErrorLogs(LiteLLMBase): request_id: Optional[str] = str(uuid.uuid4()) + api_base: Optional[str] = "" model_name: Optional[str] = "" model_id: Optional[str] = "" request_kwargs: Optional[Json] = {} diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index 81ea8961a..c9d94288e 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -1239,6 +1239,9 @@ async def _PROXY_failure_handler( _litellm_params = kwargs.get("litellm_params", {}) or {} _metadata = _litellm_params.get("metadata", {}) or {} _model_id = _metadata.get("model_info", {}).get("id", None) + + api_base = litellm.get_api_base(model=_model, optional_params=_litellm_params) + verbose_proxy_logger.debug( "\nexception_type", _exception_type, @@ -1252,8 +1255,10 @@ async def _PROXY_failure_handler( traceback, ) error_log = LiteLLM_ErrorLogs( + request_id=str(uuid.uuid4()), model_name=_model, model_id=_model_id, + api_base=api_base, exception_type=_exception_type, status_code=_status_code, exception_string=str(_exception), diff --git a/schema.prisma b/schema.prisma index 7f81ed16a..e9acfe188 100644 --- a/schema.prisma +++ b/schema.prisma @@ -186,6 +186,7 @@ model LiteLLM_SpendLogs { // View spend, model, api_key per request model LiteLLM_ErrorLogs { request_id String @id @default(uuid()) + api_base String @default("") model_name String @default("") // public model_name / model_group model_id String @default("") // ID of model in ProxyModelTable request_kwargs Json @default("{}")