Eskillsfy

Home / Blog / AI tools

AI tools · 23 Nov 2026

AI Text Summarizer: how it works and how to build one

Turn long text into key points, a paragraph or one sentence. This guide explains what happens behind the button and shows the code, so you can build your own.

What it does

Paste an article, report, meeting notes or a long email and get a short summary that only uses facts from the text. Choose bullet points, one paragraph or a single sentence.

When to use it

  • Meeting notes and long emails
  • Research papers and reports
  • News articles before you read them in full
  • Customer feedback

How to use it

  1. Log in.
  2. Paste the text (up to 8,000 characters) and pick a length.
  3. Click Generate and copy the summary.

Try it free with an Eskillsfy account: https://eskillsfy.com/tools/ai-summarizer

How it works

The summarizer asks a language model to compress the text into bullet points, a paragraph or one sentence, using only facts from the text. Telling the model ‘use only facts from the text’ reduces made-up details, which is the main risk with AI summaries.

Input is capped at 8,000 characters. Longer documents are usually split into chunks, each chunk is summarized, and then the summaries are summarized again (map-reduce).

Build it yourself

Here is the core of the tool. It has no dependencies unless noted, so you can paste it into any Node.js project.

server/routes/ai-summarizer.js (js)

// Express route. The prompt stays on the server, so the endpoint can only do this one job.
import { Router } from "express";
const router = Router();

const SYSTEM = (option) => `Summarize the user's text as ${option}. Use only facts from the text. Reply with the summary only.`;

router.post("/ai-summarizer", requireUser, async (req, res) => {
  const input = String(req.body.input ?? "").trim();
  if (!input || input.length > 8000) return res.status(400).json({ error: "Send 1 to 8,000 characters." });
  const option = ALLOWED.includes(req.body.option) ? req.body.option : ALLOWED[0];

  // Any chat model works here: Gemini on Vertex AI, the Claude API, etc.
  const r = await fetch("https://api.anthropic.com/v1/messages", {
    method: "POST",
    headers: { "x-api-key": process.env.ANTHROPIC_API_KEY, "anthropic-version": "2023-06-01", "content-type": "application/json" },
    body: JSON.stringify({ model: process.env.AI_MODEL, max_tokens: 2048, system: SYSTEM(option), messages: [{ role: "user", content: input }] }),
  });
  if (!r.ok) return res.status(502).json({ error: "The AI service did not answer." });
  const data = await r.json();
  res.json({ output: data.content.map((b) => b.text ?? "").join("").trim() });
});

export default router;

Make it production-ready

  • Put the API key in a secret manager and read it from an environment variable, never in frontend code.
  • Require a login and add a per-user daily limit so one person can’t run up your bill.
  • Validate the option against a fixed list so users can’t inject their own instructions.
  • Show a loading state and a clear error when the provider is slow or down.
  • For very long documents, split into chunks of a few thousand characters, summarize each, then summarize the summaries.

Questions

Can it summarize a web page?

Copy the page text and paste it in. The tool does not fetch links.

Try the AI Text Summarizer

Free with an Eskillsfy account.

Open it
Keep reading

More in AI tools

All posts