diff --git a/web/default/src/features/system-settings/models/model-ratio-form.tsx b/web/default/src/features/system-settings/models/model-ratio-form.tsx index 38c3a530..6cfa93fa 100644 --- a/web/default/src/features/system-settings/models/model-ratio-form.tsx +++ b/web/default/src/features/system-settings/models/model-ratio-form.tsx @@ -65,6 +65,97 @@ type ModelRatioFormProps = { isResetting: boolean } +type ModelJsonFieldName = + | 'ModelPrice' + | 'ModelRatio' + | 'CacheRatio' + | 'CreateCacheRatio' + | 'CompletionRatio' + | 'ImageRatio' + | 'AudioRatio' + | 'AudioCompletionRatio' + +const modelJsonFields: Array<{ + name: ModelJsonFieldName + labelKey: string + descriptionKey: string +}> = [ + { + name: 'ModelPrice', + labelKey: 'Model fixed pricing', + descriptionKey: + 'JSON map of model → USD cost per request. Takes precedence over ratio based billing.', + }, + { + name: 'ModelRatio', + labelKey: 'Model ratio', + descriptionKey: 'JSON map of model → multiplier applied to quota billing.', + }, + { + name: 'CacheRatio', + labelKey: 'Prompt cache ratio', + descriptionKey: 'Optional ratio used when upstream cache hits occur.', + }, + { + name: 'CreateCacheRatio', + labelKey: 'Create cache ratio', + descriptionKey: + 'Ratio applied when creating cache entries for supported models.', + }, + { + name: 'CompletionRatio', + labelKey: 'Completion ratio', + descriptionKey: + 'Applies to custom completion endpoints. JSON map of model → ratio.', + }, + { + name: 'ImageRatio', + labelKey: 'Image ratio', + descriptionKey: 'Configure per-model ratio for image inputs or outputs.', + }, + { + name: 'AudioRatio', + labelKey: 'Audio ratio', + descriptionKey: + 'Ratio applied to audio inputs where supported by the upstream model.', + }, + { + name: 'AudioCompletionRatio', + labelKey: 'Audio completion ratio', + descriptionKey: 'Ratio applied to audio completions for streaming models.', + }, +] + +function ModelJsonTextareaField(props: { + form: UseFormReturn + name: ModelJsonFieldName + label: string + description: string +}) { + return ( + ( + + {props.label} + +