feat(stats): add claude-fable-5 to PRICE_TABLE
This commit is contained in:
parent
22058459f8
commit
0799d6e914
2 changed files with 18 additions and 1 deletions
|
|
@ -27,6 +27,7 @@ import { join, dirname } from 'node:path';
|
||||||
// Per-Mtok USD prices, resolved 2026-06-26 via the claude-api skill reference:
|
// Per-Mtok USD prices, resolved 2026-06-26 via the claude-api skill reference:
|
||||||
// base input/output from the model table; cache rates from the prompt-caching
|
// base input/output from the model table; cache rates from the prompt-caching
|
||||||
// doc multipliers (cache_read 0.1x, write_5m 1.25x, write_1h 2.0x of input).
|
// doc multipliers (cache_read 0.1x, write_5m 1.25x, write_1h 2.0x of input).
|
||||||
|
// claude-fable-5 resolved 2026-07-02 from the official platform pricing docs.
|
||||||
export const PRICE_TABLE = Object.freeze({
|
export const PRICE_TABLE = Object.freeze({
|
||||||
'claude-opus-4-8': Object.freeze({
|
'claude-opus-4-8': Object.freeze({
|
||||||
input: 5.0,
|
input: 5.0,
|
||||||
|
|
@ -35,10 +36,17 @@ export const PRICE_TABLE = Object.freeze({
|
||||||
cache_write_5m: 6.25,
|
cache_write_5m: 6.25,
|
||||||
cache_write_1h: 10.0,
|
cache_write_1h: 10.0,
|
||||||
}),
|
}),
|
||||||
|
'claude-fable-5': Object.freeze({
|
||||||
|
input: 10.0,
|
||||||
|
output: 50.0,
|
||||||
|
cache_read: 1.0,
|
||||||
|
cache_write_5m: 12.5,
|
||||||
|
cache_write_1h: 20.0,
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Date the PRICE_TABLE values were resolved/verified. Bump when prices change.
|
// Date the PRICE_TABLE values were resolved/verified. Bump when prices change.
|
||||||
export const PRICE_TABLE_VERSION = '2026-06-26';
|
export const PRICE_TABLE_VERSION = '2026-07-02';
|
||||||
|
|
||||||
function num(v) {
|
function num(v) {
|
||||||
return typeof v === 'number' && Number.isFinite(v) ? v : 0;
|
return typeof v === 'number' && Number.isFinite(v) ? v : 0;
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,15 @@ test('deriveCost — hand-computed value for a known model (cache-aware)', () =>
|
||||||
assert.equal(is_estimate, false);
|
assert.equal(is_estimate, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('deriveCost — hand-computed value for claude-fable-5 (v5.9 fable tier)', () => {
|
||||||
|
const totals = { tokens_input: 3000, tokens_output: 500, tokens_cache_creation: 1000, tokens_cache_read: 6000 };
|
||||||
|
const { cost_usd, is_estimate } = deriveCost(totals, 'claude-fable-5');
|
||||||
|
// (3000×10 + 500×50 + 1000×12.5 + 6000×1) / 1e6
|
||||||
|
// = (30000 + 25000 + 12500 + 6000) / 1e6 = 73500 / 1e6 = 0.0735
|
||||||
|
assert.equal(cost_usd, 0.0735);
|
||||||
|
assert.equal(is_estimate, false);
|
||||||
|
});
|
||||||
|
|
||||||
test('deriveCost — refuse-to-estimate for an unknown model', () => {
|
test('deriveCost — refuse-to-estimate for an unknown model', () => {
|
||||||
const totals = { tokens_input: 3000, tokens_output: 500, tokens_cache_creation: 1000, tokens_cache_read: 6000 };
|
const totals = { tokens_input: 3000, tokens_output: 500, tokens_cache_creation: 1000, tokens_cache_read: 6000 };
|
||||||
const out = deriveCost(totals, 'claude-unknown-9');
|
const out = deriveCost(totals, 'claude-unknown-9');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue