fix(model_dashboard.tsx): accurately show the input/output cost per token when custom pricing is set

This commit is contained in:
Krrish Dholakia 2024-05-27 18:33:26 -07:00
parent 3be6a07e35
commit d54c1f2da0

View file

@ -1196,9 +1196,15 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({
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}
</TableCell>
<TableCell
style={{
@ -1207,9 +1213,15 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({
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}
</TableCell>
<TableCell
style={{