Skip to main content
The NewsService provides AI-powered article summarization with support for multiple LLM providers (Ollama, Groq, OpenRouter) and automatic fallback chains.

Base Path

SummarizeArticle

Generates an LLM summary of news headlines with provider selection and fallback support. Endpoint: POST /api/news/v1/summarize-article

Request Body

string
required
LLM provider: "ollama", "groq", or "openrouter"
string[]
required
Headlines to summarize (max 8 used)
string
Summarization mode: "brief", "analysis", "translate", or empty string for default
string
Geographic signal context to include in the prompt
string
Variant: "full", "tech", or target language for translate mode
string
Output language code (default: "en")

Response

string
The generated summary text
string
Model identifier used for generation
string
Provider that produced the result (or “cache” if from Redis)
bool
Whether the result came from Redis cache
int32
Token count from the LLM response
bool
Whether the client should try the next provider in the fallback chain
bool
Whether this provider was skipped (credentials missing)
string
Human-readable skip/error reason
string
Error message if the request failed
string
Error type/name (e.g., “TypeError”)

Example Request: Brief Summary

Example Response

Example Request: Analysis Mode

Example Response

Example Request: Translation Mode

Example Response

Summarization Modes

Brief Mode

Generates concise 2-3 sentence summaries ideal for quick updates and notifications.

Analysis Mode

Produces detailed analytical summaries with context, implications, and strategic assessments. Best for intelligence briefs and deeper understanding.

Translate Mode

Translates headlines from source language to target language specified in the variant field.

Default Mode

Balanced summarization suitable for general news aggregation.

Provider Fallback

The service supports automatic fallback between providers:
  1. Ollama: Local LLM deployment (fastest, no API costs)
  2. Groq: High-performance cloud inference (fast, low cost)
  3. OpenRouter: Access to premium models like Claude (highest quality)
When a provider is unavailable or returns an error, the fallback field will be true, signaling the client to retry with the next provider in the chain.

Caching

Summaries are cached in Redis based on a hash of the request parameters. Cached responses return immediately with cached: true and provider: "cache". Cache TTL is typically 1 hour for brief summaries and 4 hours for analysis mode.

Error Handling

If a provider is not configured (missing API keys), the response will include:
The client should attempt the next provider in the fallback chain.