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
test_update_model_cost_map_url
Ishaan Jafferc9d61fcdbac4
diff --git a/litellm/utils.py b/litellm/utils.pyindex ce6b2aa9c6a..4e4a9747e7d 100644--- a/litellm/utils.py+++ b/litellm/utils.py@@ -2365,13 +2365,11 @@ def register_model(model_cost: Union[str, dict]): # noqa: PLR0915loaded_model_cost = litellm.get_model_cost_map(url=model_cost)for key, value in loaded_model_cost.items():- ## get model info ##- try:- existing_model: dict = cast(dict, get_model_info(model=key))- model_cost_key = existing_model["key"]- except Exception:- existing_model = {}- model_cost_key = key+ ## get existing model info from model_cost directly ##+ ## avoid calling get_model_info() as it triggers provider resolution+ ## which can cause side effects like GitHub Copilot OAuth flow+ existing_model: dict = litellm.model_cost.get(key, {})+ model_cost_key = key## override / add new keys to the existing model cost dictionaryupdated_dictionary = _update_dictionary(existing_model, value)litellm.model_cost.setdefault(model_cost_key, {}).update(updated_dictionary)diff --git a/tests/local_testing/test_register_model.py b/tests/local_testing/test_register_model.pyindex 6b170798874..028bdc0abca 100644--- a/tests/local_testing/test_register_model.py+++ b/tests/local_testing/test_register_model.py@@ -62,4 +62,4 @@ def test_update_model_cost_via_completion():pytest.fail(f"An error occurred: {e}")-test_update_model_cost_via_completion()+# test_update_model_cost_via_completion()