Use JSON Schema for Structured Summarization: A Node.js GPT Endpoint for Media Archives A developer has described a Node.js pattern for summarizing media-archive transcripts with a GPT-compatible endpoint, enforcing a JSON Schema contract at the model boundary and then validating meaning in application code. The approach separates structural failures, where output cannot be consumed safely, from semantic failures, where output is consumable but untrustworthy, and adds idempotency keys to prevent duplicate work on retries. The developer notes that JSON Schema checks shape rather than evidence, so provenance fields and cheap invariants such as matching sourceId are needed before persistence. A media archive has a stricter constraint than ordinary summarization: the result must help a person and remain valid enough for the next system to trust. I use a JSON Schema contract at the model boundary, then validate meaning in application code. The model produces a candidate. The runtime decides whether it is acceptable. The before-and-after model is small: Keep the boundary boring. No guesswork. That separation matters for a private media knowledge base. A missing topics array is easy to detect. A confident summary that mixes two broadcasts is much harder, so the contract needs provenance fields and observable rejection reasons. Start with fields that support a real archive workflow. For one transcript, I want a concise abstract, a bounded list of key points, the source identifier, and an uncertainty signal. The schema below is deliberately boring. Boring contracts are easy to test. js const summarySchema = { type: "object", additionalProperties: false, required: "sourceId", "abstract", "keyPoints", "confidence" , properties: { sourceId: { type: "string", minLength: 1 }, abstract: { type: "string", minLength: 40, maxLength: 800 }, keyPoints: { type: "array", minItems: 2, maxItems: 6, items: { type: "string", minLength: 10, maxLength: 240 } }, confidence: { enum: "high", "medium", "low" } } }; This is a shape contract, not a truth detector. sourceId can still be wrong. An abstract can still claim that a guest said something that appears nowhere in the transcript. Keep that distinction visible in the design and in the metrics. Because JSON Schema checks structure, not evidence. A structural failure means the response cannot be consumed safely. A semantic failure means it can be consumed, but should not be trusted. Mixing them creates noisy alerts and encourages someone to disable useful ones. Here is a compact Node.js boundary using a generic GPT-compatible endpoint. The endpoint name is configuration. The validation policy belongs to your application. type Summary = { sourceId: string; abstract: string; keyPoints: string ; confidence: "high" | "medium" | "low"; }; type ModelResponse = { output text?: string }; async function summarizeTranscript transcript: string, sourceId: string, endpoint: string, apiKey: string : Promise