ai-api-pricing 0.1.0 → 0.1.1
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 -0
- package/dist/cjs/generated/bundled.js +15438 -8416
- package/dist/cjs/generated/bundled.js.map +1 -1
- package/dist/esm/generated/bundled.d.ts +1 -1
- package/dist/esm/generated/bundled.d.ts.map +1 -1
- package/dist/esm/generated/bundled.js +15438 -8416
- package/dist/esm/generated/bundled.js.map +1 -1
- package/package.json +22 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Zero-runtime-dependency TypeScript/JavaScript access to the source-linked [AICostBudget AI API Pricing Dataset](https://aicostbudget.com/en/datasets/ai-api-pricing).
|
|
4
4
|
|
|
5
|
+
Data, history and issue tracker: [aicostbudget/ai-api-pricing-data on GitHub](https://github.com/aicostbudget/ai-api-pricing-data). Spot a wrong price? [Open an issue](https://github.com/aicostbudget/ai-api-pricing-data/issues) with the official source link.
|
|
6
|
+
|
|
5
7
|
```bash
|
|
6
8
|
npm install ai-api-pricing
|
|
7
9
|
```
|
|
@@ -16,6 +18,10 @@ console.log(estimate.total, estimate.officialSourceUrl, estimate.lastVerifiedAt)
|
|
|
16
18
|
|
|
17
19
|
The package exports `loadPrices`, `getPrice`, `listModels`, `estimateCost`, and `compareModels`. Live loading uses the GitHub Pages JSON with a 10-second timeout and falls back to the bundled snapshot on any fetch or validation error. Check the returned `source` field to distinguish `live` from `bundled` data. Missing required prices raise a typed `MissingPriceError`; the package never substitutes another rate.
|
|
18
20
|
|
|
21
|
+
## From price per token to cost per result
|
|
22
|
+
|
|
23
|
+
A price estimate is the cost of one call. To measure what one *correct* result costs on your models, including retries and reasoning tokens, use the open [LLM cost-per-task benchmark](https://github.com/aicostbudget/llm-cost-per-task-benchmark): 16 tasks with code-only validators, run with your own API keys, priced from this dataset.
|
|
24
|
+
|
|
19
25
|
## Refresh the bundled snapshot
|
|
20
26
|
|
|
21
27
|
From the repository root, run:
|