ai-price-index 1.0.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/DATA-LICENSE.md +33 -0
- package/LICENSE +26 -0
- package/README.md +161 -0
- package/bin/cli.js +143 -0
- package/index.d.ts +145 -0
- package/lib/data.json +1 -0
- package/lib/engine.js +98 -0
- package/lib/index.js +183 -0
- package/package.json +63 -0
package/DATA-LICENSE.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Data license: CC BY 4.0
|
|
2
|
+
|
|
3
|
+
The DATA in this repository (the price records, the published per-model series, and the index under
|
|
4
|
+
`examples/` and `data/`) is licensed under the Creative Commons Attribution 4.0 International License
|
|
5
|
+
(CC BY 4.0).
|
|
6
|
+
|
|
7
|
+
- Human-readable summary: https://creativecommons.org/licenses/by/4.0/
|
|
8
|
+
- Full legal code: https://creativecommons.org/licenses/by/4.0/legalcode
|
|
9
|
+
- SPDX identifier: `CC-BY-4.0`
|
|
10
|
+
|
|
11
|
+
CC BY 4.0 covers copyright and the EU sui generis database right, which is why it is the right choice
|
|
12
|
+
for a factual dataset.
|
|
13
|
+
|
|
14
|
+
## You may
|
|
15
|
+
|
|
16
|
+
Share and adapt the data for any purpose, including commercially.
|
|
17
|
+
|
|
18
|
+
## You must
|
|
19
|
+
|
|
20
|
+
Give appropriate credit, link to this license, and indicate if changes were made. A clear attribution:
|
|
21
|
+
|
|
22
|
+
> AI Price Index by RoninForge (https://github.com/RoninForge/ai-price-index), CC BY 4.0.
|
|
23
|
+
|
|
24
|
+
When practical, also cite the validation date of the specific values you used (every record carries a
|
|
25
|
+
`last_validated_at`), so downstream readers know how fresh the figures are.
|
|
26
|
+
|
|
27
|
+
## Why the prices themselves are facts
|
|
28
|
+
|
|
29
|
+
Raw prices are uncopyrightable facts; only a creative selection or arrangement attracts thin
|
|
30
|
+
compilation copyright, never the underlying numbers. We compile our own record from providers' public
|
|
31
|
+
pricing pages with attribution rather than mirroring any single aggregator's database, and we publish
|
|
32
|
+
under CC BY 4.0 so the data stays open and reusable. See [METHODOLOGY.md](METHODOLOGY.md) for the
|
|
33
|
+
sourcing and provenance discipline.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
MIT License (tooling and code only)
|
|
2
|
+
|
|
3
|
+
This MIT license covers the CODE and TOOLING in this repository: everything under tools/ and
|
|
4
|
+
.github/, the JSON Schemas under schema/, and any scripts. The DATA (the price records and the
|
|
5
|
+
published series and index under examples/ and data/) is licensed separately under CC BY 4.0; see
|
|
6
|
+
DATA-LICENSE.md.
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 RoninForge
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# AI Price Index
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/ai-price-index)
|
|
4
|
+
[](DATA-LICENSE.md)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](CITATION.cff)
|
|
7
|
+
[](https://doi.org/10.5281/zenodo.20730241)
|
|
8
|
+
|
|
9
|
+
An open, dated, first-party-sourced record of AI model API prices over time.
|
|
10
|
+
|
|
11
|
+
Most price lists tell you what a model costs **today**. This one tells you what it cost **on a
|
|
12
|
+
given date**, **when that price was last confirmed**, and **links the first-party source that proves
|
|
13
|
+
it**. That provenance is the point: every value carries a verifiable source and a `last_validated_at`
|
|
14
|
+
date, including historical ones.
|
|
15
|
+
|
|
16
|
+
- **Data license:** CC BY 4.0 (see [DATA-LICENSE.md](DATA-LICENSE.md)). Use it anywhere, just attribute.
|
|
17
|
+
- **Tooling license:** MIT (see [LICENSE](LICENSE)).
|
|
18
|
+
- Maintained by [RoninForge](https://roninforge.org). Source of truth, methodology, and corrections
|
|
19
|
+
are all in the open.
|
|
20
|
+
|
|
21
|
+
> Status: early. The schema, validation, and methodology are in place; coverage is being seeded
|
|
22
|
+
> flagship-first (see Roadmap). Prices can change and history is partly reconstructed; trust the
|
|
23
|
+
> `confidence` label and the `source_url` on each record, not this sentence.
|
|
24
|
+
|
|
25
|
+
## Why it exists
|
|
26
|
+
|
|
27
|
+
No first-party provider publishes its own price history. Several open lists have broad **current**
|
|
28
|
+
pricing, but none pairs each price with a dated, verifiable first-party source under a clear license,
|
|
29
|
+
and none surfaces when a price was last validated. Tools that need to value **past** usage (what did
|
|
30
|
+
this token cost back then) have nothing reliable to read. This fills that gap.
|
|
31
|
+
|
|
32
|
+
## What is in here
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
schema/ JSON Schemas: the price record, the published per-model series, the index
|
|
36
|
+
examples/ illustrative-but-accurate records + series that the validator checks
|
|
37
|
+
data/ the published dataset (generated from the system of record; appears as coverage lands)
|
|
38
|
+
tools/ validate.mjs, a zero-dependency validator (run in CI and locally)
|
|
39
|
+
METHODOLOGY.md how prices are sourced, confirmed, dated, and corrected
|
|
40
|
+
CONTRIBUTING.md how to report or fix a price (a first-party dated source is required)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### The price record
|
|
44
|
+
|
|
45
|
+
Every price is one record. The human-facing shape (what you contribute and what the validator
|
|
46
|
+
checks) is defined in [`schema/price-record.schema.json`](schema/price-record.schema.json). In short:
|
|
47
|
+
|
|
48
|
+
| field | meaning |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `provider`, `model_id`, `variation`, `unit` | what is priced (e.g. anthropic / claude-opus-4-5-20251101 / input / usd_per_mtok) |
|
|
51
|
+
| `price_usd` | the price for one unit |
|
|
52
|
+
| `effective_from`, `effective_to` | the dates this price was in effect (`effective_to: null` = current) |
|
|
53
|
+
| `last_validated_at` | when this price was last confirmed against its source |
|
|
54
|
+
| `source_url`, `source_kind`, `confidence` | the first-party proof and how sure we are |
|
|
55
|
+
|
|
56
|
+
The published, served form is one file per model (`schema/model-series.schema.json`) plus a thin
|
|
57
|
+
`index.json` (`schema/index.schema.json`); a client binary-searches a model's interval array by date.
|
|
58
|
+
|
|
59
|
+
## Use the data
|
|
60
|
+
|
|
61
|
+
Three ways, depending on what you are building.
|
|
62
|
+
|
|
63
|
+
### npm package (point-in-time lookups, no network)
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npm install ai-price-index
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The dataset ships **bundled inside the package** (no runtime network call), so a lookup is
|
|
70
|
+
deterministic and reproducible against the version you installed.
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
import { current, priceOn, rate, meta } from 'ai-price-index';
|
|
74
|
+
|
|
75
|
+
current('claude-opus-4-8'); // today's input/output rate + the source that proves it
|
|
76
|
+
priceOn('gpt-4', '2024-01-01'); // the rate that was IN EFFECT on that date ($30 / $60 per Mtok)
|
|
77
|
+
rate('gpt-4', '2024-01-01'); // -> { provider, model, date, inputPerM: 30, outputPerM: 60 }
|
|
78
|
+
meta.dataModified; // the dataset date this install pins to
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Short ids and a trailing `[1m]` display suffix resolve to the dated series (e.g. `claude-opus-4-5`
|
|
82
|
+
-> `claude-opus-4-5-20251101`); pass `{ provider }` to disambiguate a bare model id. `usdForRollup`
|
|
83
|
+
values a token rollup at a point in time with the shared cache multipliers (read 0.1x, write 1.25x /
|
|
84
|
+
2x). The package reproduces the same [golden vectors](examples/pricing-vectors.json) as the other
|
|
85
|
+
RoninForge pricing engines.
|
|
86
|
+
|
|
87
|
+
CLI (no install needed):
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npx ai-price-index claude-opus-4-8 # today's rate
|
|
91
|
+
npx ai-price-index gpt-4 --on 2024-01-01 # a past date
|
|
92
|
+
npx ai-price-index list --provider openai # known models
|
|
93
|
+
npx ai-price-index claude-opus-4-8 --json # machine-readable
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### JSON API (fetch the current snapshot)
|
|
97
|
+
|
|
98
|
+
The current prices are served as JSON with permissive CORS, so you can fetch them from a browser or
|
|
99
|
+
a script. These are **stable URLs** (safe to depend on):
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
https://roninforge.org/data/ai-price-index/current.json # current price of every model
|
|
103
|
+
https://roninforge.org/data/ai-price-index/index.json # model list + per-model series file map
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
const { prices } = await (await fetch('https://roninforge.org/data/ai-price-index/current.json')).json();
|
|
108
|
+
const opus = prices.find((p) => p.model === 'claude-opus-4-8' && p.variation === 'input');
|
|
109
|
+
console.log(opus.price_usd, opus.src); // 5 https://www.anthropic.com/news/claude-opus-4-8
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
For full price **history** (every dated interval, not just current), use the npm package or clone the
|
|
113
|
+
repo. Per-model series filenames under `models/` are content-hashed and not stable; do not hardcode them.
|
|
114
|
+
|
|
115
|
+
### Clone the raw dataset
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
git clone https://github.com/RoninForge/ai-price-index
|
|
119
|
+
node tools/validate.mjs # validate everything locally
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
When you publish anything derived from this data, attribute it: **"AI Price Index by RoninForge, CC
|
|
123
|
+
BY 4.0"** with a link to this repository and the validation date of the values you used.
|
|
124
|
+
|
|
125
|
+
## How to cite
|
|
126
|
+
|
|
127
|
+
Prices change and corrections supersede without deleting history, so cite a **dated release** to keep
|
|
128
|
+
your snapshot reproducible. Machine-readable citation metadata is in [`CITATION.cff`](CITATION.cff)
|
|
129
|
+
(GitHub renders a "Cite this repository" button from it).
|
|
130
|
+
|
|
131
|
+
Plain:
|
|
132
|
+
|
|
133
|
+
> AI Price Index by RoninForge (https://roninforge.org/data/ai-price-index/), CC BY 4.0. Release `<tag>`, accessed `<date>`.
|
|
134
|
+
|
|
135
|
+
BibTeX:
|
|
136
|
+
|
|
137
|
+
```bibtex
|
|
138
|
+
@misc{roninforge_ai_price_index,
|
|
139
|
+
author = {{RoninForge}},
|
|
140
|
+
title = {{AI Price Index: dated, first-party AI model API prices over time}},
|
|
141
|
+
howpublished = {\url{https://roninforge.org/data/ai-price-index/}},
|
|
142
|
+
note = {Release <tag>. Data licensed CC BY 4.0. Accessed <date>.}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
For academic reuse, cite the DOI (Zenodo): **[10.5281/zenodo.20730241](https://doi.org/10.5281/zenodo.20730241)**.
|
|
147
|
+
This is the concept DOI and always resolves to the latest version; each release also gets its own
|
|
148
|
+
version DOI for an exact, reproducible snapshot.
|
|
149
|
+
|
|
150
|
+
## Roadmap
|
|
151
|
+
|
|
152
|
+
Coverage is seeded **flagship-first, deep on history**: the leading models (Claude, GPT, Gemini)
|
|
153
|
+
with their price history pushed back as far as it can be verifiably sourced, before widening to the
|
|
154
|
+
long tail. Reconstructed history is labelled by `confidence` (`archived` / `inferred` / `estimated`)
|
|
155
|
+
and never rendered with the same weight as a live-confirmed price.
|
|
156
|
+
|
|
157
|
+
## Contributing
|
|
158
|
+
|
|
159
|
+
Found a wrong or missing price? Open an issue or a PR with the correct value **and a first-party
|
|
160
|
+
source URL plus the date you saw it**. A contribution without a dated first-party source cannot be
|
|
161
|
+
accepted; that rule is what makes this trustworthy. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// CLI for ai-price-index. Prints the AI model API rate that was in effect on a given date, with its
|
|
3
|
+
// first-party source. No network: reads the bundle shipped in the package.
|
|
4
|
+
//
|
|
5
|
+
// npx ai-price-index claude-opus-4-8 today's rate
|
|
6
|
+
// npx ai-price-index gpt-4 --on 2024-01-01 the rate in effect on a past date
|
|
7
|
+
// npx ai-price-index command-r --provider cohere disambiguate a bare model id
|
|
8
|
+
// npx ai-price-index list [--provider openai] list known models
|
|
9
|
+
// npx ai-price-index providers list providers
|
|
10
|
+
// add --json to any command for machine-readable output
|
|
11
|
+
import { readFileSync } from 'node:fs';
|
|
12
|
+
import { priceOn, models, providers, meta } from '../lib/index.js';
|
|
13
|
+
|
|
14
|
+
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
15
|
+
|
|
16
|
+
function parseArgs(argv) {
|
|
17
|
+
const opts = { _: [], json: false };
|
|
18
|
+
for (let i = 0; i < argv.length; i++) {
|
|
19
|
+
const a = argv[i];
|
|
20
|
+
if (a === '--json') opts.json = true;
|
|
21
|
+
else if (a === '--on' || a === '--date') opts.on = argv[++i];
|
|
22
|
+
else if (a.startsWith('--on=')) opts.on = a.slice(5);
|
|
23
|
+
else if (a === '--provider' || a === '-p') opts.provider = argv[++i];
|
|
24
|
+
else if (a.startsWith('--provider=')) opts.provider = a.slice(11);
|
|
25
|
+
else if (a === '--help' || a === '-h') opts.help = true;
|
|
26
|
+
else if (a === '--version' || a === '-v') opts.version = true;
|
|
27
|
+
else opts._.push(a);
|
|
28
|
+
}
|
|
29
|
+
return opts;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const HELP = `ai-price-index - open, dated AI model API prices with first-party sources.
|
|
33
|
+
|
|
34
|
+
Usage:
|
|
35
|
+
ai-price-index <model> [--on YYYY-MM-DD] [--provider <slug>] [--json]
|
|
36
|
+
ai-price-index list [--provider <slug>] [--json]
|
|
37
|
+
ai-price-index providers [--json]
|
|
38
|
+
|
|
39
|
+
Options:
|
|
40
|
+
--on YYYY-MM-DD the date to price (default: today)
|
|
41
|
+
--provider <slug> disambiguate a bare model id (e.g. anthropic, openai, google)
|
|
42
|
+
--json machine-readable output
|
|
43
|
+
-v, --version print version and dataset date
|
|
44
|
+
-h, --help this help
|
|
45
|
+
|
|
46
|
+
Data CC BY 4.0, tooling MIT. Source: ${meta.source.dataPage}`;
|
|
47
|
+
|
|
48
|
+
function fmtPrice(iv) {
|
|
49
|
+
if (!iv) return 'n/a';
|
|
50
|
+
return `$${iv.price_usd}/${iv.unit.replace('usd_per_', '')}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function printModel(query, opts) {
|
|
54
|
+
let res;
|
|
55
|
+
try {
|
|
56
|
+
res = priceOn(query, opts.on, opts.provider ? { provider: opts.provider } : {});
|
|
57
|
+
} catch (err) {
|
|
58
|
+
// Ambiguous bare id: surface the candidates.
|
|
59
|
+
console.error(err.message);
|
|
60
|
+
process.exit(2);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!res) {
|
|
64
|
+
console.error(
|
|
65
|
+
`Unknown model "${query}". Try: ai-price-index list${opts.provider ? ` --provider ${opts.provider}` : ''}`
|
|
66
|
+
);
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (opts.json) {
|
|
71
|
+
process.stdout.write(JSON.stringify(res, null, 2) + '\n');
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!res.covered) {
|
|
76
|
+
console.log(
|
|
77
|
+
`${res.provider}/${res.model}: no priced record on ${res.date} (dataset coverage may start later).`
|
|
78
|
+
);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const lines = [
|
|
83
|
+
`${res.provider}/${res.model}${res.model !== query ? ` (resolved from "${query}")` : ''}`,
|
|
84
|
+
` date ${res.date}`,
|
|
85
|
+
` input ${fmtPrice(res.input)}`,
|
|
86
|
+
` output ${fmtPrice(res.output)}`
|
|
87
|
+
];
|
|
88
|
+
const src = res.input?.source || res.output?.source;
|
|
89
|
+
const conf = res.input?.confidence || res.output?.confidence;
|
|
90
|
+
const val = res.input?.last_validated || res.output?.last_validated;
|
|
91
|
+
if (conf) lines.push(` confidence ${conf}${val ? `, validated ${val}` : ''}`);
|
|
92
|
+
if (src) lines.push(` source ${src}`);
|
|
93
|
+
console.log(lines.join('\n'));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function printList(opts) {
|
|
97
|
+
let list = models();
|
|
98
|
+
if (opts.provider) list = list.filter((m) => m.provider === opts.provider);
|
|
99
|
+
if (opts.json) {
|
|
100
|
+
process.stdout.write(JSON.stringify(list, null, 2) + '\n');
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (!list.length) {
|
|
104
|
+
console.error(`No models${opts.provider ? ` for provider "${opts.provider}"` : ''}.`);
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
for (const m of list) {
|
|
108
|
+
const alias = m.aliases.length ? ` (aliases: ${m.aliases.join(', ')})` : '';
|
|
109
|
+
console.log(`${m.provider}/${m.model}${alias}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function printProviders(opts) {
|
|
114
|
+
const list = providers();
|
|
115
|
+
if (opts.json) {
|
|
116
|
+
process.stdout.write(JSON.stringify(list, null, 2) + '\n');
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
console.log(list.join('\n'));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function main() {
|
|
123
|
+
const opts = parseArgs(process.argv.slice(2));
|
|
124
|
+
if (opts.version) {
|
|
125
|
+
console.log(`ai-price-index ${pkg.version} (dataset ${meta.dataModified}, ${meta.source.ref})`);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (opts.help || opts._.length === 0) {
|
|
129
|
+
console.log(HELP);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const [cmd, ...rest] = opts._;
|
|
133
|
+
if (cmd === 'list') return printList(opts);
|
|
134
|
+
if (cmd === 'providers') return printProviders(opts);
|
|
135
|
+
// Default: treat the first positional as a model id.
|
|
136
|
+
if (rest.length) {
|
|
137
|
+
console.error(`Unexpected extra arguments: ${rest.join(' ')}`);
|
|
138
|
+
process.exit(2);
|
|
139
|
+
}
|
|
140
|
+
return printModel(cmd, opts);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
main();
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// Type declarations for ai-price-index.
|
|
2
|
+
|
|
3
|
+
export interface PriceInterval {
|
|
4
|
+
/** Valid-time start (inclusive), ISO YYYY-MM-DD. */
|
|
5
|
+
from: string;
|
|
6
|
+
/** Valid-time end (exclusive), or null if still current. */
|
|
7
|
+
to: string | null;
|
|
8
|
+
price_usd: number;
|
|
9
|
+
unit: string;
|
|
10
|
+
last_validated?: string;
|
|
11
|
+
confidence?: string;
|
|
12
|
+
/** First-party source URL. */
|
|
13
|
+
src?: string;
|
|
14
|
+
snapshot?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ModelSeries {
|
|
18
|
+
model: string;
|
|
19
|
+
provider: string;
|
|
20
|
+
aliases?: string[];
|
|
21
|
+
variations: {
|
|
22
|
+
input: PriceInterval[];
|
|
23
|
+
output: PriceInterval[];
|
|
24
|
+
[variation: string]: PriceInterval[];
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface PriceBundle {
|
|
29
|
+
schemaVersion: string;
|
|
30
|
+
dataModified: string;
|
|
31
|
+
license: string;
|
|
32
|
+
doi: string;
|
|
33
|
+
attribution: string;
|
|
34
|
+
source: { repo: string; ref: string; sha: string; dataPage: string };
|
|
35
|
+
sources: string[];
|
|
36
|
+
series: ModelSeries[];
|
|
37
|
+
current: unknown[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface IntervalView {
|
|
41
|
+
price_usd: number;
|
|
42
|
+
unit: string;
|
|
43
|
+
from: string;
|
|
44
|
+
to: string | null;
|
|
45
|
+
last_validated: string | null;
|
|
46
|
+
confidence: string | null;
|
|
47
|
+
source: string | null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface PriceResult {
|
|
51
|
+
query: string;
|
|
52
|
+
provider: string;
|
|
53
|
+
model: string;
|
|
54
|
+
aliases: string[];
|
|
55
|
+
date: string;
|
|
56
|
+
covered: boolean;
|
|
57
|
+
input: IntervalView | null;
|
|
58
|
+
output: IntervalView | null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface ResolveResult {
|
|
62
|
+
provider: string;
|
|
63
|
+
model: string;
|
|
64
|
+
aliases: string[];
|
|
65
|
+
series: ModelSeries;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface TokenRollup {
|
|
69
|
+
input?: number;
|
|
70
|
+
output?: number;
|
|
71
|
+
cache_read?: number;
|
|
72
|
+
cache_write_5m?: number;
|
|
73
|
+
cache_write_1h?: number;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface ResolveOpts {
|
|
77
|
+
provider?: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const bundle: PriceBundle;
|
|
81
|
+
export const meta: {
|
|
82
|
+
schemaVersion: string;
|
|
83
|
+
dataModified: string;
|
|
84
|
+
license: string;
|
|
85
|
+
doi: string;
|
|
86
|
+
attribution: string;
|
|
87
|
+
source: PriceBundle['source'];
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const CACHE_READ_MULT: number;
|
|
91
|
+
export const CACHE_WRITE_5M_MULT: number;
|
|
92
|
+
export const CACHE_WRITE_1H_MULT: number;
|
|
93
|
+
|
|
94
|
+
export function providers(): string[];
|
|
95
|
+
export function models(): Array<{ provider: string; model: string; aliases: string[] }>;
|
|
96
|
+
export function candidates(model: string): ModelSeries[];
|
|
97
|
+
export function resolve(model: string, opts?: ResolveOpts): ResolveResult | null;
|
|
98
|
+
|
|
99
|
+
export function priceOn(model: string): PriceResult | null;
|
|
100
|
+
export function priceOn(model: string, date: string, opts?: ResolveOpts): PriceResult | null;
|
|
101
|
+
export function priceOn(model: string, opts: ResolveOpts): PriceResult | null;
|
|
102
|
+
|
|
103
|
+
export function current(model: string, opts?: ResolveOpts): PriceResult | null;
|
|
104
|
+
|
|
105
|
+
export function rate(
|
|
106
|
+
model: string,
|
|
107
|
+
date?: string,
|
|
108
|
+
opts?: ResolveOpts
|
|
109
|
+
): { provider: string; model: string; date: string; inputPerM: number; outputPerM: number } | null;
|
|
110
|
+
|
|
111
|
+
export function rateAt(
|
|
112
|
+
provider: string,
|
|
113
|
+
model: string,
|
|
114
|
+
date: string
|
|
115
|
+
): { inputPerM: number; outputPerM: number } | null;
|
|
116
|
+
|
|
117
|
+
export function usdForRollup(
|
|
118
|
+
tokens: TokenRollup,
|
|
119
|
+
provider: string,
|
|
120
|
+
model: string,
|
|
121
|
+
date: string
|
|
122
|
+
): { cents: number; modelKnown: boolean };
|
|
123
|
+
|
|
124
|
+
export function usdForRollupRaw(
|
|
125
|
+
tokens: TokenRollup,
|
|
126
|
+
provider: string,
|
|
127
|
+
model: string,
|
|
128
|
+
date: string
|
|
129
|
+
): { usd: number; modelKnown: boolean };
|
|
130
|
+
|
|
131
|
+
declare const _default: {
|
|
132
|
+
meta: typeof meta;
|
|
133
|
+
bundle: PriceBundle;
|
|
134
|
+
providers: typeof providers;
|
|
135
|
+
models: typeof models;
|
|
136
|
+
candidates: typeof candidates;
|
|
137
|
+
resolve: typeof resolve;
|
|
138
|
+
priceOn: typeof priceOn;
|
|
139
|
+
current: typeof current;
|
|
140
|
+
rate: typeof rate;
|
|
141
|
+
rateAt: typeof rateAt;
|
|
142
|
+
usdForRollup: typeof usdForRollup;
|
|
143
|
+
usdForRollupRaw: typeof usdForRollupRaw;
|
|
144
|
+
};
|
|
145
|
+
export default _default;
|
package/lib/data.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"schemaVersion":"1.0.0","dataModified":"2026-06-17","license":"CC-BY-4.0","doi":"10.5281/zenodo.20730241","attribution":"AI Price Index by RoninForge (https://roninforge.org/data/ai-price-index/), CC BY 4.0","source":{"repo":"https://github.com/RoninForge/ai-price-index","ref":"v1.0.0-9-ge80b2e9","sha":"e80b2e995b517b30d2a3511d325f0edda04de354","dataPage":"https://roninforge.org/data/ai-price-index/"},"sources":["https://ai.google.dev/gemini-api/docs/pricing","https://api-docs.deepseek.com/quick_start/pricing","https://aws.amazon.com/nova/pricing/","https://cohere.com/pricing","https://developers.openai.com/api/docs/models/gpt-4.1","https://developers.openai.com/api/docs/models/gpt-5","https://developers.openai.com/api/docs/pricing","https://docs.claude.com/en/docs/about-claude/pricing","https://docs.cohere.com/docs/command-a","https://docs.cohere.com/docs/command-r-plus","https://docs.x.ai/docs/models/grok-4.20-0309-reasoning","https://docs.x.ai/docs/models/grok-4.3","https://docs.x.ai/docs/models/grok-build-0.1","https://mistral.ai/pricing","https://openai.com/index/o3-o4-mini/","https://web.archive.org/web/20230415223802/https://openai.com/pricing","https://web.archive.org/web/20231110022605/https://openai.com/pricing","https://web.archive.org/web/20240304143754/https://www.anthropic.com/api","https://web.archive.org/web/20240524210913/https://openai.com/pricing/","https://web.archive.org/web/20240624062926/https://www.anthropic.com/pricing","https://web.archive.org/web/20240722005830/https://openai.com/pricing/","https://web.archive.org/web/20240812003130/https://openai.com/pricing/","https://web.archive.org/web/20241001092414/https://ai.google.dev/pricing","https://web.archive.org/web/20241105102333/https://www.anthropic.com/news/3-5-models-and-computer-use","https://web.archive.org/web/20241203010242/https://www.anthropic.com/pricing","https://web.archive.org/web/20250211215432/https://ai.google.dev/pricing","https://web.archive.org/web/20250224210640/https://www.anthropic.com/pricing","https://web.archive.org/web/20250621161929/https://ai.google.dev/gemini-api/docs/pricing","https://www.ai21.com/pricing/","https://www.alibabacloud.com/help/en/model-studio/model-pricing","https://www.anthropic.com/news/claude-haiku-4-5","https://www.anthropic.com/news/claude-opus-4-1","https://www.anthropic.com/news/claude-opus-4-6","https://www.anthropic.com/news/claude-opus-4-7","https://www.anthropic.com/news/claude-opus-4-8","https://www.anthropic.com/news/claude-sonnet-4-6"],"series":[{"model":"jamba-large","provider":"ai21","variations":{"input":[{"confidence":"verified","from":"2025-07-03","last_validated":"2026-06-17","price_usd":2,"src":"https://www.ai21.com/pricing/","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-07-03","last_validated":"2026-06-17","price_usd":8,"src":"https://www.ai21.com/pricing/","to":null,"unit":"usd_per_mtok"}]}},{"model":"jamba-mini","provider":"ai21","variations":{"input":[{"confidence":"inferred","from":"2026-01-01","last_validated":"2026-06-17","price_usd":0.2,"src":"https://www.ai21.com/pricing/","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"inferred","from":"2026-01-01","last_validated":"2026-06-17","price_usd":0.4,"src":"https://www.ai21.com/pricing/","to":null,"unit":"usd_per_mtok"}]}},{"model":"qwen-flash","provider":"alibaba","variations":{"input":[{"confidence":"verified","from":"2025-07-28","last_validated":"2026-06-17","price_usd":0.05,"src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-07-28","last_validated":"2026-06-17","price_usd":0.4,"src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"qwen-max","provider":"alibaba","variations":{"input":[{"confidence":"verified","from":"2025-01-25","last_validated":"2026-06-17","price_usd":1.6,"src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-01-25","last_validated":"2026-06-17","price_usd":6.4,"src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"qwen-plus","provider":"alibaba","variations":{"input":[{"confidence":"verified","from":"2025-12-01","last_validated":"2026-06-17","price_usd":0.4,"src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-12-01","last_validated":"2026-06-17","price_usd":1.2,"src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"qwen-turbo","provider":"alibaba","variations":{"input":[{"confidence":"verified","from":"2025-04-28","last_validated":"2026-06-17","price_usd":0.05,"src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-04-28","last_validated":"2026-06-17","price_usd":0.2,"src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"qwen3-coder-plus","provider":"alibaba","variations":{"input":[{"confidence":"verified","from":"2025-07-22","last_validated":"2026-06-17","price_usd":1,"src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-07-22","last_validated":"2026-06-17","price_usd":5,"src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"qwen3-max","provider":"alibaba","variations":{"input":[{"confidence":"verified","from":"2026-01-23","last_validated":"2026-06-17","price_usd":1.2,"src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-01-23","last_validated":"2026-06-17","price_usd":6,"src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"qwen3.5-flash","provider":"alibaba","variations":{"input":[{"confidence":"verified","from":"2026-02-23","last_validated":"2026-06-17","price_usd":0.1,"src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-02-23","last_validated":"2026-06-17","price_usd":0.4,"src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"qwen3.5-plus","provider":"alibaba","variations":{"input":[{"confidence":"verified","from":"2026-02-15","last_validated":"2026-06-17","price_usd":0.4,"src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-02-15","last_validated":"2026-06-17","price_usd":2.4,"src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"nova-2-lite","provider":"amazon","variations":{"input":[{"confidence":"verified","from":"2025-12-02","last_validated":"2026-06-17","price_usd":0.3,"src":"https://aws.amazon.com/nova/pricing/","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-12-02","last_validated":"2026-06-17","price_usd":2.5,"src":"https://aws.amazon.com/nova/pricing/","to":null,"unit":"usd_per_mtok"}]}},{"model":"nova-lite","provider":"amazon","variations":{"input":[{"confidence":"verified","from":"2024-12-03","last_validated":"2026-06-17","price_usd":0.06,"src":"https://aws.amazon.com/nova/pricing/","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2024-12-03","last_validated":"2026-06-17","price_usd":0.24,"src":"https://aws.amazon.com/nova/pricing/","to":null,"unit":"usd_per_mtok"}]}},{"model":"nova-micro","provider":"amazon","variations":{"input":[{"confidence":"verified","from":"2024-12-03","last_validated":"2026-06-17","price_usd":0.035,"src":"https://aws.amazon.com/nova/pricing/","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2024-12-03","last_validated":"2026-06-17","price_usd":0.14,"src":"https://aws.amazon.com/nova/pricing/","to":null,"unit":"usd_per_mtok"}]}},{"model":"nova-premier","provider":"amazon","variations":{"input":[{"confidence":"verified","from":"2025-04-30","last_validated":"2026-06-17","price_usd":2.5,"src":"https://aws.amazon.com/nova/pricing/","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-04-30","last_validated":"2026-06-17","price_usd":12.5,"src":"https://aws.amazon.com/nova/pricing/","to":null,"unit":"usd_per_mtok"}]}},{"model":"nova-pro","provider":"amazon","variations":{"input":[{"confidence":"verified","from":"2024-12-03","last_validated":"2026-06-17","price_usd":0.8,"src":"https://aws.amazon.com/nova/pricing/","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2024-12-03","last_validated":"2026-06-17","price_usd":3.2,"src":"https://aws.amazon.com/nova/pricing/","to":null,"unit":"usd_per_mtok"}]}},{"model":"claude-3-5-haiku-20241022","provider":"anthropic","variations":{"input":[{"confidence":"archived","from":"2024-11-04","last_validated":"2024-11-05","price_usd":1,"snapshot":"20241105102333","src":"https://web.archive.org/web/20241105102333/https://www.anthropic.com/news/3-5-models-and-computer-use","to":"2024-12-03","unit":"usd_per_mtok"},{"confidence":"archived","from":"2024-12-03","last_validated":"2024-12-03","price_usd":0.8,"snapshot":"20241203010242","src":"https://web.archive.org/web/20241203010242/https://www.anthropic.com/pricing","to":"2026-02-19","unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2024-11-04","last_validated":"2024-11-05","price_usd":5,"snapshot":"20241105102333","src":"https://web.archive.org/web/20241105102333/https://www.anthropic.com/news/3-5-models-and-computer-use","to":"2024-12-03","unit":"usd_per_mtok"},{"confidence":"archived","from":"2024-12-03","last_validated":"2024-12-03","price_usd":4,"snapshot":"20241203010242","src":"https://web.archive.org/web/20241203010242/https://www.anthropic.com/pricing","to":"2026-02-19","unit":"usd_per_mtok"}]}},{"model":"claude-3-5-sonnet-20240620","provider":"anthropic","variations":{"input":[{"confidence":"archived","from":"2024-06-20","last_validated":"2024-06-24","price_usd":3,"snapshot":"20240624062926","src":"https://web.archive.org/web/20240624062926/https://www.anthropic.com/pricing","to":"2025-10-28","unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2024-06-20","last_validated":"2024-06-24","price_usd":15,"snapshot":"20240624062926","src":"https://web.archive.org/web/20240624062926/https://www.anthropic.com/pricing","to":"2025-10-28","unit":"usd_per_mtok"}]}},{"model":"claude-3-7-sonnet-20250219","provider":"anthropic","variations":{"input":[{"confidence":"archived","from":"2025-02-24","last_validated":"2025-02-24","price_usd":3,"snapshot":"20250224210640","src":"https://web.archive.org/web/20250224210640/https://www.anthropic.com/pricing","to":"2026-02-19","unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2025-02-24","last_validated":"2025-02-24","price_usd":15,"snapshot":"20250224210640","src":"https://web.archive.org/web/20250224210640/https://www.anthropic.com/pricing","to":"2026-02-19","unit":"usd_per_mtok"}]}},{"model":"claude-3-haiku-20240307","provider":"anthropic","variations":{"input":[{"confidence":"archived","from":"2024-03-04","last_validated":"2024-03-04","price_usd":0.25,"snapshot":"20240304143754","src":"https://web.archive.org/web/20240304143754/https://www.anthropic.com/api","to":"2026-04-20","unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2024-03-04","last_validated":"2024-03-04","price_usd":1.25,"snapshot":"20240304143754","src":"https://web.archive.org/web/20240304143754/https://www.anthropic.com/api","to":"2026-04-20","unit":"usd_per_mtok"}]}},{"model":"claude-3-opus-20240229","provider":"anthropic","variations":{"input":[{"confidence":"archived","from":"2024-03-04","last_validated":"2024-03-04","price_usd":15,"snapshot":"20240304143754","src":"https://web.archive.org/web/20240304143754/https://www.anthropic.com/api","to":"2026-01-05","unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2024-03-04","last_validated":"2024-03-04","price_usd":75,"snapshot":"20240304143754","src":"https://web.archive.org/web/20240304143754/https://www.anthropic.com/api","to":"2026-01-05","unit":"usd_per_mtok"}]}},{"model":"claude-3-sonnet-20240229","provider":"anthropic","variations":{"input":[{"confidence":"archived","from":"2024-03-04","last_validated":"2024-03-04","price_usd":3,"snapshot":"20240304143754","src":"https://web.archive.org/web/20240304143754/https://www.anthropic.com/api","to":"2025-07-21","unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2024-03-04","last_validated":"2024-03-04","price_usd":15,"snapshot":"20240304143754","src":"https://web.archive.org/web/20240304143754/https://www.anthropic.com/api","to":"2025-07-21","unit":"usd_per_mtok"}]}},{"model":"claude-fable-5","provider":"anthropic","variations":{"input":[{"confidence":"verified","from":"2026-06-09","last_validated":"2026-06-12","price_usd":10,"src":"https://docs.claude.com/en/docs/about-claude/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-06-09","last_validated":"2026-06-12","price_usd":50,"src":"https://docs.claude.com/en/docs/about-claude/pricing","to":null,"unit":"usd_per_mtok"}]}},{"aliases":["claude-haiku-4-5"],"model":"claude-haiku-4-5-20251001","provider":"anthropic","variations":{"input":[{"confidence":"verified","from":"2025-10-15","last_validated":"2026-06-16","price_usd":1,"src":"https://www.anthropic.com/news/claude-haiku-4-5","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-10-15","last_validated":"2026-06-16","price_usd":5,"src":"https://www.anthropic.com/news/claude-haiku-4-5","to":null,"unit":"usd_per_mtok"}]}},{"aliases":["claude-opus-4-1"],"model":"claude-opus-4-1-20250805","provider":"anthropic","variations":{"input":[{"confidence":"verified","from":"2025-08-05","last_validated":"2026-06-16","price_usd":15,"src":"https://www.anthropic.com/news/claude-opus-4-1","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-08-05","last_validated":"2026-06-16","price_usd":75,"src":"https://www.anthropic.com/news/claude-opus-4-1","to":null,"unit":"usd_per_mtok"}]}},{"model":"claude-opus-4-20250514","provider":"anthropic","variations":{"input":[{"confidence":"verified","from":"2025-05-14","last_validated":"2026-06-12","price_usd":15,"src":"https://docs.claude.com/en/docs/about-claude/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-05-14","last_validated":"2026-06-12","price_usd":75,"src":"https://docs.claude.com/en/docs/about-claude/pricing","to":null,"unit":"usd_per_mtok"}]}},{"aliases":["claude-opus-4-5"],"model":"claude-opus-4-5-20251101","provider":"anthropic","variations":{"input":[{"confidence":"verified","from":"2025-11-01","last_validated":"2026-06-12","price_usd":5,"src":"https://docs.claude.com/en/docs/about-claude/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-11-01","last_validated":"2026-06-12","price_usd":25,"src":"https://docs.claude.com/en/docs/about-claude/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"claude-opus-4-6","provider":"anthropic","variations":{"input":[{"confidence":"verified","from":"2026-02-05","last_validated":"2026-06-16","price_usd":5,"src":"https://www.anthropic.com/news/claude-opus-4-6","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-02-05","last_validated":"2026-06-16","price_usd":25,"src":"https://www.anthropic.com/news/claude-opus-4-6","to":null,"unit":"usd_per_mtok"}]}},{"model":"claude-opus-4-7","provider":"anthropic","variations":{"input":[{"confidence":"verified","from":"2026-04-16","last_validated":"2026-06-16","price_usd":5,"src":"https://www.anthropic.com/news/claude-opus-4-7","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-04-16","last_validated":"2026-06-16","price_usd":25,"src":"https://www.anthropic.com/news/claude-opus-4-7","to":null,"unit":"usd_per_mtok"}]}},{"model":"claude-opus-4-8","provider":"anthropic","variations":{"input":[{"confidence":"verified","from":"2026-05-28","last_validated":"2026-06-16","price_usd":5,"src":"https://www.anthropic.com/news/claude-opus-4-8","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-05-28","last_validated":"2026-06-16","price_usd":25,"src":"https://www.anthropic.com/news/claude-opus-4-8","to":null,"unit":"usd_per_mtok"}]}},{"model":"claude-sonnet-4-20250514","provider":"anthropic","variations":{"input":[{"confidence":"verified","from":"2025-05-14","last_validated":"2026-06-16","price_usd":3,"src":"https://docs.claude.com/en/docs/about-claude/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-05-14","last_validated":"2026-06-16","price_usd":15,"src":"https://docs.claude.com/en/docs/about-claude/pricing","to":null,"unit":"usd_per_mtok"}]}},{"aliases":["claude-sonnet-4-5"],"model":"claude-sonnet-4-5-20250929","provider":"anthropic","variations":{"input":[{"confidence":"verified","from":"2025-09-29","last_validated":"2026-06-12","price_usd":3,"src":"https://docs.claude.com/en/docs/about-claude/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-09-29","last_validated":"2026-06-12","price_usd":15,"src":"https://docs.claude.com/en/docs/about-claude/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"claude-sonnet-4-6","provider":"anthropic","variations":{"input":[{"confidence":"verified","from":"2026-02-17","last_validated":"2026-06-16","price_usd":3,"src":"https://www.anthropic.com/news/claude-sonnet-4-6","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-02-17","last_validated":"2026-06-16","price_usd":15,"src":"https://www.anthropic.com/news/claude-sonnet-4-6","to":null,"unit":"usd_per_mtok"}]}},{"model":"command-a-plus","provider":"cohere","variations":{"input":[{"confidence":"verified","from":"2026-05-20","last_validated":"2026-06-17","price_usd":2.5,"src":"https://docs.cohere.com/docs/command-a","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-05-20","last_validated":"2026-06-17","price_usd":10,"src":"https://docs.cohere.com/docs/command-a","to":null,"unit":"usd_per_mtok"}]}},{"model":"command-r","provider":"cohere","variations":{"input":[{"confidence":"verified","from":"2024-08-30","last_validated":"2026-06-17","price_usd":0.15,"src":"https://cohere.com/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2024-08-30","last_validated":"2026-06-17","price_usd":0.6,"src":"https://cohere.com/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"command-r-plus","provider":"cohere","variations":{"input":[{"confidence":"verified","from":"2024-08-30","last_validated":"2026-06-17","price_usd":2.5,"src":"https://docs.cohere.com/docs/command-r-plus","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2024-08-30","last_validated":"2026-06-17","price_usd":10,"src":"https://docs.cohere.com/docs/command-r-plus","to":null,"unit":"usd_per_mtok"}]}},{"model":"command-r7b","provider":"cohere","variations":{"input":[{"confidence":"verified","from":"2024-12-13","last_validated":"2026-06-17","price_usd":0.0375,"src":"https://cohere.com/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2024-12-13","last_validated":"2026-06-17","price_usd":0.15,"src":"https://cohere.com/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"deepseek-v4-flash","provider":"deepseek","variations":{"input":[{"confidence":"verified","from":"2026-04-24","last_validated":"2026-06-15","price_usd":0.14,"src":"https://api-docs.deepseek.com/quick_start/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-04-24","last_validated":"2026-06-15","price_usd":0.28,"src":"https://api-docs.deepseek.com/quick_start/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"deepseek-v4-pro","provider":"deepseek","variations":{"input":[{"confidence":"inferred","from":"2026-06-01","last_validated":"2026-06-15","price_usd":0.435,"src":"https://api-docs.deepseek.com/quick_start/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"inferred","from":"2026-06-01","last_validated":"2026-06-15","price_usd":0.87,"src":"https://api-docs.deepseek.com/quick_start/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gemini-1.5-flash","provider":"google","variations":{"input":[{"confidence":"archived","from":"2024-08-12","last_validated":"2024-10-01","price_usd":0.075,"snapshot":"20241001092414","src":"https://web.archive.org/web/20241001092414/https://ai.google.dev/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2024-08-12","last_validated":"2024-10-01","price_usd":0.3,"snapshot":"20241001092414","src":"https://web.archive.org/web/20241001092414/https://ai.google.dev/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gemini-1.5-pro","provider":"google","variations":{"input":[{"confidence":"archived","from":"2024-10-01","last_validated":"2024-10-01","price_usd":1.25,"snapshot":"20241001092414","src":"https://web.archive.org/web/20241001092414/https://ai.google.dev/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2024-10-01","last_validated":"2024-10-01","price_usd":5,"snapshot":"20241001092414","src":"https://web.archive.org/web/20241001092414/https://ai.google.dev/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gemini-2.0-flash","provider":"google","variations":{"input":[{"confidence":"archived","from":"2025-02-05","last_validated":"2025-02-11","price_usd":0.1,"snapshot":"20250211215432","src":"https://web.archive.org/web/20250211215432/https://ai.google.dev/pricing","to":"2026-06-01","unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2025-02-05","last_validated":"2025-02-11","price_usd":0.4,"snapshot":"20250211215432","src":"https://web.archive.org/web/20250211215432/https://ai.google.dev/pricing","to":"2026-06-01","unit":"usd_per_mtok"}]}},{"model":"gemini-2.5-flash","provider":"google","variations":{"input":[{"confidence":"archived","from":"2025-06-17","last_validated":"2025-06-21","price_usd":0.3,"snapshot":"20250621161929","src":"https://web.archive.org/web/20250621161929/https://ai.google.dev/gemini-api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2025-06-17","last_validated":"2025-06-21","price_usd":2.5,"snapshot":"20250621161929","src":"https://web.archive.org/web/20250621161929/https://ai.google.dev/gemini-api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gemini-2.5-flash-lite","provider":"google","variations":{"input":[{"confidence":"archived","from":"2025-06-17","last_validated":"2025-06-21","price_usd":0.1,"snapshot":"20250621161929","src":"https://web.archive.org/web/20250621161929/https://ai.google.dev/gemini-api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2025-06-17","last_validated":"2025-06-21","price_usd":0.4,"snapshot":"20250621161929","src":"https://web.archive.org/web/20250621161929/https://ai.google.dev/gemini-api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gemini-2.5-pro","provider":"google","variations":{"input":[{"confidence":"archived","from":"2025-06-17","last_validated":"2025-06-21","price_usd":1.25,"snapshot":"20250621161929","src":"https://web.archive.org/web/20250621161929/https://ai.google.dev/gemini-api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2025-06-17","last_validated":"2025-06-21","price_usd":10,"snapshot":"20250621161929","src":"https://web.archive.org/web/20250621161929/https://ai.google.dev/gemini-api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gemini-3-flash-preview","provider":"google","variations":{"input":[{"confidence":"verified","from":"2025-12-17","last_validated":"2026-06-15","price_usd":0.5,"src":"https://ai.google.dev/gemini-api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-12-17","last_validated":"2026-06-15","price_usd":3,"src":"https://ai.google.dev/gemini-api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gemini-3.1-flash-lite","provider":"google","variations":{"input":[{"confidence":"verified","from":"2026-05-07","last_validated":"2026-06-15","price_usd":0.25,"src":"https://ai.google.dev/gemini-api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-05-07","last_validated":"2026-06-15","price_usd":1.5,"src":"https://ai.google.dev/gemini-api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gemini-3.1-pro-preview","provider":"google","variations":{"input":[{"confidence":"verified","from":"2026-02-19","last_validated":"2026-06-15","price_usd":2,"src":"https://ai.google.dev/gemini-api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-02-19","last_validated":"2026-06-15","price_usd":12,"src":"https://ai.google.dev/gemini-api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gemini-3.5-flash","provider":"google","variations":{"input":[{"confidence":"verified","from":"2026-05-19","last_validated":"2026-06-15","price_usd":1.5,"src":"https://ai.google.dev/gemini-api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-05-19","last_validated":"2026-06-15","price_usd":9,"src":"https://ai.google.dev/gemini-api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"codestral-25.08","provider":"mistral","variations":{"input":[{"confidence":"verified","from":"2025-07-30","last_validated":"2026-06-15","price_usd":0.3,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-07-30","last_validated":"2026-06-15","price_usd":0.9,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"devstral-2","provider":"mistral","variations":{"input":[{"confidence":"verified","from":"2025-12-09","last_validated":"2026-06-15","price_usd":0.4,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-12-09","last_validated":"2026-06-15","price_usd":2,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"devstral-small-2","provider":"mistral","variations":{"input":[{"confidence":"verified","from":"2025-12-09","last_validated":"2026-06-15","price_usd":0.1,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-12-09","last_validated":"2026-06-15","price_usd":0.3,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"magistral-medium","provider":"mistral","variations":{"input":[{"confidence":"verified","from":"2025-06-10","last_validated":"2026-06-15","price_usd":2,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-06-10","last_validated":"2026-06-15","price_usd":5,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"magistral-small","provider":"mistral","variations":{"input":[{"confidence":"verified","from":"2025-06-10","last_validated":"2026-06-15","price_usd":0.5,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-06-10","last_validated":"2026-06-15","price_usd":1.5,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"ministral-3-14b","provider":"mistral","variations":{"input":[{"confidence":"verified","from":"2025-12-02","last_validated":"2026-06-15","price_usd":0.2,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-12-02","last_validated":"2026-06-15","price_usd":0.2,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"ministral-3-3b","provider":"mistral","variations":{"input":[{"confidence":"verified","from":"2025-12-02","last_validated":"2026-06-15","price_usd":0.1,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-12-02","last_validated":"2026-06-15","price_usd":0.1,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"ministral-3-8b","provider":"mistral","variations":{"input":[{"confidence":"verified","from":"2025-12-02","last_validated":"2026-06-15","price_usd":0.15,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-12-02","last_validated":"2026-06-15","price_usd":0.15,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"mistral-large-3","provider":"mistral","variations":{"input":[{"confidence":"verified","from":"2025-12-02","last_validated":"2026-06-15","price_usd":0.5,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-12-02","last_validated":"2026-06-15","price_usd":1.5,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"mistral-medium-3.5","provider":"mistral","variations":{"input":[{"confidence":"inferred","from":"2026-04-29","last_validated":"2026-06-15","price_usd":1.5,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"inferred","from":"2026-04-29","last_validated":"2026-06-15","price_usd":7.5,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"mistral-small-4","provider":"mistral","variations":{"input":[{"confidence":"verified","from":"2026-03-16","last_validated":"2026-06-15","price_usd":0.1,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-03-16","last_validated":"2026-06-15","price_usd":0.3,"src":"https://mistral.ai/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gpt-4","provider":"openai","variations":{"input":[{"confidence":"archived","from":"2023-03-14","last_validated":"2023-04-15","price_usd":30,"snapshot":"20230415223802","src":"https://web.archive.org/web/20230415223802/https://openai.com/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2023-03-14","last_validated":"2023-04-15","price_usd":60,"snapshot":"20230415223802","src":"https://web.archive.org/web/20230415223802/https://openai.com/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gpt-4-turbo","provider":"openai","variations":{"input":[{"confidence":"archived","from":"2023-11-06","last_validated":"2023-11-10","price_usd":10,"snapshot":"20231110022605","src":"https://web.archive.org/web/20231110022605/https://openai.com/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2023-11-06","last_validated":"2023-11-10","price_usd":30,"snapshot":"20231110022605","src":"https://web.archive.org/web/20231110022605/https://openai.com/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gpt-4.1","provider":"openai","variations":{"input":[{"confidence":"verified","from":"2025-04-14","last_validated":"2026-06-15","price_usd":2,"src":"https://developers.openai.com/api/docs/models/gpt-4.1","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-04-14","last_validated":"2026-06-15","price_usd":8,"src":"https://developers.openai.com/api/docs/models/gpt-4.1","to":null,"unit":"usd_per_mtok"}]}},{"model":"gpt-4o","provider":"openai","variations":{"input":[{"confidence":"archived","from":"2024-05-13","last_validated":"2024-05-24","price_usd":5,"snapshot":"20240524210913","src":"https://web.archive.org/web/20240524210913/https://openai.com/pricing/","to":"2024-08-06","unit":"usd_per_mtok"},{"confidence":"archived","from":"2024-08-06","last_validated":"2024-08-12","price_usd":2.5,"snapshot":"20240812003130","src":"https://web.archive.org/web/20240812003130/https://openai.com/pricing/","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2024-05-13","last_validated":"2024-05-24","price_usd":15,"snapshot":"20240524210913","src":"https://web.archive.org/web/20240524210913/https://openai.com/pricing/","to":"2024-08-06","unit":"usd_per_mtok"},{"confidence":"archived","from":"2024-08-06","last_validated":"2024-08-12","price_usd":10,"snapshot":"20240812003130","src":"https://web.archive.org/web/20240812003130/https://openai.com/pricing/","to":null,"unit":"usd_per_mtok"}]}},{"model":"gpt-4o-mini","provider":"openai","variations":{"input":[{"confidence":"archived","from":"2024-07-18","last_validated":"2024-07-22","price_usd":0.15,"snapshot":"20240722005830","src":"https://web.archive.org/web/20240722005830/https://openai.com/pricing/","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2024-07-18","last_validated":"2024-07-22","price_usd":0.6,"snapshot":"20240722005830","src":"https://web.archive.org/web/20240722005830/https://openai.com/pricing/","to":null,"unit":"usd_per_mtok"}]}},{"model":"gpt-5","provider":"openai","variations":{"input":[{"confidence":"inferred","from":"2025-08-07","last_validated":"2026-06-15","price_usd":1.25,"src":"https://developers.openai.com/api/docs/models/gpt-5","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"inferred","from":"2025-08-07","last_validated":"2026-06-15","price_usd":10,"src":"https://developers.openai.com/api/docs/models/gpt-5","to":null,"unit":"usd_per_mtok"}]}},{"model":"gpt-5.1","provider":"openai","variations":{"input":[{"confidence":"inferred","from":"2025-11-13","last_validated":"2026-06-17","price_usd":1.25,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"inferred","from":"2025-11-13","last_validated":"2026-06-17","price_usd":10,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gpt-5.2","provider":"openai","variations":{"input":[{"confidence":"inferred","from":"2026-01-15","last_validated":"2026-06-17","price_usd":1.75,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"inferred","from":"2026-01-15","last_validated":"2026-06-17","price_usd":14,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gpt-5.2-pro","provider":"openai","variations":{"input":[{"confidence":"inferred","from":"2026-01-15","last_validated":"2026-06-17","price_usd":21,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"inferred","from":"2026-01-15","last_validated":"2026-06-17","price_usd":168,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gpt-5.4","provider":"openai","variations":{"input":[{"confidence":"verified","from":"2026-03-05","last_validated":"2026-06-15","price_usd":2.5,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-03-05","last_validated":"2026-06-15","price_usd":15,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gpt-5.4-mini","provider":"openai","variations":{"input":[{"confidence":"verified","from":"2026-03-17","last_validated":"2026-06-15","price_usd":0.75,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-03-17","last_validated":"2026-06-15","price_usd":4.5,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gpt-5.4-nano","provider":"openai","variations":{"input":[{"confidence":"verified","from":"2026-03-17","last_validated":"2026-06-15","price_usd":0.2,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-03-17","last_validated":"2026-06-15","price_usd":1.25,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gpt-5.4-pro","provider":"openai","variations":{"input":[{"confidence":"verified","from":"2026-03-05","last_validated":"2026-06-15","price_usd":30,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-03-05","last_validated":"2026-06-15","price_usd":180,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gpt-5.5","provider":"openai","variations":{"input":[{"confidence":"verified","from":"2026-04-24","last_validated":"2026-06-15","price_usd":5,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-04-24","last_validated":"2026-06-15","price_usd":30,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"gpt-5.5-pro","provider":"openai","variations":{"input":[{"confidence":"verified","from":"2026-04-24","last_validated":"2026-06-15","price_usd":30,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-04-24","last_validated":"2026-06-15","price_usd":180,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"o1","provider":"openai","variations":{"input":[{"confidence":"verified","from":"2024-12-17","last_validated":"2026-06-17","price_usd":15,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2024-12-17","last_validated":"2026-06-17","price_usd":60,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"o1-mini","provider":"openai","variations":{"input":[{"confidence":"verified","from":"2024-09-12","last_validated":"2026-06-17","price_usd":1.1,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2024-09-12","last_validated":"2026-06-17","price_usd":4.4,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"o1-pro","provider":"openai","variations":{"input":[{"confidence":"verified","from":"2025-03-19","last_validated":"2026-06-17","price_usd":150,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-03-19","last_validated":"2026-06-17","price_usd":600,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"o3","provider":"openai","variations":{"input":[{"confidence":"archived","from":"2025-04-16","last_validated":"2026-06-17","price_usd":10,"src":"https://openai.com/index/o3-o4-mini/","to":"2025-06-10","unit":"usd_per_mtok"},{"confidence":"verified","from":"2025-06-10","last_validated":"2026-06-17","price_usd":2,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"archived","from":"2025-04-16","last_validated":"2026-06-17","price_usd":40,"src":"https://openai.com/index/o3-o4-mini/","to":"2025-06-10","unit":"usd_per_mtok"},{"confidence":"verified","from":"2025-06-10","last_validated":"2026-06-17","price_usd":8,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"o3-deep-research","provider":"openai","variations":{"input":[{"confidence":"verified","from":"2025-06-26","last_validated":"2026-06-17","price_usd":10,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-06-26","last_validated":"2026-06-17","price_usd":40,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"o3-mini","provider":"openai","variations":{"input":[{"confidence":"verified","from":"2025-01-31","last_validated":"2026-06-17","price_usd":1.1,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-01-31","last_validated":"2026-06-17","price_usd":4.4,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"o3-pro","provider":"openai","variations":{"input":[{"confidence":"verified","from":"2025-06-10","last_validated":"2026-06-17","price_usd":20,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-06-10","last_validated":"2026-06-17","price_usd":80,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"o4-mini","provider":"openai","variations":{"input":[{"confidence":"verified","from":"2025-04-16","last_validated":"2026-06-17","price_usd":1.1,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-04-16","last_validated":"2026-06-17","price_usd":4.4,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"o4-mini-deep-research","provider":"openai","variations":{"input":[{"confidence":"verified","from":"2025-06-26","last_validated":"2026-06-17","price_usd":2,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2025-06-26","last_validated":"2026-06-17","price_usd":8,"src":"https://developers.openai.com/api/docs/pricing","to":null,"unit":"usd_per_mtok"}]}},{"model":"grok-4.20-0309-reasoning","provider":"xai","variations":{"input":[{"confidence":"verified","from":"2026-03-09","last_validated":"2026-06-17","price_usd":1.25,"src":"https://docs.x.ai/docs/models/grok-4.20-0309-reasoning","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-03-09","last_validated":"2026-06-17","price_usd":2.5,"src":"https://docs.x.ai/docs/models/grok-4.20-0309-reasoning","to":null,"unit":"usd_per_mtok"}]}},{"model":"grok-4.3","provider":"xai","variations":{"input":[{"confidence":"verified","from":"2026-05-05","last_validated":"2026-06-17","price_usd":1.25,"src":"https://docs.x.ai/docs/models/grok-4.3","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"verified","from":"2026-05-05","last_validated":"2026-06-17","price_usd":2.5,"src":"https://docs.x.ai/docs/models/grok-4.3","to":null,"unit":"usd_per_mtok"}]}},{"model":"grok-build-0.1","provider":"xai","variations":{"input":[{"confidence":"inferred","from":"2026-06-01","last_validated":"2026-06-17","price_usd":1,"src":"https://docs.x.ai/docs/models/grok-build-0.1","to":null,"unit":"usd_per_mtok"}],"output":[{"confidence":"inferred","from":"2026-06-01","last_validated":"2026-06-17","price_usd":2,"src":"https://docs.x.ai/docs/models/grok-build-0.1","to":null,"unit":"usd_per_mtok"}]}}],"current":[{"provider":"ai21","model":"jamba-large","variation":"input","price_usd":2,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.ai21.com/pricing/"},{"provider":"ai21","model":"jamba-large","variation":"output","price_usd":8,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.ai21.com/pricing/"},{"provider":"ai21","model":"jamba-mini","variation":"input","price_usd":0.2,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"inferred","src":"https://www.ai21.com/pricing/"},{"provider":"ai21","model":"jamba-mini","variation":"output","price_usd":0.4,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"inferred","src":"https://www.ai21.com/pricing/"},{"provider":"alibaba","model":"qwen-flash","variation":"input","price_usd":0.05,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing"},{"provider":"alibaba","model":"qwen-flash","variation":"output","price_usd":0.4,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing"},{"provider":"alibaba","model":"qwen-max","variation":"input","price_usd":1.6,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing"},{"provider":"alibaba","model":"qwen-max","variation":"output","price_usd":6.4,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing"},{"provider":"alibaba","model":"qwen-plus","variation":"input","price_usd":0.4,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing"},{"provider":"alibaba","model":"qwen-plus","variation":"output","price_usd":1.2,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing"},{"provider":"alibaba","model":"qwen-turbo","variation":"input","price_usd":0.05,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing"},{"provider":"alibaba","model":"qwen-turbo","variation":"output","price_usd":0.2,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing"},{"provider":"alibaba","model":"qwen3-coder-plus","variation":"input","price_usd":1,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing"},{"provider":"alibaba","model":"qwen3-coder-plus","variation":"output","price_usd":5,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing"},{"provider":"alibaba","model":"qwen3-max","variation":"input","price_usd":1.2,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing"},{"provider":"alibaba","model":"qwen3-max","variation":"output","price_usd":6,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing"},{"provider":"alibaba","model":"qwen3.5-flash","variation":"input","price_usd":0.1,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing"},{"provider":"alibaba","model":"qwen3.5-flash","variation":"output","price_usd":0.4,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing"},{"provider":"alibaba","model":"qwen3.5-plus","variation":"input","price_usd":0.4,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing"},{"provider":"alibaba","model":"qwen3.5-plus","variation":"output","price_usd":2.4,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://www.alibabacloud.com/help/en/model-studio/model-pricing"},{"provider":"amazon","model":"nova-2-lite","variation":"input","price_usd":0.3,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://aws.amazon.com/nova/pricing/"},{"provider":"amazon","model":"nova-2-lite","variation":"output","price_usd":2.5,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://aws.amazon.com/nova/pricing/"},{"provider":"amazon","model":"nova-lite","variation":"input","price_usd":0.06,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://aws.amazon.com/nova/pricing/"},{"provider":"amazon","model":"nova-lite","variation":"output","price_usd":0.24,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://aws.amazon.com/nova/pricing/"},{"provider":"amazon","model":"nova-micro","variation":"input","price_usd":0.035,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://aws.amazon.com/nova/pricing/"},{"provider":"amazon","model":"nova-micro","variation":"output","price_usd":0.14,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://aws.amazon.com/nova/pricing/"},{"provider":"amazon","model":"nova-premier","variation":"input","price_usd":2.5,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://aws.amazon.com/nova/pricing/"},{"provider":"amazon","model":"nova-premier","variation":"output","price_usd":12.5,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://aws.amazon.com/nova/pricing/"},{"provider":"amazon","model":"nova-pro","variation":"input","price_usd":0.8,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://aws.amazon.com/nova/pricing/"},{"provider":"amazon","model":"nova-pro","variation":"output","price_usd":3.2,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://aws.amazon.com/nova/pricing/"},{"provider":"anthropic","model":"claude-fable-5","variation":"input","price_usd":10,"unit":"usd_per_mtok","last_validated":"2026-06-12","confidence":"verified","src":"https://docs.claude.com/en/docs/about-claude/pricing"},{"provider":"anthropic","model":"claude-fable-5","variation":"output","price_usd":50,"unit":"usd_per_mtok","last_validated":"2026-06-12","confidence":"verified","src":"https://docs.claude.com/en/docs/about-claude/pricing"},{"provider":"anthropic","model":"claude-haiku-4-5-20251001","variation":"input","price_usd":1,"unit":"usd_per_mtok","last_validated":"2026-06-16","confidence":"verified","src":"https://www.anthropic.com/news/claude-haiku-4-5"},{"provider":"anthropic","model":"claude-haiku-4-5-20251001","variation":"output","price_usd":5,"unit":"usd_per_mtok","last_validated":"2026-06-16","confidence":"verified","src":"https://www.anthropic.com/news/claude-haiku-4-5"},{"provider":"anthropic","model":"claude-opus-4-1-20250805","variation":"input","price_usd":15,"unit":"usd_per_mtok","last_validated":"2026-06-16","confidence":"verified","src":"https://www.anthropic.com/news/claude-opus-4-1"},{"provider":"anthropic","model":"claude-opus-4-1-20250805","variation":"output","price_usd":75,"unit":"usd_per_mtok","last_validated":"2026-06-16","confidence":"verified","src":"https://www.anthropic.com/news/claude-opus-4-1"},{"provider":"anthropic","model":"claude-opus-4-20250514","variation":"input","price_usd":15,"unit":"usd_per_mtok","last_validated":"2026-06-12","confidence":"verified","src":"https://docs.claude.com/en/docs/about-claude/pricing"},{"provider":"anthropic","model":"claude-opus-4-20250514","variation":"output","price_usd":75,"unit":"usd_per_mtok","last_validated":"2026-06-12","confidence":"verified","src":"https://docs.claude.com/en/docs/about-claude/pricing"},{"provider":"anthropic","model":"claude-opus-4-5-20251101","variation":"input","price_usd":5,"unit":"usd_per_mtok","last_validated":"2026-06-12","confidence":"verified","src":"https://docs.claude.com/en/docs/about-claude/pricing"},{"provider":"anthropic","model":"claude-opus-4-5-20251101","variation":"output","price_usd":25,"unit":"usd_per_mtok","last_validated":"2026-06-12","confidence":"verified","src":"https://docs.claude.com/en/docs/about-claude/pricing"},{"provider":"anthropic","model":"claude-opus-4-6","variation":"input","price_usd":5,"unit":"usd_per_mtok","last_validated":"2026-06-16","confidence":"verified","src":"https://www.anthropic.com/news/claude-opus-4-6"},{"provider":"anthropic","model":"claude-opus-4-6","variation":"output","price_usd":25,"unit":"usd_per_mtok","last_validated":"2026-06-16","confidence":"verified","src":"https://www.anthropic.com/news/claude-opus-4-6"},{"provider":"anthropic","model":"claude-opus-4-7","variation":"input","price_usd":5,"unit":"usd_per_mtok","last_validated":"2026-06-16","confidence":"verified","src":"https://www.anthropic.com/news/claude-opus-4-7"},{"provider":"anthropic","model":"claude-opus-4-7","variation":"output","price_usd":25,"unit":"usd_per_mtok","last_validated":"2026-06-16","confidence":"verified","src":"https://www.anthropic.com/news/claude-opus-4-7"},{"provider":"anthropic","model":"claude-opus-4-8","variation":"input","price_usd":5,"unit":"usd_per_mtok","last_validated":"2026-06-16","confidence":"verified","src":"https://www.anthropic.com/news/claude-opus-4-8"},{"provider":"anthropic","model":"claude-opus-4-8","variation":"output","price_usd":25,"unit":"usd_per_mtok","last_validated":"2026-06-16","confidence":"verified","src":"https://www.anthropic.com/news/claude-opus-4-8"},{"provider":"anthropic","model":"claude-sonnet-4-20250514","variation":"input","price_usd":3,"unit":"usd_per_mtok","last_validated":"2026-06-16","confidence":"verified","src":"https://docs.claude.com/en/docs/about-claude/pricing"},{"provider":"anthropic","model":"claude-sonnet-4-20250514","variation":"output","price_usd":15,"unit":"usd_per_mtok","last_validated":"2026-06-16","confidence":"verified","src":"https://docs.claude.com/en/docs/about-claude/pricing"},{"provider":"anthropic","model":"claude-sonnet-4-5-20250929","variation":"input","price_usd":3,"unit":"usd_per_mtok","last_validated":"2026-06-12","confidence":"verified","src":"https://docs.claude.com/en/docs/about-claude/pricing"},{"provider":"anthropic","model":"claude-sonnet-4-5-20250929","variation":"output","price_usd":15,"unit":"usd_per_mtok","last_validated":"2026-06-12","confidence":"verified","src":"https://docs.claude.com/en/docs/about-claude/pricing"},{"provider":"anthropic","model":"claude-sonnet-4-6","variation":"input","price_usd":3,"unit":"usd_per_mtok","last_validated":"2026-06-16","confidence":"verified","src":"https://www.anthropic.com/news/claude-sonnet-4-6"},{"provider":"anthropic","model":"claude-sonnet-4-6","variation":"output","price_usd":15,"unit":"usd_per_mtok","last_validated":"2026-06-16","confidence":"verified","src":"https://www.anthropic.com/news/claude-sonnet-4-6"},{"provider":"cohere","model":"command-a-plus","variation":"input","price_usd":2.5,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://docs.cohere.com/docs/command-a"},{"provider":"cohere","model":"command-a-plus","variation":"output","price_usd":10,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://docs.cohere.com/docs/command-a"},{"provider":"cohere","model":"command-r","variation":"input","price_usd":0.15,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://cohere.com/pricing"},{"provider":"cohere","model":"command-r","variation":"output","price_usd":0.6,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://cohere.com/pricing"},{"provider":"cohere","model":"command-r-plus","variation":"input","price_usd":2.5,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://docs.cohere.com/docs/command-r-plus"},{"provider":"cohere","model":"command-r-plus","variation":"output","price_usd":10,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://docs.cohere.com/docs/command-r-plus"},{"provider":"cohere","model":"command-r7b","variation":"input","price_usd":0.0375,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://cohere.com/pricing"},{"provider":"cohere","model":"command-r7b","variation":"output","price_usd":0.15,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://cohere.com/pricing"},{"provider":"deepseek","model":"deepseek-v4-flash","variation":"input","price_usd":0.14,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://api-docs.deepseek.com/quick_start/pricing"},{"provider":"deepseek","model":"deepseek-v4-flash","variation":"output","price_usd":0.28,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://api-docs.deepseek.com/quick_start/pricing"},{"provider":"deepseek","model":"deepseek-v4-pro","variation":"input","price_usd":0.435,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"inferred","src":"https://api-docs.deepseek.com/quick_start/pricing"},{"provider":"deepseek","model":"deepseek-v4-pro","variation":"output","price_usd":0.87,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"inferred","src":"https://api-docs.deepseek.com/quick_start/pricing"},{"provider":"google","model":"gemini-1.5-flash","variation":"input","price_usd":0.075,"unit":"usd_per_mtok","last_validated":"2024-10-01","confidence":"archived","src":"https://web.archive.org/web/20241001092414/https://ai.google.dev/pricing"},{"provider":"google","model":"gemini-1.5-flash","variation":"output","price_usd":0.3,"unit":"usd_per_mtok","last_validated":"2024-10-01","confidence":"archived","src":"https://web.archive.org/web/20241001092414/https://ai.google.dev/pricing"},{"provider":"google","model":"gemini-1.5-pro","variation":"input","price_usd":1.25,"unit":"usd_per_mtok","last_validated":"2024-10-01","confidence":"archived","src":"https://web.archive.org/web/20241001092414/https://ai.google.dev/pricing"},{"provider":"google","model":"gemini-1.5-pro","variation":"output","price_usd":5,"unit":"usd_per_mtok","last_validated":"2024-10-01","confidence":"archived","src":"https://web.archive.org/web/20241001092414/https://ai.google.dev/pricing"},{"provider":"google","model":"gemini-2.5-flash","variation":"input","price_usd":0.3,"unit":"usd_per_mtok","last_validated":"2025-06-21","confidence":"archived","src":"https://web.archive.org/web/20250621161929/https://ai.google.dev/gemini-api/docs/pricing"},{"provider":"google","model":"gemini-2.5-flash","variation":"output","price_usd":2.5,"unit":"usd_per_mtok","last_validated":"2025-06-21","confidence":"archived","src":"https://web.archive.org/web/20250621161929/https://ai.google.dev/gemini-api/docs/pricing"},{"provider":"google","model":"gemini-2.5-flash-lite","variation":"input","price_usd":0.1,"unit":"usd_per_mtok","last_validated":"2025-06-21","confidence":"archived","src":"https://web.archive.org/web/20250621161929/https://ai.google.dev/gemini-api/docs/pricing"},{"provider":"google","model":"gemini-2.5-flash-lite","variation":"output","price_usd":0.4,"unit":"usd_per_mtok","last_validated":"2025-06-21","confidence":"archived","src":"https://web.archive.org/web/20250621161929/https://ai.google.dev/gemini-api/docs/pricing"},{"provider":"google","model":"gemini-2.5-pro","variation":"input","price_usd":1.25,"unit":"usd_per_mtok","last_validated":"2025-06-21","confidence":"archived","src":"https://web.archive.org/web/20250621161929/https://ai.google.dev/gemini-api/docs/pricing"},{"provider":"google","model":"gemini-2.5-pro","variation":"output","price_usd":10,"unit":"usd_per_mtok","last_validated":"2025-06-21","confidence":"archived","src":"https://web.archive.org/web/20250621161929/https://ai.google.dev/gemini-api/docs/pricing"},{"provider":"google","model":"gemini-3-flash-preview","variation":"input","price_usd":0.5,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://ai.google.dev/gemini-api/docs/pricing"},{"provider":"google","model":"gemini-3-flash-preview","variation":"output","price_usd":3,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://ai.google.dev/gemini-api/docs/pricing"},{"provider":"google","model":"gemini-3.1-flash-lite","variation":"input","price_usd":0.25,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://ai.google.dev/gemini-api/docs/pricing"},{"provider":"google","model":"gemini-3.1-flash-lite","variation":"output","price_usd":1.5,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://ai.google.dev/gemini-api/docs/pricing"},{"provider":"google","model":"gemini-3.1-pro-preview","variation":"input","price_usd":2,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://ai.google.dev/gemini-api/docs/pricing"},{"provider":"google","model":"gemini-3.1-pro-preview","variation":"output","price_usd":12,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://ai.google.dev/gemini-api/docs/pricing"},{"provider":"google","model":"gemini-3.5-flash","variation":"input","price_usd":1.5,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://ai.google.dev/gemini-api/docs/pricing"},{"provider":"google","model":"gemini-3.5-flash","variation":"output","price_usd":9,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://ai.google.dev/gemini-api/docs/pricing"},{"provider":"mistral","model":"codestral-25.08","variation":"input","price_usd":0.3,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"codestral-25.08","variation":"output","price_usd":0.9,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"devstral-2","variation":"input","price_usd":0.4,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"devstral-2","variation":"output","price_usd":2,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"devstral-small-2","variation":"input","price_usd":0.1,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"devstral-small-2","variation":"output","price_usd":0.3,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"magistral-medium","variation":"input","price_usd":2,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"magistral-medium","variation":"output","price_usd":5,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"magistral-small","variation":"input","price_usd":0.5,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"magistral-small","variation":"output","price_usd":1.5,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"ministral-3-14b","variation":"input","price_usd":0.2,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"ministral-3-14b","variation":"output","price_usd":0.2,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"ministral-3-3b","variation":"input","price_usd":0.1,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"ministral-3-3b","variation":"output","price_usd":0.1,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"ministral-3-8b","variation":"input","price_usd":0.15,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"ministral-3-8b","variation":"output","price_usd":0.15,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"mistral-large-3","variation":"input","price_usd":0.5,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"mistral-large-3","variation":"output","price_usd":1.5,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"mistral-medium-3.5","variation":"input","price_usd":1.5,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"inferred","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"mistral-medium-3.5","variation":"output","price_usd":7.5,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"inferred","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"mistral-small-4","variation":"input","price_usd":0.1,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"mistral","model":"mistral-small-4","variation":"output","price_usd":0.3,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://mistral.ai/pricing"},{"provider":"openai","model":"gpt-4","variation":"input","price_usd":30,"unit":"usd_per_mtok","last_validated":"2023-04-15","confidence":"archived","src":"https://web.archive.org/web/20230415223802/https://openai.com/pricing"},{"provider":"openai","model":"gpt-4","variation":"output","price_usd":60,"unit":"usd_per_mtok","last_validated":"2023-04-15","confidence":"archived","src":"https://web.archive.org/web/20230415223802/https://openai.com/pricing"},{"provider":"openai","model":"gpt-4-turbo","variation":"input","price_usd":10,"unit":"usd_per_mtok","last_validated":"2023-11-10","confidence":"archived","src":"https://web.archive.org/web/20231110022605/https://openai.com/pricing"},{"provider":"openai","model":"gpt-4-turbo","variation":"output","price_usd":30,"unit":"usd_per_mtok","last_validated":"2023-11-10","confidence":"archived","src":"https://web.archive.org/web/20231110022605/https://openai.com/pricing"},{"provider":"openai","model":"gpt-4.1","variation":"input","price_usd":2,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://developers.openai.com/api/docs/models/gpt-4.1"},{"provider":"openai","model":"gpt-4.1","variation":"output","price_usd":8,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://developers.openai.com/api/docs/models/gpt-4.1"},{"provider":"openai","model":"gpt-4o","variation":"input","price_usd":2.5,"unit":"usd_per_mtok","last_validated":"2024-08-12","confidence":"archived","src":"https://web.archive.org/web/20240812003130/https://openai.com/pricing/"},{"provider":"openai","model":"gpt-4o","variation":"output","price_usd":10,"unit":"usd_per_mtok","last_validated":"2024-08-12","confidence":"archived","src":"https://web.archive.org/web/20240812003130/https://openai.com/pricing/"},{"provider":"openai","model":"gpt-4o-mini","variation":"input","price_usd":0.15,"unit":"usd_per_mtok","last_validated":"2024-07-22","confidence":"archived","src":"https://web.archive.org/web/20240722005830/https://openai.com/pricing/"},{"provider":"openai","model":"gpt-4o-mini","variation":"output","price_usd":0.6,"unit":"usd_per_mtok","last_validated":"2024-07-22","confidence":"archived","src":"https://web.archive.org/web/20240722005830/https://openai.com/pricing/"},{"provider":"openai","model":"gpt-5","variation":"input","price_usd":1.25,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"inferred","src":"https://developers.openai.com/api/docs/models/gpt-5"},{"provider":"openai","model":"gpt-5","variation":"output","price_usd":10,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"inferred","src":"https://developers.openai.com/api/docs/models/gpt-5"},{"provider":"openai","model":"gpt-5.1","variation":"input","price_usd":1.25,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"inferred","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.1","variation":"output","price_usd":10,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"inferred","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.2","variation":"input","price_usd":1.75,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"inferred","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.2","variation":"output","price_usd":14,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"inferred","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.2-pro","variation":"input","price_usd":21,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"inferred","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.2-pro","variation":"output","price_usd":168,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"inferred","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.4","variation":"input","price_usd":2.5,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.4","variation":"output","price_usd":15,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.4-mini","variation":"input","price_usd":0.75,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.4-mini","variation":"output","price_usd":4.5,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.4-nano","variation":"input","price_usd":0.2,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.4-nano","variation":"output","price_usd":1.25,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.4-pro","variation":"input","price_usd":30,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.4-pro","variation":"output","price_usd":180,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.5","variation":"input","price_usd":5,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.5","variation":"output","price_usd":30,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.5-pro","variation":"input","price_usd":30,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"gpt-5.5-pro","variation":"output","price_usd":180,"unit":"usd_per_mtok","last_validated":"2026-06-15","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o1","variation":"input","price_usd":15,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o1","variation":"output","price_usd":60,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o1-mini","variation":"input","price_usd":1.1,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o1-mini","variation":"output","price_usd":4.4,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o1-pro","variation":"input","price_usd":150,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o1-pro","variation":"output","price_usd":600,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o3","variation":"input","price_usd":2,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o3","variation":"output","price_usd":8,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o3-deep-research","variation":"input","price_usd":10,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o3-deep-research","variation":"output","price_usd":40,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o3-mini","variation":"input","price_usd":1.1,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o3-mini","variation":"output","price_usd":4.4,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o3-pro","variation":"input","price_usd":20,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o3-pro","variation":"output","price_usd":80,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o4-mini","variation":"input","price_usd":1.1,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o4-mini","variation":"output","price_usd":4.4,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o4-mini-deep-research","variation":"input","price_usd":2,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"openai","model":"o4-mini-deep-research","variation":"output","price_usd":8,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://developers.openai.com/api/docs/pricing"},{"provider":"xai","model":"grok-4.20-0309-reasoning","variation":"input","price_usd":1.25,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://docs.x.ai/docs/models/grok-4.20-0309-reasoning"},{"provider":"xai","model":"grok-4.20-0309-reasoning","variation":"output","price_usd":2.5,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://docs.x.ai/docs/models/grok-4.20-0309-reasoning"},{"provider":"xai","model":"grok-4.3","variation":"input","price_usd":1.25,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://docs.x.ai/docs/models/grok-4.3"},{"provider":"xai","model":"grok-4.3","variation":"output","price_usd":2.5,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"verified","src":"https://docs.x.ai/docs/models/grok-4.3"},{"provider":"xai","model":"grok-build-0.1","variation":"input","price_usd":1,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"inferred","src":"https://docs.x.ai/docs/models/grok-build-0.1"},{"provider":"xai","model":"grok-build-0.1","variation":"output","price_usd":2,"unit":"usd_per_mtok","last_validated":"2026-06-17","confidence":"inferred","src":"https://docs.x.ai/docs/models/grok-build-0.1"}]}
|
package/lib/engine.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Point-in-time pricing engine. Pure, zero-dependency, no runtime network: it reads the bundle that
|
|
2
|
+
// ships inside this package (lib/data.json, built by tools/build-npm.mjs). This is a faithful port of
|
|
3
|
+
// Goei's server engine (src/lib/server/pricing/{engine,bundle}.ts) so all three engines - the landing
|
|
4
|
+
// app, Goei, BudgetClaw - reproduce the SAME shared golden vectors (examples/pricing-vectors.json) to
|
|
5
|
+
// the cent. Half-open interval semantics: a rate applies for `from <= date && (to === null || date < to)`.
|
|
6
|
+
// Cache read = 0.1x input; cache write = 1.25x (5m) or 2x (1h).
|
|
7
|
+
import { readFileSync } from 'node:fs';
|
|
8
|
+
|
|
9
|
+
/** @type {import('../index.js').PriceBundle} */
|
|
10
|
+
export const bundle = JSON.parse(readFileSync(new URL('./data.json', import.meta.url), 'utf8'));
|
|
11
|
+
|
|
12
|
+
export const CACHE_READ_MULT = 0.1;
|
|
13
|
+
export const CACHE_WRITE_5M_MULT = 1.25;
|
|
14
|
+
export const CACHE_WRITE_1H_MULT = 2;
|
|
15
|
+
|
|
16
|
+
// "provider/model" (and "provider/alias") -> series. Canonical model keys win over alias keys on a
|
|
17
|
+
// collision (canonical inserted last and overwrites), matching bundle.ts.
|
|
18
|
+
const SERIES_BY_KEY = new Map();
|
|
19
|
+
for (const s of bundle.series) {
|
|
20
|
+
for (const alias of s.aliases ?? []) SERIES_BY_KEY.set(`${s.provider}/${alias}`, s);
|
|
21
|
+
}
|
|
22
|
+
for (const s of bundle.series) SERIES_BY_KEY.set(`${s.provider}/${s.model}`, s);
|
|
23
|
+
|
|
24
|
+
/** Exact-or-alias lookup for one provider/model id. No tolerance here (the engine layers that on). */
|
|
25
|
+
export function seriesFor(provider, model) {
|
|
26
|
+
return SERIES_BY_KEY.get(`${provider}/${model}`) ?? null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** All series for a provider (used by the prefix-tolerance fallback). */
|
|
30
|
+
export function seriesForProvider(provider) {
|
|
31
|
+
return bundle.series.filter((s) => s.provider === provider);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Pick the interval covering `date` with half-open semantics. ISO YYYY-MM-DD sorts lexicographically,
|
|
35
|
+
* so plain string comparison is exact. */
|
|
36
|
+
export function intervalAt(intervals, date) {
|
|
37
|
+
for (const iv of intervals) {
|
|
38
|
+
if (iv.from <= date && (iv.to === null || date < iv.to)) return iv;
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Resolve a model id to its series with claude-cost-style tolerance: exact/alias, then strip a
|
|
44
|
+
* trailing display suffix like "[1m]", then prefix tolerance against canonical ids + aliases within
|
|
45
|
+
* the same provider. Mirrors Goei's resolveSeries exactly. */
|
|
46
|
+
export function resolveSeries(provider, model) {
|
|
47
|
+
const direct = seriesFor(provider, model);
|
|
48
|
+
if (direct) return direct;
|
|
49
|
+
|
|
50
|
+
const base = model.replace('[1m]', '').trim();
|
|
51
|
+
if (base !== model) {
|
|
52
|
+
const viaBase = seriesFor(provider, base);
|
|
53
|
+
if (viaBase) return viaBase;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
for (const s of seriesForProvider(provider)) {
|
|
57
|
+
const ids = [s.model, ...(s.aliases ?? [])];
|
|
58
|
+
for (const id of ids) {
|
|
59
|
+
if (base.startsWith(id) || id.startsWith(base)) return s;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Point-in-time per-million input/output rates for (provider, model) on `date`, or null if the model
|
|
66
|
+
* is unresolved or the date is not covered. */
|
|
67
|
+
export function rateAt(provider, model, date) {
|
|
68
|
+
const s = resolveSeries(provider, model);
|
|
69
|
+
if (!s) return null;
|
|
70
|
+
const inIv = intervalAt(s.variations.input, date);
|
|
71
|
+
const outIv = intervalAt(s.variations.output, date);
|
|
72
|
+
if (!inIv || !outIv) return null;
|
|
73
|
+
return { inputPerM: inIv.price_usd, outputPerM: outIv.price_usd };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** USD value of a token rollup at a point in time. Returns 0 with modelKnown=false when the model is
|
|
77
|
+
* unknown (so callers can count unpriced rows rather than silently mis-bill). */
|
|
78
|
+
export function usdForRollupRaw(tokens, provider, model, date) {
|
|
79
|
+
const r = rateAt(provider, model, date);
|
|
80
|
+
if (!r) return { usd: 0, modelKnown: false };
|
|
81
|
+
const ip = r.inputPerM;
|
|
82
|
+
const op = r.outputPerM;
|
|
83
|
+
const usd =
|
|
84
|
+
((tokens.input ?? 0) * ip +
|
|
85
|
+
(tokens.output ?? 0) * op +
|
|
86
|
+
(tokens.cache_read ?? 0) * (CACHE_READ_MULT * ip) +
|
|
87
|
+
(tokens.cache_write_5m ?? 0) * (CACHE_WRITE_5M_MULT * ip) +
|
|
88
|
+
(tokens.cache_write_1h ?? 0) * (CACHE_WRITE_1H_MULT * ip)) /
|
|
89
|
+
1_000_000;
|
|
90
|
+
return { usd, modelKnown: true };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** USD value of a token rollup in integer cents (Math.round). Never throws; an unknown model yields
|
|
94
|
+
* { cents: 0, modelKnown: false }. */
|
|
95
|
+
export function usdForRollup(tokens, provider, model, date) {
|
|
96
|
+
const { usd, modelKnown } = usdForRollupRaw(tokens, provider, model, date);
|
|
97
|
+
return { cents: Math.round(usd * 100), modelKnown };
|
|
98
|
+
}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
// ai-price-index - the public API.
|
|
2
|
+
//
|
|
3
|
+
// Open, dated, first-party-sourced AI model API prices over time. This package answers "what did
|
|
4
|
+
// this model cost on this date" with the verifiable source attached, not just today's number.
|
|
5
|
+
//
|
|
6
|
+
// import { current, priceOn, models } from 'ai-price-index';
|
|
7
|
+
// current('claude-opus-4-8'); // today's input/output rate + provenance
|
|
8
|
+
// priceOn('gpt-4', '2024-01-01'); // the rate that was in effect on that date
|
|
9
|
+
//
|
|
10
|
+
// Data is bundled inline (no runtime network). Data CC BY 4.0, tooling MIT. See README for attribution.
|
|
11
|
+
import {
|
|
12
|
+
bundle,
|
|
13
|
+
resolveSeries,
|
|
14
|
+
seriesFor,
|
|
15
|
+
intervalAt,
|
|
16
|
+
rateAt,
|
|
17
|
+
usdForRollup,
|
|
18
|
+
usdForRollupRaw,
|
|
19
|
+
CACHE_READ_MULT,
|
|
20
|
+
CACHE_WRITE_5M_MULT,
|
|
21
|
+
CACHE_WRITE_1H_MULT
|
|
22
|
+
} from './engine.js';
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
bundle,
|
|
26
|
+
rateAt,
|
|
27
|
+
usdForRollup,
|
|
28
|
+
usdForRollupRaw,
|
|
29
|
+
CACHE_READ_MULT,
|
|
30
|
+
CACHE_WRITE_5M_MULT,
|
|
31
|
+
CACHE_WRITE_1H_MULT
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** Dataset metadata (version, dataModified date, license, DOI, source provenance). */
|
|
35
|
+
export const meta = {
|
|
36
|
+
schemaVersion: bundle.schemaVersion,
|
|
37
|
+
dataModified: bundle.dataModified,
|
|
38
|
+
license: bundle.license,
|
|
39
|
+
doi: bundle.doi,
|
|
40
|
+
attribution: bundle.attribution,
|
|
41
|
+
source: bundle.source
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const todayISO = () => new Date().toISOString().slice(0, 10);
|
|
45
|
+
const isISODate = (s) => typeof s === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(s);
|
|
46
|
+
|
|
47
|
+
/** Sorted list of provider slugs present in the dataset. */
|
|
48
|
+
export function providers() {
|
|
49
|
+
return [...new Set(bundle.series.map((s) => s.provider))].sort();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Every model series as { provider, model, aliases }. */
|
|
53
|
+
export function models() {
|
|
54
|
+
return bundle.series
|
|
55
|
+
.map((s) => ({ provider: s.provider, model: s.model, aliases: s.aliases ?? [] }))
|
|
56
|
+
.sort((a, b) => `${a.provider}/${a.model}`.localeCompare(`${b.provider}/${b.model}`));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** All series whose canonical id or an alias EXACTLY matches `model`, across every provider. Used to
|
|
60
|
+
* detect (and report) the rare case where the same bare id exists under more than one provider. */
|
|
61
|
+
export function candidates(model) {
|
|
62
|
+
return providers()
|
|
63
|
+
.map((p) => seriesFor(p, model))
|
|
64
|
+
.filter(Boolean);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Resolve a (possibly provider-less, possibly aliased) model id to its canonical series.
|
|
69
|
+
* - With `opts.provider`, resolves within that provider (exact/alias/[1m]/prefix tolerance).
|
|
70
|
+
* - Without a provider, prefers a unique exact/alias match across providers; throws if a bare id is
|
|
71
|
+
* ambiguous (pass `{ provider }`); falls back to tolerance only when no exact match exists anywhere.
|
|
72
|
+
* Returns { provider, model, aliases, series } or null.
|
|
73
|
+
*/
|
|
74
|
+
export function resolve(model, opts = {}) {
|
|
75
|
+
if (typeof model !== 'string' || !model.trim()) return null;
|
|
76
|
+
const wrap = (s) => ({ provider: s.provider, model: s.model, aliases: s.aliases ?? [], series: s });
|
|
77
|
+
|
|
78
|
+
if (opts.provider) {
|
|
79
|
+
const s = resolveSeries(opts.provider, model);
|
|
80
|
+
return s ? wrap(s) : null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const exact = candidates(model);
|
|
84
|
+
if (exact.length === 1) return wrap(exact[0]);
|
|
85
|
+
if (exact.length > 1) {
|
|
86
|
+
const where = exact.map((s) => `${s.provider}/${s.model}`).join(', ');
|
|
87
|
+
throw new Error(
|
|
88
|
+
`"${model}" is ambiguous across providers (${where}). Pass { provider } to disambiguate.`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// No exact match anywhere: allow per-provider tolerance ([1m] strip, prefix), first hit wins.
|
|
93
|
+
for (const p of providers()) {
|
|
94
|
+
const s = resolveSeries(p, model);
|
|
95
|
+
if (s) return wrap(s);
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function intervalView(iv) {
|
|
101
|
+
if (!iv) return null;
|
|
102
|
+
return {
|
|
103
|
+
price_usd: iv.price_usd,
|
|
104
|
+
unit: iv.unit,
|
|
105
|
+
from: iv.from,
|
|
106
|
+
to: iv.to,
|
|
107
|
+
last_validated: iv.last_validated ?? null,
|
|
108
|
+
confidence: iv.confidence ?? null,
|
|
109
|
+
source: iv.src ?? null
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The input + output rate for `model` on `date` (default today), with provenance.
|
|
115
|
+
* Returns null when the model cannot be resolved. When the model resolves but `date` predates its
|
|
116
|
+
* coverage, `covered` is false and the rate fields are null.
|
|
117
|
+
*
|
|
118
|
+
* priceOn('claude-opus-4-8') // today
|
|
119
|
+
* priceOn('gpt-4', '2024-01-01') // a past date
|
|
120
|
+
* priceOn('command-r', { provider: 'cohere' })
|
|
121
|
+
* priceOn('gpt-4', '2024-01-01', { provider: 'openai' })
|
|
122
|
+
*/
|
|
123
|
+
export function priceOn(model, date, opts) {
|
|
124
|
+
// Flexible args: (model), (model, date), (model, opts), (model, date, opts).
|
|
125
|
+
if (date && typeof date === 'object') {
|
|
126
|
+
opts = date;
|
|
127
|
+
date = undefined;
|
|
128
|
+
}
|
|
129
|
+
opts = opts ?? {};
|
|
130
|
+
const on = date ?? todayISO();
|
|
131
|
+
if (!isISODate(on)) throw new Error(`date must be YYYY-MM-DD, got "${on}"`);
|
|
132
|
+
|
|
133
|
+
const r = resolve(model, opts);
|
|
134
|
+
if (!r) return null;
|
|
135
|
+
|
|
136
|
+
const input = intervalView(intervalAt(r.series.variations.input ?? [], on));
|
|
137
|
+
const output = intervalView(intervalAt(r.series.variations.output ?? [], on));
|
|
138
|
+
return {
|
|
139
|
+
query: model,
|
|
140
|
+
provider: r.provider,
|
|
141
|
+
model: r.model,
|
|
142
|
+
aliases: r.aliases,
|
|
143
|
+
date: on,
|
|
144
|
+
covered: Boolean(input || output),
|
|
145
|
+
input,
|
|
146
|
+
output
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Today's rate for `model` (sugar for priceOn(model) with no date). */
|
|
151
|
+
export function current(model, opts) {
|
|
152
|
+
return priceOn(model, todayISO(), opts ?? {});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Convenience: per-million input/output numbers for `model` on `date`, auto-resolving the provider.
|
|
156
|
+
* Returns { provider, model, date, inputPerM, outputPerM } or null. */
|
|
157
|
+
export function rate(model, date, opts) {
|
|
158
|
+
if (date && typeof date === 'object') {
|
|
159
|
+
opts = date;
|
|
160
|
+
date = undefined;
|
|
161
|
+
}
|
|
162
|
+
const r = resolve(model, opts ?? {});
|
|
163
|
+
if (!r) return null;
|
|
164
|
+
const on = date ?? todayISO();
|
|
165
|
+
const at = rateAt(r.provider, r.model, on);
|
|
166
|
+
if (!at) return null;
|
|
167
|
+
return { provider: r.provider, model: r.model, date: on, ...at };
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export default {
|
|
171
|
+
meta,
|
|
172
|
+
bundle,
|
|
173
|
+
providers,
|
|
174
|
+
models,
|
|
175
|
+
candidates,
|
|
176
|
+
resolve,
|
|
177
|
+
priceOn,
|
|
178
|
+
current,
|
|
179
|
+
rate,
|
|
180
|
+
rateAt,
|
|
181
|
+
usdForRollup,
|
|
182
|
+
usdForRollupRaw
|
|
183
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ai-price-index",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Open, dated, first-party-sourced AI model API prices over time. Look up what any model cost on any date, with the source. Data CC BY 4.0, tooling MIT.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"author": "RoninForge (https://roninforge.org)",
|
|
8
|
+
"homepage": "https://roninforge.org/data/ai-price-index/",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/RoninForge/ai-price-index.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/RoninForge/ai-price-index/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"ai",
|
|
18
|
+
"llm",
|
|
19
|
+
"pricing",
|
|
20
|
+
"price",
|
|
21
|
+
"cost",
|
|
22
|
+
"tokens",
|
|
23
|
+
"openai",
|
|
24
|
+
"anthropic",
|
|
25
|
+
"claude",
|
|
26
|
+
"gpt",
|
|
27
|
+
"gemini",
|
|
28
|
+
"api",
|
|
29
|
+
"dataset",
|
|
30
|
+
"open-data",
|
|
31
|
+
"point-in-time"
|
|
32
|
+
],
|
|
33
|
+
"main": "./lib/index.js",
|
|
34
|
+
"types": "./index.d.ts",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./index.d.ts",
|
|
38
|
+
"import": "./lib/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./bundle": "./lib/data.json",
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
43
|
+
"bin": {
|
|
44
|
+
"ai-price-index": "bin/cli.js"
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"lib/",
|
|
48
|
+
"bin/",
|
|
49
|
+
"index.d.ts",
|
|
50
|
+
"README.md",
|
|
51
|
+
"LICENSE",
|
|
52
|
+
"DATA-LICENSE.md"
|
|
53
|
+
],
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=18"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "node tools/build-npm.mjs",
|
|
59
|
+
"validate": "node tools/validate.mjs",
|
|
60
|
+
"test": "node tools/test-npm.mjs",
|
|
61
|
+
"prepare": "node tools/build-npm.mjs"
|
|
62
|
+
}
|
|
63
|
+
}
|