Skip to content

bogorad/openrouter-summarizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

478 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

OpenRouter Summarizer v3.9.42

Summarize any web page content and chat with the context using OpenRouter.ai APIs Featuring interactive chat, native HTML summaries, flexible options, and robust CSS isolation!


What's New in v3.9.42

  • Customizable Chat Quick Buttons:
    • Added a quick-button row in chat between model selection and the message input.
    • Buttons are configurable in Options with per-button title and prompt.
    • Clicking a quick button sends its mapped prompt immediately.

Features

  • Summarize Anything: ALT+hover to highlight, then ALT+Click any element on a web page to select and summarize it.
  • Robust UI: Extension popups render consistently on any website, immune to external CSS and design conflicts.
  • Native HTML Summaries: LLM returns properly formatted HTML bullet lists with preserved formatting (bold text, etc.).
  • Copy: Use Copy HTML icon (πŸ“„) in the floating menu to copy complete element HTML to clipboard.
  • Interactive Chat: Engage in follow-up conversations with the LLM based on the summarized content or the original HTML snippet.
  • Configurable Chat Quick Buttons: Add/edit/remove quick buttons in Options; each button has a title and a prompt and can send immediately from chat.
  • Flexible Model Selection: Choose from a default list or add/edit any OpenRouter-compatible model ID in the Options. Your selection syncs across sessions. Supports model variants:
    • :nitro - Fastest inference speed
    • :floor - Lowest cost provider
    • :auto - Automatic routing
    • :online - Real-time web search (see Web-Enabled Chat)
  • Configurable Languages for Chat Flags: Manage a list of preferred languages in the Options. Corresponding flag icons will appear on the chat popup. Clicking a flag initiates a request to translate the latest message.
  • Languages can now be reordered by dragging them in the Options list.
  • Customizable Prompt: Modify the formatting instructions sent to the LLM via the Advanced Options section.
  • Fully Functional Summary Configuration: Choose the number of summary points (3-8) - this setting dynamically updates the prompt.
  • Keyboard Shortcuts:
    • Summary popup: Y to copy, T to chat, R for NewsBlur, E or Escape to close
    • Joplin dialog: Enter to save, Escape to close
    • Chat window: Ctrl/Cmd+Enter to send messages
  • Instant Results: Summaries appear in a clean popup; chat happens in a dedicated tab.
  • Secure & Private: Your API key and options are stored locally in your browser storage. Chat context is stored temporarily in session storage. Nothing is sent anywhere except OpenRouter.ai when you request a summary or chat response.
  • Smart Content Cleanup: Automatically removes unwanted elements like ads, tracking scripts, navigation menus, social media widgets, and promotional content before processing, ensuring cleaner summaries and better LLM performance.
  • Comprehensive Debug Logging: Enable debug mode in Options for detailed console logging throughout all processes including language detection, summary processing, and API calls. The API key is filtered from debug messages.
  • Joplin support: Save to Joplin instead of/in addition to summarizing.

Screenshots

Selection


Summary


Chat


Models


Extension Architecture

The OpenRouter Summarizer follows a modular architecture with clear separation of concerns between content scripts, background services, and user interfaces. The full architecture schematic is available as a PDF:

Architecture Schematic

Source: docs/schematic.typ

Key Components

  • 🟦 User Interface Layer: Direct user interaction points (web pages, options, chat)
  • πŸŸͺ Content Scripts: Injected scripts handling DOM interaction and UI elements
  • 🟩 Background Services: Service worker managing API calls, storage, and business logic
  • 🟧 External Services: Third-party APIs and libraries for LLM processing and integrations
  • πŸŸ₯ Storage Systems: Chrome extension storage for settings and temporary data

Data Flow Highlights

  1. Content Selection: User interactions trigger DOM highlighting and element selection
  2. Processing Pipeline: Selected content flows through sanitization, API processing, and display
  3. Two-Stage Cleaning: Enhanced content cleaning for NewsBlur sharing with sanitization and standardization
  4. Modular Architecture: Clear separation between UI, business logic, and external integrations

