Files
brain/tools/cost-pricing.test.mjs
T

37 lines
1.3 KiB
JavaScript

import { describe, it, expect } from 'vitest';
import { PRICING } from './cost-pricing.mjs';
describe('PRICING constants', () => {
it('exposes sonnet pricing per-token', () => {
// Sonnet 4.6: $3/Mtok input → 3e-6 per token
expect(PRICING.sonnet.input).toBeCloseTo(3 / 1_000_000, 12);
// Sonnet 4.6: $15/Mtok output → 15e-6 per token
expect(PRICING.sonnet.output).toBeCloseTo(15 / 1_000_000, 12);
});
it('exposes opus pricing per-token', () => {
// Opus 4.7: $15/Mtok input → 15e-6 per token
expect(PRICING.opus.input).toBeCloseTo(15 / 1_000_000, 12);
// Opus 4.7: $75/Mtok output → 75e-6 per token
expect(PRICING.opus.output).toBeCloseTo(75 / 1_000_000, 12);
});
it('opus output is 5x sonnet output (sanity check)', () => {
expect(PRICING.opus.output / PRICING.sonnet.output).toBeCloseTo(5, 6);
});
it('PRICING object is frozen', () => {
expect(Object.isFrozen(PRICING)).toBe(true);
expect(Object.isFrozen(PRICING.sonnet)).toBe(true);
expect(Object.isFrozen(PRICING.opus)).toBe(true);
});
});
describe('JUDGE_PER_CALL_USD', () => {
it('is a positive USD estimate for one per-tool judge call', async () => {
const { JUDGE_PER_CALL_USD } = await import('./cost-pricing.mjs');
expect(typeof JUDGE_PER_CALL_USD).toBe('number');
expect(JUDGE_PER_CALL_USD).toBeGreaterThan(0);
});
});