Commit
·
4be5ad5
1
Parent(s):
2798716
- src/App.tsx +2 -22
src/App.tsx
CHANGED
|
@@ -74,20 +74,6 @@ const App: React.FC = () => {
|
|
| 74 |
};
|
| 75 |
|
| 76 |
|
| 77 |
-
const calculateBlendedPrice = (
|
| 78 |
-
inputPrice: number,
|
| 79 |
-
outputPrice: number,
|
| 80 |
-
inputTokens: number,
|
| 81 |
-
outputTokens: number
|
| 82 |
-
): number => {
|
| 83 |
-
const inputRatio = 3; // Fixed input to output ratio
|
| 84 |
-
const totalInputTokens = inputTokens * inputRatio;
|
| 85 |
-
const blendedPrice = (inputPrice * totalInputTokens + outputPrice * outputTokens) / (totalInputTokens + outputTokens);
|
| 86 |
-
return blendedPrice;
|
| 87 |
-
};
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
|
| 92 |
const calculateComparison = (
|
| 93 |
modelPrice: number,
|
|
@@ -277,7 +263,7 @@ const App: React.FC = () => {
|
|
| 277 |
id="tokenCalculation"
|
| 278 |
value={tokenCalculation}
|
| 279 |
onChange={(e) => setTokenCalculation(e.target.value)}
|
| 280 |
-
className="mt-1 block w-full pl-3 pr-10 py-2 text-base
|
| 281 |
>
|
| 282 |
<option value="billion">Billion Tokens</option>
|
| 283 |
<option value="million">Million Tokens</option>
|
|
@@ -294,9 +280,6 @@ const App: React.FC = () => {
|
|
| 294 |
Note: If you use Amazon Bedrock or Azure prices for Anthropic, Cohere
|
| 295 |
or OpenAI should be the same.
|
| 296 |
</p>
|
| 297 |
-
<p className="italic text-sm text-muted-foreground mb-4">
|
| 298 |
-
Blended Price reflects the average cost of input and output tokens, calculated using a fixed ratio (3:1), to give a unified rate per {tokenCalculation} tokens.
|
| 299 |
-
</p>
|
| 300 |
|
| 301 |
<Table>
|
| 302 |
<TableHeader>
|
|
@@ -325,7 +308,6 @@ const App: React.FC = () => {
|
|
| 325 |
) : null}
|
| 326 |
</button>
|
| 327 |
</TableHead>
|
| 328 |
-
<TableHead>Blended Price</TableHead>
|
| 329 |
|
| 330 |
<TableHead>
|
| 331 |
<button type="button" onClick={() => requestSort('inputPrice')}>
|
|
@@ -415,9 +397,7 @@ const App: React.FC = () => {
|
|
| 415 |
</a>
|
| 416 |
</TableCell>
|
| 417 |
<TableCell>{item.name}</TableCell>
|
| 418 |
-
|
| 419 |
-
${calculateBlendedPrice(item.inputPrice, item.outputPrice, inputTokens, outputTokens).toFixed(2)}
|
| 420 |
-
</TableCell>
|
| 421 |
<TableCell>{item.inputPrice.toFixed(2)}</TableCell>
|
| 422 |
<TableCell>{item.outputPrice.toFixed(2)}</TableCell>
|
| 423 |
|
|
|
|
| 74 |
};
|
| 75 |
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
const calculateComparison = (
|
| 79 |
modelPrice: number,
|
|
|
|
| 263 |
id="tokenCalculation"
|
| 264 |
value={tokenCalculation}
|
| 265 |
onChange={(e) => setTokenCalculation(e.target.value)}
|
| 266 |
+
className="mt-1 block w-full pl-3 pr-10 py-2 text-base focus:outline-none focus:ring-indigo-500 sm:text-sm rounded-md"
|
| 267 |
>
|
| 268 |
<option value="billion">Billion Tokens</option>
|
| 269 |
<option value="million">Million Tokens</option>
|
|
|
|
| 280 |
Note: If you use Amazon Bedrock or Azure prices for Anthropic, Cohere
|
| 281 |
or OpenAI should be the same.
|
| 282 |
</p>
|
|
|
|
|
|
|
|
|
|
| 283 |
|
| 284 |
<Table>
|
| 285 |
<TableHeader>
|
|
|
|
| 308 |
) : null}
|
| 309 |
</button>
|
| 310 |
</TableHead>
|
|
|
|
| 311 |
|
| 312 |
<TableHead>
|
| 313 |
<button type="button" onClick={() => requestSort('inputPrice')}>
|
|
|
|
| 397 |
</a>
|
| 398 |
</TableCell>
|
| 399 |
<TableCell>{item.name}</TableCell>
|
| 400 |
+
|
|
|
|
|
|
|
| 401 |
<TableCell>{item.inputPrice.toFixed(2)}</TableCell>
|
| 402 |
<TableCell>{item.outputPrice.toFixed(2)}</TableCell>
|
| 403 |
|