The platform for continuously improving AI agents.
import { formatOvermindCredits } from "@/lib/utils";
/** An estimate in credits, from published token rates; never a charge. */
export function CostComparison({ cost, delta }: { cost?: number | null; delta?: number | null }) {
if (cost == null) return <>Estimate unavailable</>;
const credits = (value: number) => {
const shown = formatOvermindCredits(value / 100);
return `${shown} ${shown === "1" ? "credit" : "credits"}`;
};
return (
<>
Estimate {credits(cost)}
{delta != null && (
<> ({delta === 0 ? "no change" : `${delta > 0 ? "+" : "−"}${credits(Math.abs(delta))}`})</>
)}
</>
);
}