import assert from 'node:assert/strict'; import test from 'node:test'; import { loadPiggyConfig } from '../src/config'; const minimum = { DATABASE_URL: 'postgres://pig:pig@localhost:54330/pig', PIGGY_INFERENCE_API_KEY: 'test-key', PIGGY_INTERNAL_TOKEN: 'test-internal-token-for-piggy-000000', }; test('the chat budget is separate from the worker budget, and larger', () => { const config = loadPiggyConfig(minimum); // The worker extracts; the chat has to quote aggregates back. Sharing one // budget meant tuning either one moved both. assert.equal(config.PIGGY_MAX_TOKENS, 1_024); assert.equal(config.PIGGY_CHAT_MAX_TOKENS, 2_048); assert.equal(config.PIGGY_MAX_TURNS, 4); }); test('reasoning stays off by default', () => { // Reasoning tokens are billed like any other and nemotron-nano's are // verbose. The knob exists for debugging, not for the default deployment. assert.equal(loadPiggyConfig(minimum).PIGGY_REASONING_EFFORT, 'none'); assert.equal( loadPiggyConfig({ ...minimum, PIGGY_REASONING_EFFORT: 'low' }).PIGGY_REASONING_EFFORT, 'low', ); assert.throws( () => loadPiggyConfig({ ...minimum, PIGGY_REASONING_EFFORT: 'maximum' }), /PIGGY_REASONING_EFFORT/, ); }); test('the default token prices are the published price of the default model', () => { const config = loadPiggyConfig(minimum); // $0.05/$0.20 per million tokens, carried as cents per million so that // tokens x price is already micro-cents. assert.equal(config.PIGGY_PRICE_INPUT_CENTS_PER_MTOK, 5); assert.equal(config.PIGGY_PRICE_OUTPUT_CENTS_PER_MTOK, 20); assert.equal(config.PIGGY_MODEL, 'nvidia/nemotron-3-nano-30b-a3b'); });