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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Add a testcase
kayoch1nffbe5cd899d8
diff --git a/tests/test_litellm/proxy/common_utils/test_callback_utils.py b/tests/test_litellm/proxy/common_utils/test_callback_utils.pynew file mode 100644index 00000000000..ffcab13571b--- /dev/null+++ b/tests/test_litellm/proxy/common_utils/test_callback_utils.py@@ -0,0 +1,27 @@+import sys+import os++sys.path.insert(+ 0, os.path.abspath("../../..")+) # Adds the parent directory to the system path++from litellm.proxy.common_utils.callback_utils import get_remaining_tokens_and_requests_from_request_data++def test_get_remaining_tokens_and_requests_from_request_data():+ model_group = "openrouter/google/gemini-2.0-flash-001"+ casedata = {+ "metadata": {+ "model_group": model_group,+ f"litellm-key-remaining-requests-{model_group}": 100,+ f"litellm-key-remaining-tokens-{model_group}": 200+ }+ }++ headers = get_remaining_tokens_and_requests_from_request_data(casedata)++ expected_name = "openrouter-google-gemini-2.0-flash-001"+ assert headers == {+ f"x-litellm-key-remaining-requests-{expected_name}": 100,+ f"x-litellm-key-remaining-tokens-{expected_name}": 200+ }+