Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Use fastuuid for litellm_call_id (#14346)

Arseny Boykov29309f767c08
diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py
index 4c95d0053fc..6a203748c97 100644
--- a/litellm/litellm_core_utils/litellm_logging.py
+++ b/litellm/litellm_core_utils/litellm_logging.py
@@ -10,7 +10,7 @@ import subprocess
import sys
import time
import traceback
-import uuid
+import fastuuid as uuid
from datetime import datetime as dt_object
from functools import lru_cache
from typing import (
@@ -1714,9 +1714,12 @@ class Logging(LiteLLMLoggingBaseClass):
response_obj=result,
start_time=start_time,
end_time=end_time,
- litellm_call_id=litellm_params.get(
- "litellm_call_id", str(uuid.uuid4())
- ),
+ litellm_call_id=current_call_id
+ if (
+ current_call_id := litellm_params.get("litellm_call_id")
+ )
+ is not None
+ else str(uuid.uuid4()),
print_verbose=print_verbose,
)
if callback == "wandb" and weightsBiasesLogger is not None: