mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-28 19:04:07 +01:00
fix(pricing): Sonnet 5.5, Gemini 3.x and gbrain embedding rows from fetched pages; Opus 4.7 at its current list price
Each new row carries its source URL and fetch date (2026-10-12). Embedding models bill input only, so they live in EMBEDDING_PRICING beside PRICING (eval arms never resolve to them); pricingRow also accepts gbrain's provider:model ids (voyage:voyage-4). claude-opus-4-7 moves from 15/75 to the 5/25 the Anthropic pricing page lists; benchmark-runner's expected costs follow. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
1898142986
commit
6590cbb35b
3 files changed
+59
-11
No files matched your search
@@ -23,10 +23,10 @@ test('estimateCostUsd returns 0 for unknown model (no crash)', () => {
|
||||
});
|
||||
|
||||
test('estimateCostUsd computes correctly for known Claude model', () => {
|
||||
// claude-opus-4-7: $15/MTok input, $75/MTok output
|
||||
// 1M input + 0.5M output = $15 + $37.50 = $52.50
|
||||
// claude-opus-4-7: $5/MTok input, $25/MTok output (platform.claude.com pricing, fetched 2026-10-12)
|
||||
// 1M input + 0.5M output = $5 + $12.50 = $17.50
|
||||
const cost = estimateCostUsd({ input: 1_000_000, output: 500_000 }, 'claude-opus-4-7');
|
||||
expect(cost).toBeCloseTo(52.50, 2);
|
||||
expect(cost).toBeCloseTo(17.50, 2);
|
||||
});
|
||||
|
||||
for (const model of [CLAUDE_FRONTIER_EVAL_MODEL, CODEX_FRONTIER_MODEL]) {
|
||||
@@ -48,12 +48,12 @@ test('Astra cache reads use its standard cached-input rate', () => {
|
||||
|
||||
test('estimateCostUsd applies cached input discount alongside uncached input', () => {
|
||||
// tokens.input is uncached-only; tokens.cached is disjoint cache-reads at 10%.
|
||||
// 0 uncached input, 1M cached → 10% of 15 = $1.50
|
||||
// 0 uncached input, 1M cached → 10% of 5 = $0.50
|
||||
const cost1 = estimateCostUsd({ input: 0, output: 0, cached: 1_000_000 }, 'claude-opus-4-7');
|
||||
expect(cost1).toBeCloseTo(1.50, 2);
|
||||
// 500K uncached input + 500K cached → $7.50 + $0.75 = $8.25
|
||||
expect(cost1).toBeCloseTo(0.50, 2);
|
||||
// 500K uncached input + 500K cached → $2.50 + $0.25 = $2.75
|
||||
const cost2 = estimateCostUsd({ input: 500_000, output: 0, cached: 500_000 }, 'claude-opus-4-7');
|
||||
expect(cost2).toBeCloseTo(8.25, 2);
|
||||
expect(cost2).toBeCloseTo(2.75, 2);
|
||||
});
|
||||
|
||||
test('PRICING table covers the key model families', () => {
|
||||
|
||||
@@ -156,3 +156,15 @@ describe('priced pilot', () => {
|
||||
expect(r.projection.verdict).toBe('unknown');
|
||||
});
|
||||
});
|
||||
|
||||
describe('pricing rows with fetched sources (2026-10-12)', () => {
|
||||
test('the newest Sonnet, the newest Gemini Flash and gbrain embedding models are priced; Opus 4.7 is at its current list price', () => {
|
||||
expect(hasPricing('anthropic/claude-sonnet-5-5')).toBe(true);
|
||||
expect(estimateCostUsd({ input: 1_000_000, output: 1_000_000 }, 'claude-sonnet-5-5')).toBe(12);
|
||||
expect(estimateCostUsd({ input: 1_000_000, output: 1_000_000 }, 'claude-opus-4-7')).toBe(30);
|
||||
expect(hasPricing('google/gemini-3.8-flash')).toBe(true);
|
||||
for (const m of ['voyage:voyage-4', 'openai:text-embedding-3-large', 'text-embedding-3-small', 'gemini-embedding-2']) expect(hasPricing(m)).toBe(true);
|
||||
expect(estimateCostUsd({ input: 1_000_000, output: 0 }, 'voyage:voyage-4')).toBe(0.06);
|
||||
expect(hasPricing('voyage-4-nano')).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user