Sign in

SDKs

Official client libraries for TypeScript, Python, and Go. Available for both the REST API and the Realtime WebSocket API.

REST SDKs

The REST SDKs wrap the NewsRank HTTP API with typed methods, automatic pagination, and built-in retries. Install the package for your language and start fetching articles, stories, entities, and more.

Install

bash
npm install @newsrank/sdk

Quick Start

Fetch the 5 most recent stories with a single method call:

typescript
import { NewsRank } from '@newsrank/sdk';

const nr = new NewsRank('nrf_your_api_key');
const stories = await nr.stories.list({ limit: 5 });
console.log(stories);
Package Registries

npm

@newsrank/sdk

PyPI

newsrank

Go Module

github.com/newsrank-ai/newsrank-go

Realtime SDKs

New

The Realtime SDKs connect to the NewsRank WebSocket API and provide typed event handlers, automatic reconnection with exponential backoff, and subscription management. Receive new articles, story developments, and ranking changes the moment they happen.

Install

bash
npm install @newsrank/realtime

Quick Start

Connect to the WebSocket, subscribe to politics articles, and log new items:

typescript
import { NewsRankRealtime } from '@newsrank/realtime';

const rt = new NewsRankRealtime('nrf_your_api_key');
await rt.connect();
rt.subscribe({ categories: ['politics'], topics: ['articles'] });
rt.on('item.new', (e) => console.log(e.data.title));
Package Registries

npm

@newsrank/realtime

PyPI

newsrank-realtime

Go Module

github.com/newsrank-ai/newsrank-go/realtime

SDK Features

All three language SDKs share the same feature set across both REST and Realtime packages.

FeatureTypeScriptPythonGo
Typed responses
Auto-pagination
Automatic retries
Auto-reconnect (Realtime)
Typed events (Realtime)
Subscription filters
Exponential backoff
Connection health monitoring

What's Next