From d54c1f2da055fbf94b4e1719d1d5a4d15a5a5b7d Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 27 May 2024 18:33:26 -0700 Subject: [PATCH] fix(model_dashboard.tsx): accurately show the input/output cost per token when custom pricing is set --- .../src/components/model_dashboard.tsx | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/ui/litellm-dashboard/src/components/model_dashboard.tsx b/ui/litellm-dashboard/src/components/model_dashboard.tsx index 89061d916..359f6691f 100644 --- a/ui/litellm-dashboard/src/components/model_dashboard.tsx +++ b/ui/litellm-dashboard/src/components/model_dashboard.tsx @@ -1196,9 +1196,15 @@ const ModelDashboard: React.FC = ({ wordBreak: "break-word", }} > - {model.input_cost || - model.litellm_params.input_cost_per_token || - null} + {model.input_cost + ? model.input_cost + : model.litellm_params.input_cost_per_token + ? ( + Number( + model.litellm_params.input_cost_per_token + ) * 1000000 + ).toFixed(2) + : null} = ({ wordBreak: "break-word", }} > - {model.output_cost || - model.litellm_params.output_cost_per_token || - null} + {model.output_cost + ? model.output_cost + : model.litellm_params.output_cost_per_token + ? ( + Number( + model.litellm_params.output_cost_per_token + ) * 1000000 + ).toFixed(2) + : null}