-
- {modelName}
+
+ {modelName}
+ {model.pricing && renderPrice(model.pricing)}
{model.description && (
@@ -542,18 +550,6 @@ export function OnboardingDialog({ open, onOpenChange }: OnboardingDialogProps)
)}
- {(model.pricing || model.contextLength) && (
-
-
- {model.pricing && (
- {formatPrice(model.pricing)}
- )}
- {model.contextLength && (
- Context: {model.contextLength.toLocaleString()} tokens
- )}
-
-
- )}
);
})
@@ -612,4 +608,29 @@ export function OnboardingDialog({ open, onOpenChange }: OnboardingDialogProps)
)}
>
);
+}
+
+/**
+ * Get a single normalized "price per token" for a model,
+ * combining input and output pricing with agentic-coding-aware weights.
+ *
+ * Default behavior:
+ * - Uses inputWeight = 0.20 (based on typical 3–5x output premium seen in practice).
+ *
+ * Optional behavior:
+ * - If you pass observed token usage, the function will compute the weight
+ * as the observed share of spend from inputs over total spend.
+ */
+function getNormalizedModelPrice(
+ pricing: { prompt: Decimal; completion: Decimal },
+ inputWeight = 0.2,
+): Decimal {
+ if (!(inputWeight >= 0 && inputWeight <= 1)) {
+ throw new Error("Computed inputWeight is out of range [0,1]. Check inputs.");
+ }
+ if (pricing.prompt.equals(0) && pricing.completion.equals(0)) {
+ return new Decimal(0);
+ }
+ const outputWeight = 1 - inputWeight;
+ return pricing.prompt.times(inputWeight).plus(pricing.completion.times(outputWeight));
}
\ No newline at end of file