A daily AI news brief is a Python script that collects headlines from free sources, synthesizes them through an LLM, and delivers a readable summary to your phone or inbox every morning. You can build the entire pipeline in 325 lines, host it on a $5 VPS, and keep API costs under $0.15 per month. This guide walks through every step.
Most tutorials on this topic either require a paid news API or skip cost analysis entirely. We ran this exact pipeline at AI Masterminds for three months before publishing. The economics hold up. Here is how the three stages work and how to ship them yourself.
What does the Collect, Synthesize, Deliver architecture look like?
The pipeline has three discrete stages, each handled by a single Python module. Collect pulls raw headlines and URLs from public APIs. Synthesize passes those headlines through an LLM with a carefully tuned prompt. Deliver formats the output and pushes it to Telegram, email, or both.
The original 325-line implementation on DEV Community puts it well: "The prompt is the actual product. It took ~20 iterations to get right." That matches our experience. The collection and delivery code is straightforward. The synthesis prompt is where you will spend your iteration cycles. Each stage is a plain function that returns a data structure to the next, so you can test and swap any piece independently.
If you want to understand how the summarization step works under the hood, our explainer on what an LLM is and how it actually works covers the foundations. For this tutorial, you just need to know that you are sending text in and getting a shorter, structured summary back.
How do you collect headlines from free sources?
The two best free, unauthenticated sources for AI news are the Hacker News Firebase API and the arXiv API. The Hacker News API provides near-real-time access to every story, comment, and ranking on the site. No API key needed. You fetch /v0/topstories.json, take the top 30 IDs, then fetch each item's title and URL.
The arXiv API offers public access for querying preprints by category. A simple query like cat:cs.AI sorted by submittedDate gives you the latest AI research papers with titles and abstracts. Both APIs return JSON (Hacker News) or Atom XML (arXiv), both parseable with Python's standard library.
Here is the core collection pattern:
import urllib.request, json
def collect_hn(limit=30):
top = json.loads(urllib.request.urlopen(
"https://hacker-news.firebaseio.com/v0/topstories.json"
).read())
stories = []
for sid in top[:limit]:
item = json.loads(urllib.request.urlopen(
f"https://hacker-news.firebaseio.com/v0/item/{sid}.json"
).read())
stories.append({"title": item.get("title", ""), "url": item.get("url", "")})
return stories
No requests, no feedparser, no dependencies. The arXiv collector follows the same shape but parses XML with xml.etree.ElementTree. You combine both into a single list of {title, url, source} dicts and pass it to the synthesize step.
How does the LLM synthesize raw headlines into a useful brief?
This is where most of the value lives. You take 30 to 50 raw headlines and ask an LLM to group them by theme, drop duplicates, summarize each cluster in two to three sentences, and rank by relevance. OpenRouter gives you a unified API endpoint that routes to hundreds of models, so you can start with Claude Haiku 4.5 for cost efficiency and swap to a larger model later if needed.
The prompt structure that worked best after our 20-plus iterations:
SYSTEM_PROMPT = """You are a concise tech news editor. Given a list of
headlines and URLs, produce a daily brief with 5-7 themed sections. Each
section: a bold theme title, 2-3 sentence summary, and source links.
Drop duplicates. Prioritize: AI research, developer tools, industry moves.
Output markdown."""
A single call with ~2,000 input tokens and ~800 output tokens costs roughly $0.005 on Haiku. Over 30 days, that is $0.15. The API call itself uses urllib.request with a POST to https://openrouter.ai/api/v1/chat/completions. Set a timeout of 30 seconds and a max_tokens cap of 1,000 to keep costs predictable.
If you are building other ChatGPT workflows that save hours every week, the same prompt-iteration discipline applies. Start with a simple instruction, read the output, tighten the prompt, repeat. Document each version in a comment block above the prompt string so you can roll back.
How do you deliver the brief to Telegram or email?
For delivery, Telegram is the lowest-friction option. The Telegram Bot API is HTTP-based and needs only a bot token and a chat ID. Create a bot via @BotFather, save the token, send yourself a message, and grab the chat ID from the getUpdates endpoint. Then it is one POST request:
def deliver_telegram(text, bot_token, chat_id):
payload = json.dumps({"chat_id": chat_id, "text": text, "parse_mode": "Markdown"})
req = urllib.request.Request(
f"https://api.telegram.org/bot{bot_token}/sendMessage",
data=payload.encode(), headers={"Content-Type": "application/json"}
)
urllib.request.urlopen(req)
For email delivery, Python's smtplib with a free Gmail app password works fine. But Telegram wins on read rates. Our brief gets opened within 10 minutes of delivery on Telegram versus hours for email.
The how to build an AI inbox triage guide covers the email automation side in more depth. If you want both channels, call both delivery functions at the end of your main(). Total delivery code: about 40 lines.
Common pitfalls when building your first news brief
Pitfall 1: Fetching too many stories sequentially. Hitting the Hacker News API 30 times in series takes 10 to 15 seconds. Use concurrent.futures.ThreadPoolExecutor to parallelize fetches. This drops collection time to under 2 seconds.
Pitfall 2: No error handling on source failures. If arXiv is slow or Hacker News returns a 503, your entire brief fails. Wrap each collector in a try/except with a 10-second timeout. If a source fails, skip it and add a note to the brief: "arXiv unavailable today." Partial data beats no data.
Pitfall 3: Prompt drift. After your brief runs for a few weeks, you will want to tweak the prompt. Keep every prompt version in your repo with a date comment. When a new version produces worse output, you can revert in seconds. Version control your prompts the way you version control code.
Pitfall 4: Not filtering AI-relevant stories from Hacker News. The top 30 stories include plenty of non-AI content. Add a keyword pre-filter (check titles for "AI", "LLM", "GPT", "Claude", "model", "neural", "transformer") before sending to the LLM. This keeps your input tokens low and your brief focused.
Readers who are evaluating tools to help write this kind of automation faster should check our review of the best AI coding agents in 2026. A good copilot can cut the build time from an afternoon to under an hour.
Putting it all together
Your main.py calls three functions in sequence: collect(), synthesize(), deliver(). Schedule it with cron. The entire project is one file, zero dependencies beyond Python 3.10+, and costs less than a cup of coffee per year to run.
The 325-line constraint is real and intentional. Every line over that limit means you are adding complexity you will have to maintain. Keep it tight, keep it running, and iterate on the prompt.
If you are building automations like this and want to share what is working, join AI Masterminds. We share pipeline configs, prompt versions, and cost benchmarks across the community.
FAQ
How much does it cost to run a daily AI news brief with Python?
The infrastructure cost is roughly $0.15 per month for LLM API calls if you use OpenRouter with a lightweight model like Haiku. The VPS itself costs around $5 per month. All data sources in this guide (Hacker News Firebase API and arXiv feeds) are free and require no API keys. Total running cost sits well under $6 per month for a fully automated daily digest.
Which LLM should I use for summarizing news articles?
For a daily brief, you want speed and low cost over raw reasoning power. Claude Haiku 4.5 or GPT-4o-mini through OpenRouter are strong choices. Both handle summarization well at fractions of a cent per call. OpenRouter gives you a single endpoint to swap models without rewriting code. Start with the cheapest model that produces coherent summaries, then upgrade only if quality drops on technical content.
Can I use sources other than Hacker News and arXiv?
Yes. Any source with an RSS feed or public API works with the same Collect step. TechCrunch, The Verge, and MIT Technology Review all publish RSS feeds. You can also add subreddit RSS feeds (append .rss to any subreddit URL). The architecture is source-agnostic. Just write a new collector function that returns the same headline-plus-URL format and plug it into the pipeline.
How do I schedule the script to run every morning?
On a Linux VPS, use a cron job. Run crontab -e and add a line like 0 7 * * * /usr/bin/python3 /home/user/news-brief/main.py to execute at 7 AM daily. For macOS, launchd works similarly. If you prefer a managed option, GitHub Actions offers scheduled workflows with cron syntax, and the free tier gives you enough minutes for one daily run.
What happens if the Hacker News API or arXiv is down when my script runs?
Build in simple retry logic with a timeout. If a source fails after two retries, skip it and note the gap in the output. Your brief still delivers with partial data rather than failing silently. Log the failure so you can check it later. This resilience matters more than perfection for a daily automation that runs unattended.
Sources
- Hacker News API (Firebase) · GitHub / Y Combinator
- arXiv API Access · arXiv.org (Cornell University)
- Telegram Bot API · Telegram (official docs)
- OpenRouter Quickstart · OpenRouter (official docs)
- Building a Daily AI News Brief in 325 Lines of Python · DEV Community

