Short answer: build the Node.js text summarization API around chat completions, count tokens before sending a long article or invoice, summarize bounded chunks into the same JSON shape, and combine those results in one final pass.

For supplier invoices, optimize for correct, reviewable fields first. Then put a latency budget around the pipeline. A fast answer that silently changes an invoice number is worse than a slower answer that exposes the source fragments behind its summary.

Make invoice extraction quality observable

The useful before-and-after model is small. Before: one large invoice enters one opaque prompt, crosses an unknown context boundary, and produces prose that downstream code has to scrape. After: a token-count gate admits a small invoice directly or divides a long one into bounded pieces; every chat completion returns the same JSON keys; a final completion combines chunk summaries rather than rereading the full source.

Keep it boring.