usage-tab 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/index.cjs +473 -178
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +473 -178
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -475,21 +475,21 @@ prevent.
|
|
|
475
475
|
|
|
476
476
|
Every price carries an `effectiveFrom` (and, when superseded, an
|
|
477
477
|
`effectiveTo`) date. `calculateCost`'s `at` picks the period active on that
|
|
478
|
-
date
|
|
479
|
-
fixture for this behavior:
|
|
478
|
+
date - `gemini-3.6-flash`'s real promotional rate, whose start and end
|
|
479
|
+
Google publishes, is the golden fixture for this behavior:
|
|
480
480
|
|
|
481
481
|
```ts
|
|
482
482
|
import { calculateCost } from 'usage-tab';
|
|
483
483
|
|
|
484
484
|
const usage = { inputTokens: 1_000_000, outputTokens: 1_000_000 };
|
|
485
485
|
|
|
486
|
-
calculateCost({ model: '
|
|
486
|
+
calculateCost({ model: 'gemini-3.6-flash', provider: 'google', usage, at: '2026-11-01' })
|
|
487
487
|
.totalUsdExact;
|
|
488
|
-
// "
|
|
488
|
+
// "4.50" - the promotional rate ($0.75/$3.75), published as running through 2026-12-31
|
|
489
489
|
|
|
490
|
-
calculateCost({ model: '
|
|
490
|
+
calculateCost({ model: 'gemini-3.6-flash', provider: 'google', usage, at: '2027-01-15' })
|
|
491
491
|
.totalUsdExact;
|
|
492
|
-
// "
|
|
492
|
+
// "9.00" - the standard rate ($1.50/$7.50), resuming 2027-01-01
|
|
493
493
|
```
|
|
494
494
|
|
|
495
495
|
Period boundaries are UTC midnights, so **every ISO `at` string is read as
|