forked from phoenix/litellm-mirror
Merge pull request #5582 from BerriAI/litellm_ui
[Feat UI] allow setting input / output cost per M tokens
This commit is contained in:
commit
e88482e6cf
1 changed files with 17 additions and 8 deletions
|
@ -457,19 +457,19 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({
|
|||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label="input_cost_per_token"
|
||||
name="input_cost_per_token"
|
||||
tooltip="float (optional) - Input cost per token"
|
||||
label="Input Cost per 1M Tokens"
|
||||
name="input_cost_per_million_tokens"
|
||||
tooltip="float (optional) - Input cost per 1 million tokens"
|
||||
>
|
||||
<InputNumber min={0} step={0.0001} />
|
||||
<InputNumber min={0} step={0.01} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
label="output_cost_per_token"
|
||||
name="output_cost_per_token"
|
||||
tooltip="float (optional) - Output cost per token"
|
||||
label="Output Cost per 1M Tokens"
|
||||
name="output_cost_per_million_tokens"
|
||||
tooltip="float (optional) - Output cost per 1 million tokens"
|
||||
>
|
||||
<InputNumber min={0} step={0.0001} />
|
||||
<InputNumber min={0} step={0.01} />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
|
@ -517,6 +517,15 @@ const ModelDashboard: React.FC<ModelDashboardProps> = ({
|
|||
let newLiteLLMParams: Record<string, any> = {};
|
||||
let model_info_model_id = null;
|
||||
|
||||
if (formValues.input_cost_per_million_tokens) {
|
||||
formValues.input_cost_per_token = formValues.input_cost_per_million_tokens / 1000000;
|
||||
delete formValues.input_cost_per_million_tokens;
|
||||
}
|
||||
if (formValues.output_cost_per_million_tokens) {
|
||||
formValues.output_cost_per_token = formValues.output_cost_per_million_tokens / 1000000;
|
||||
delete formValues.output_cost_per_million_tokens;
|
||||
}
|
||||
|
||||
for (const [key, value] of Object.entries(formValues)) {
|
||||
if (key !== "model_id") {
|
||||
newLiteLLMParams[key] = value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue