A small command-line tool that reads text from a file or stdin, sends it to Anthropic's Claude Haiku, and prints a clean 2-3 sentence summary plus five category tags.
Standard-library Python only — no external dependencies to install. Works the moment you have your API key set.
- Reads input from a file argument OR from stdin (pipeable, chainable with other tools).
- Sends the text to Anthropic's Messages API using
claude-haiku-4-5— fast, cheap, and accurate enough for summarization. - Enforces a strict JSON response shape via system prompt:
{summary, tags[]}. - Strips accidental markdown fences from the model's response before parsing.
- Prints the summary and tags to stdout, formatted for a terminal.
Uses urllib from the standard library — no requests, no pip install anthropic. If your Python runs, this script runs.
Export your Anthropic API key:
export ANTHROPIC_API_KEY="sk-ant-..."Three ways to feed it text:
python summarize.py article.txt
cat article.txt | python summarize.py
echo "Some text to summarize." | python summarize.pySample output:
Summarizing 1,547 characters with claude-haiku-4-5-20251001 ...
Summary
────────────────────────────────────────────────────────────
The article argues that <point one>. <Point two connecting to
main claim>. <Practical takeaway>.
Tags
────────────────────────────────────────────────────────────
technology · policy · startups · automation · labor
A sample article (sample-article.txt) is included so you can try the tool without hunting for text to summarize.
- AI-Summarizer-Deliverable.pdf — one-pager describing scope, approach, and result.
- screenshots/ — captures of the tool running end-to-end.
I build AI-agent and automation systems — Claude Code / MCP integrations, LLM-into-workflow tooling, scrapers, and scripts that kill repetitive work. If you need an AI-powered tool wired into your real systems, that's the work I do.
- Upwork: its_weli on Upwork
- Contact: hello@weli.build
MIT — use it, fork it, ship it.