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]

test(pricing): pin the realtime mode assertion to the bundled cost map (#33806)

yuneng-jiangc8b36dc1d4cc
diff --git a/tests/test_litellm/test_gpt_realtime_mode.py b/tests/test_litellm/test_gpt_realtime_mode.py
index 80cb3cc85f0..4413cbc12ef 100644
--- a/tests/test_litellm/test_gpt_realtime_mode.py
+++ b/tests/test_litellm/test_gpt_realtime_mode.py
@@ -68,8 +68,16 @@ def test_realtime_only_gpt_4o_models_are_mode_realtime(model):
assert _load_cost_map()[model]["mode"] == "realtime"
-def test_get_model_info_reports_realtime_mode():
- assert litellm.get_model_info("gpt-realtime-mini")["mode"] == "realtime"
+def test_get_model_info_reports_realtime_mode(monkeypatch):
+ """get_model_info must resolve the retag against the bundled cost map, not the
+ hosted map fetched from main, which lags this repo until the next promotion."""
+ monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
+ monkeypatch.setattr(litellm, "model_cost", litellm.get_model_cost_map(url=""))
+ litellm.get_model_info.cache_clear()
+ try:
+ assert litellm.get_model_info("gpt-realtime-mini")["mode"] == "realtime"
+ finally:
+ litellm.get_model_info.cache_clear()
def test_backup_matches_main_for_realtime_models():