How It Works

  1. Install & Setup:
    • Install the extension.
    • The Options page opens on first install. Enter your OpenRouter.ai API Key.
    • Review default models/languages/settings. Save Options.
  2. Select Content:
    • On any webpage, hold ALT + hover mouse to preview highlightable elements (blue dashed outline).
    • ALT+Click an element to select it (red solid outline). A floating menu appears with up to 3 icons:
      • πŸ’‘ Summarize: Main summarization icon
      • βœ‚οΈ Joplin: Save to Joplin (if token configured)
      • πŸ“„ Copy HTML: Copy element's complete HTML to clipboard
  3. Choose Action:
    • Summarize: Click the main icon (πŸ’‘), or right-click and choose "Send to LLM".
    • Copy HTML: Click the Copy HTML icon (πŸ“„) to copy sanitized element HTML to clipboard.
    • Save to Joplin: Click the Joplin icon (βœ‚οΈ) to save content to a Joplin notebook.
    • The extension extracts the selected element's HTML, applies comprehensive sanitization to remove unwanted content (ads, tracking, navigation elements), converts it to Markdown to save money and improve LLM's job, then sends it and your configured prompt (requesting a JSON array of HTML strings) to the selected OpenRouter model for summarization.
  4. Review Summary:
    • The summary (received as a JSON array of strings) is parsed and appears in the popup, rendered as a clean HTML list (<ul><li>...</ul>). Potential code fences (json ... ) around the JSON are automatically stripped. LLM responses containing multiple JSON arrays or trailing text are handled more robustly.
    • Use keyboard shortcuts for quick actions:
      • Y - Copy summary to clipboard
      • T - Open chat interface (if enabled)
      • R - Share to NewsBlur (if token configured)
      • E or Escape - Close the popup
    • Or use buttons: Copy, Chat, NewsBlur, or Close.
    • Use NewsBlur to share the summary and the selected HTML snippet.
  5. Chat ("talk to the page"):
    • Click Chat on the summary popup to chat about the article.
    • A new browser tab opens. This page has access to both the original HTML snippet and the summary.
    • The original HTML snippet and the raw/processed JSON string are stored. For every message you send, the original HTML snippet is automatically prepended to the recent chat history before sending to the LLM for context.
    • Language flags are available in the chat interface. Click a flag to request a translation of the latest assistant message into that language. While the LLM is processing a request, these flags will be visually dimmed and show a "busy" tooltip.
    • Quick buttons are available in the chat interface. Configure button titles and prompts in Options; clicking a quick button sends its prompt immediately.
    • Type follow-up questions. Use Ctrl+Enter / Cmd+Enter to send using any of the configured models.
    • Tip: Use an :online model variant (e.g., x-ai/grok-4.1-fast:online or openai/gpt-5.1-codex-mini:online) for questions requiring current web information beyond the page content. See Web-Enabled Chat below.
    • LLM responses are rendered with via basic HTML (<b>/<i>) but full markdown is recognized via the marked library.
    • Use Copy MD, Download MD, or Download JSON to save the chat.

Web-Enabled Chat

For chat conversations requiring current information beyond what's on the page, OpenRouter offers the :online model variant. Append :online to any model ID in Options to enable real-time web search capabilities:

Example Models with :online:

  • x-ai/grok-4.1-fast:online - Grok with web search + X/Twitter search (xAI models uniquely support both web and X search)
  • openai/gpt-5.1-codex-mini:online - GPT with native web search
  • anthropic/claude-sonnet-4:online - Claude with web search
  • google/gemini-2.5-flash:online - Gemini with Exa-powered search
  • meta-llama/llama-4-scout:online - Llama with web search

When to Use :online in Chat:

The :online variant is particularly powerful for the Chat feature when you need to:

  • Verify or update facts from the summarized content against current sources
  • Follow up on recent developments related to the article's topic
  • Research additional context that the LLM's training data might not cover
  • Get citations to current sources the model can reference in its answers

How It Works:

When you use an :online model in chat:

  1. Your question is analyzed for search intent
  2. OpenRouter's web search agent retrieves relevant current results
  3. The model incorporates these results into its response with citations

For models with native search (OpenAI, Anthropic, Perplexity, xAI), the provider's built-in search is used. For other models, search is powered by Exa.

Note about xAI Models: When using xAI models (like Grok) with :online, you get access to both traditional web search AND X (Twitter) search, giving you real-time social media context in addition to web results.

Stacking Variants:

You can combine :online with other variants:

  • meta-llama/llama-4-scout:floor:online - Cheapest provider + web search
  • openai/gpt-5.1-codex-mini:online - Fast model with web access

Cost Note: Web search adds a small cost per request (typically ~$0.02 via Exa, or provider-specific pricing for native search). See OpenRouter's web search documentation for current pricing details.


Privacy & Permissions

  • Permissions Used:
    • activeTab, scripting: To interact with the page for selection and UI.
    • contextMenus: For the right-click menu option.
    • storage: To save API key/preferences (sync) and temporary chat context (session).
    • <all_urls>: To allow selection on any website.
    • web_accessible_resources: Used for accessing static assets (icons, flags, JS libraries like marked.min.js) and dynamically imported content script modules (highlighter.js, floatingIcon.js, summaryPopup.js, constants.js) from content scripts/pages.
  • Your Data:
    • API Key & Settings: Stored locally in chrome.storage.sync. Only sent to OpenRouter.ai upon request. Prompt templates and your configured language list are also stored here.
    • Selected HTML & Summary: Sent to OpenRouter.ai for summary/chat requests.
    • Chat Context: Original HTML snippet and raw/processed JSON string stored temporarily in chrome.storage.session for the chat tab. Cleared when the browser session ends. The HTML snippet is re-sent with subsequent chat messages for context.
    • No Analytics: No tracking or ads.
  • Security:
    • Renders HTML list/Markdown. Does not execute scripts or load external resources from LLM responses. Relies on marked for chat rendering. Static assets like SVGs and dynamically imported JS modules are loaded securely from within the extension bundle via chrome.runtime.getURL.

Q: How are flags chosen for languages? A: The extension attempts to use an SVG flag file ([language_code].svg) from the country-flags/svg/ directory based on the ISO 639-1 code associated with that language in the languages.json file. If a flag file for a specific language code is not available in the extension bundle, a generic placeholder flag will be displayed.


Tags

Summarizer, LLM, OpenRouter, AI, Chat, JSON, HTML, Markdown, Chrome Extension, Productivity, GPT, Claude, Llama, Gemini, Article Summarizer, Web Clipper, Prompt Engineering, Translation, Language Flags, Keyboard Shortcuts, Copy HTML, Hotkeys, Web Search, Online, :online, Real-time Search

About

Summarize any web page content in one click using OpenRouter.ai API

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors