diff --git a/tools/router-classifier.mjs b/tools/router-classifier.mjs index 4e7343d..f2e0874 100644 --- a/tools/router-classifier.mjs +++ b/tools/router-classifier.mjs @@ -501,14 +501,14 @@ export async function callAnthropicAPI(promptOrMessages, { if (typeof promptOrMessages === 'string') { body = JSON.stringify({ model, - max_tokens: 66000, + max_tokens: 65536, messages: [{ role: 'user', content: promptOrMessages }], }); } else { const { system, user } = promptOrMessages; body = JSON.stringify({ model, - max_tokens: 66000, + max_tokens: 65536, system: [{ type: 'text', text: system, cache_control: { type: 'ephemeral' } }], messages: [{ role: 'user', content: user }], }); diff --git a/tools/router-classifier.test.mjs b/tools/router-classifier.test.mjs index 1f034c9..4f90ffa 100644 --- a/tools/router-classifier.test.mjs +++ b/tools/router-classifier.test.mjs @@ -608,24 +608,24 @@ describe('PAMYATKA extensions (Phase 3 brain-retro #9)', () => { // plus max_tokens 1500 too low for future long skill chains (silent truncation). describe('callAnthropicAPI — max_tokens budget for long chains', () => { - it('sends max_tokens 66000 for the structured {system,user} form', async () => { + it('sends max_tokens 65536 for the structured {system,user} form', async () => { let body; const fetchImpl = async (url, opts) => { body = JSON.parse(opts.body); return { ok: true, json: async () => ({ content: [{ text: '{"task_type":"question"}' }] }) }; }; await callAnthropicAPI({ system: 'S', user: 'U' }, { apiKey: 'k', fetchImpl }); - expect(body.max_tokens).toBe(66000); + expect(body.max_tokens).toBe(65536); }); - it('sends max_tokens 66000 for the legacy string form', async () => { + it('sends max_tokens 65536 for the legacy string form', async () => { let body; const fetchImpl = async (url, opts) => { body = JSON.parse(opts.body); return { ok: true, json: async () => ({ content: [{ text: '{"task_type":"question"}' }] }) }; }; await callAnthropicAPI('hi', { apiKey: 'k', fetchImpl }); - expect(body.max_tokens).toBe(66000); + expect(body.max_tokens).toBe(65536); }); });