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]

initialize tiktoken environment at import time to support offline usage

Milan3f99a91a47e5
diff --git a/litellm/__init__.py b/litellm/__init__.py
index e5c09702b9b..46124bf8363 100644
--- a/litellm/__init__.py
+++ b/litellm/__init__.py
@@ -80,6 +80,10 @@ import dotenv
litellm_mode = os.getenv("LITELLM_MODE", "DEV") # "PRODUCTION", "DEV"
if litellm_mode == "DEV":
dotenv.load_dotenv()
+
+# Import default_encoding to ensure environment variables are initialized at import time
+from litellm.litellm_core_utils import default_encoding # noqa: F401
+
####################################################
if set_verbose:
_turn_on_debug()