Skip to content

Commit fd6eee0

Browse files
committed
[feat] enhance model pricing registration to merge with existing pricing details
1 parent d33c751 commit fd6eee0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

edenai_apis/llmengine/clients/litellm_client/litellm_client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,11 @@ async def acompletion(
864864
kwargs.pop("moderate_content", None)
865865
# Register custom model pricing in litellm's registry for extended pricing support
866866
if model_pricing:
867-
litellm.model_cost[model_name] = model_pricing
867+
# Merge with existing pricing to preserve other fields (max_tokens, mode, etc.)
868+
if model_name in litellm.model_cost:
869+
litellm.model_cost[model_name].update(model_pricing)
870+
else:
871+
litellm.model_cost[model_name] = model_pricing
868872
provider_start_time = time.time_ns()
869873
c_response = await acompletion(**call_params, **kwargs)
870874
provider_end_time = time.time_ns()

0 commit comments

Comments
 (0)