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]

(perf sdk) - minor changes to cost calculator to run helpers only when necessary (#7704)

Ishaan Jaff71e679246adb
diff --git a/litellm/utils.py b/litellm/utils.py
index 6205293e1d0..87bf1f142d9 100644
--- a/litellm/utils.py
+++ b/litellm/utils.py
@@ -3890,9 +3890,11 @@ def _strip_model_name(model: str, custom_llm_provider: Optional[str]) -> str:
elif custom_llm_provider and (custom_llm_provider == "databricks"):
strip_version = _strip_stable_vertex_version(model_name=model)
return strip_version
- else:
+ elif "ft:" in model:
strip_finetune = _strip_openai_finetune_model_name(model_name=model)
return strip_finetune
+ else:
+ return model
def _get_model_info_from_model_cost(key: str) -> dict:
@@ -3969,7 +3971,7 @@ def _get_potential_model_names(
)
combined_stripped_model_name = "{}/{}".format(
custom_llm_provider,
- _strip_model_name(model=model, custom_llm_provider=custom_llm_provider),
+ stripped_model_name,
)
return PotentialModelNamesAndCustomLLMProvider(