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]

Merge branch 'litellm_internal_staging' into litellm_lit_7022_azure_ai_passthrough_config

mateo-berria6681950e817
diff --cc litellm/router.py
index 5117d33a520,b4f48fa9496..a20f010c608
--- a/litellm/router.py
+++ b/litellm/router.py
@@@ -98,7 -98,7 +98,8 @@@ from litellm.litellm_core_utils.sensiti
mask_credentials_in_payload,
mask_sensitive_structure,
)
+ from litellm.litellm_core_utils.token_counter import offload_token_count
+from litellm.llms.base_llm.passthrough.transformation import replace_path_segment
from litellm.llms.base_llm.vector_store.transformation import (
RouterVectorStoreEmbeddingExecutor,
vector_store_request_metadata,
diff --cc tests/test_litellm/litellm_core_utils/test_token_counter.py
index 1898fd57220,7da04d12569..60f25c48443
--- a/tests/test_litellm/litellm_core_utils/test_token_counter.py
+++ b/tests/test_litellm/litellm_core_utils/test_token_counter.py
@@@ -1,11 -1,15 +1,16 @@@
#### What this tests ####
# This tests litellm.token_counter.token_counter() function
+ import asyncio
+import base64
import importlib
+ import threading
import time
import traceback
+ from concurrent.futures import Future, wait
+ from typing import Final
from unittest.mock import MagicMock
+ import anyio.to_thread
import pytest
import tiktoken
@@@ -15,10 -19,13 +20,15 @@@ import litell
from litellm import create_pretrained_tokenizer, decode, encode, get_modified_max_tokens
from litellm import token_counter as token_counter_old
import litellm.constants
+ from litellm.constants import TOKEN_COUNTER_MAX_CONCURRENT_COUNTS
+ from litellm.litellm_core_utils.asyncify import asyncify
from litellm.litellm_core_utils.token_counter import (
+ _get_exact_count_function,
+ _get_extrapolating_count_function,
_get_tiktoken_count_function,
+ calculate_img_tokens,
+ high_detail_image_token_upper_bound,
+ offload_token_count,
)
from litellm.litellm_core_utils.token_counter import token_counter as token_counter_new
from tests.large_text import text