news-api-integration
What it does
This skill explains how the AI agent can call news APIs to get headlines and search results. It is for developers building news feeds or tools that show current stories.
When to use it
- ✓When you want a headline feed shown in an app or dashboard.
- ✓When you need to search news by a topic or keyword.
- ✓When you want news filtered by category such as technology or business.
Skill link
https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/news-api-integration/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Add a technology headlines feed to my dashboard, using a news API, and let me search for a topic.”
5 new skills a week. 1 minute to read.
How it works
The agent calls the news API with a key and a category or search term, then reads the returned articles. The skill describes GNews as the recommended option for its free tier, with NewsAPI as another choice.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
News API Integration
Multiple news APIs available. GNews is recommended for free tier usability.
Recommended: GNews
- Docs: https://gnews.io/docs/v4
- Base URL:
https://gnews.io/api/v4 - Auth: Query param
token=API_KEY - Free tier: 100 requests/day, 10 articles per request
- CORS: Yes
Top Headlines
GET /top-headlines?category=general&lang=en&max=10&token=API_KEY
Categories: general, world, nation, business, technology, entertainment, sports, science, health
Search
GET /search?q=artificial+intelligence&lang=en&max=10&token=API_KEY
Response Shape
{
"totalArticles": 1234,
"articles": [
{
"title": "Article Title",
"description": "Short description...",
"content": "Full article content (truncated)...",
"url": "https://example.com/article",
"image": "https://example.com/image.jpg",
"publishedAt": "2024-01-15T12:00:00Z",
"source": {
"name": "CNN",
"url": "https://cnn.com"
}
}
]
}
Alternative: NewsAPI.org
- Docs: https://newsapi.org/docs
- Free tier: 100 requests/day, for development only
- Note: Free plan does NOT support production use (requires paid plan for CORS from browser)
GET /v2/top-headlines?country=us&apiKey=API_KEY
GET /v2/everything?q=bitcoin&apiKey=API_KEY
Other Alternatives (from public-apis)
| API | Free Tier | Best For |
|---|---|---|
| GNews | 100 req/day | General news, good free tier |
| Currents API | 600 req/day | Real-time news, good rate |
| NewsData.io | 200 req/day | News + crypto news |
| The Guardian | Unlimited (rate limited) | UK/international news |
| New York Times | 500 req/day | US news, archives |
| Mediastack | 500 req/month | Multi-source aggregation |
| TheNews API | 100 req/day | Simple aggregation |
| MarketAux | 100 req/day | Financial news with sentiment |
| HackerNews | No limit | Tech/startup news (no key needed) |
Frontend Service Implementation
// src/services/news.ts
import { createCircuitBreaker } from '@/utils/circuit-breaker';
export interface NewsArticle {
title: string;
description: string;
url: string;
source: string;
publishedAt: string;
image?: string;
}
const newsBreaker = createCircuitBreaker<NewsArticle[]>({
name: 'News',
cacheTtlMs: 5 * 60_000, // 5 minutes
});
export async function fetchNews(category = 'general'): Promise<NewsArticle[]> {
return newsBreaker.execute(async () => {
const resp = await fetch(`/api/news?category=${category}`);
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
const data = await resp.json();
return data.articles || [];
}, []);
}
export async function searchNews(query: string): Promise<NewsArticle[]> {
const resp = await fetch(`/api/news?q=${encodeURIComponent(query)}`);
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
const data = await resp.json();
return data.articles || [];
}
HackerNews (No API Key Needed)
For tech news, HackerNews API is free and unlimited:
// Fetch top 30 stories
const topIds = await fetch('https://hacker-news.firebaseio.com/v0/topstories.json').then(r => r.json());
const stories = await Promise.all(
topIds.slice(0, 30).map((id: number) =>
fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`).then(r => r.json())
)
);
// Each story: { title, url, score, by, time, descendants }
Panel Rendering Pattern
private render(articles: NewsArticle[]): void {
const rows = articles.map(a => `
<div class="news-item">
<a href="${a.url}" target="_blank" rel="noopener" class="news-title">${escapeHtml(a.title)}</a>
<div class="news-meta">
<span class="news-source">${escapeHtml(a.source)}</span>
<span class="news-time">${formatTime(new Date(a.publishedAt))}</span>
</div>
</div>
`).join('');
this.setContent(`<div class="news-list">${rows}</div>`);
}
Always escape user-controlled strings with escapeHtml() to prevent XSS.
FAQ
Which news API is recommended?
The skill recommends GNews for its free-tier usability and notes it supports browser CORS.
Is NewsAPI free for production?
No, the skill says its free plan is for development only and does not support production use from the browser.
What categories are available?
The skill lists categories such as general, business, technology, sports, science and health.
Details
Original description by the author
Integrate with news APIs (GNews, NewsAPI, etc.) for aggregated news feeds. Covers headline fetching, search, and category filtering.
repo: HKUDS/AgentPilot
Popularity
- GitHub stars
- 7.8k
- Ranking position
- #13061
- License
- MIT
- Updated
- 11/1/2026
Comments
- …
More skills from this repository
agentpilot
7.8kHelps your agent improve a project step by step by preparing a task and running the AgentPilot loop that proposes, tests and scores changes.
openspace
7.8kHelps your agent set up OpenSpace, a tool that stores and fetches agent skills, and connect it to your AI app through MCP.
rsi-arena
7.8kHelps your agent set up and run standard AI benchmark tests, such as AIME and Terminal-Bench, to compare different improvement methods.
experiment-guide
7.8kHelps your agent plan small experiments, read their results and record findings while it investigates how to improve a program.
Similar skills
api-connector-builder
280kHas your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
api-design
280kHelps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
backend-patterns
280kHelps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.