Summarize
repository·main·Indexed 27 days ago
https://github.com/steipete/summarizeA tool for generating fast summaries from URLs, files, and media including YouTube and podcasts. It provides a CLI, a browser extension for Chrome and Firefox, and an optional daemon for advanced media processing, native OCR, and enhanced AI capabilities. Supports multiple providers including OpenAI, Anthropic, Gemini, and local Ollama models. Includes @steipete/summarize-core for content extraction and prompt building.
What's inside @steipete/summarize
- @steipete/summarize-core is the core library providing content extraction capabilities and prompt builders. For library usage, it is recommended to import specifically from the sub-modules to access the required functionality.
Understand the Summarize Execution Engine architecture
mainThe execution engine (
src/engine) is a headless core responsible for summary policy and execution. It is designed to be transport-agnostic and does not depend on terminal (TTY), daemon, or HTTP layers.Key Responsibilities of the Engine:
- Prompt policy
- Model attempts and provider overrides
- Summary cache keys and normalization
- Stream normalization
- Timestamp validation
- Retry and fallback outcomes
Adapter Responsibilities (CLI, Daemon, Browser): Adapters are responsible for the UI and transport layers, including
stdout/stderr, terminal rendering, progress lifecycles, and SSE/HTTP serialization.Access Summarize documentation
mainThe project documentation is organized into several specialized guides covering different aspects of the Summarize tool. You can find specific information in the following files:
- Chrome Extension:
docs/chrome-extension.md(Side panel extension and daemon setup/troubleshooting) - Cache:
docs/cache.md(SQLite cache design and configuration) - CLI Models:
docs/cli.md(Claude, Codex, Gemini, Agent, OpenClaw, OpenCode, Copilot, Antigravity, pi) - Configuration:
docs/config.md(File location, precedence, and schema) - Extract Mode:
docs/extract-only.md(Running without LLM summarization) - Engine Architecture:
docs/engine.md(Headless execution engine) - Firecrawl:
docs/firecrawl.md(Firecrawl mode and API key usage) - Language Settings:
docs/language.md(Setting output language via--languageor config) - LLM Configuration:
docs/llm.md(Summarization via Gateway or OpenAI) - Manual Testing:
docs/manual-tests.md(End-to-end test checklist) - Automatic Model Selection:
docs/model-auto.md(Using--model auto) - Local Ollama:
docs/ollama.md(Using local Ollama models via OpenAI-compatible endpoints) - OpenAI Usage:
docs/openai.md(OpenAI model usage and flags) - Releasing:
docs/releasing.md(Release checklist and Homebrew verification) - Smoke Testing:
docs/smoketest.md(20-case smoke test plan) - Website Extraction:
docs/website.md(HTML extraction and Firecrawl fallback) - YouTube Extraction:
docs/youtube.md(Transcript extraction via youtubei, captionTracks, or Apify)
- Chrome Extension:
Use the CLI to summarize websites, YouTube, and files
mainThesummarizeCLI supports multiple input types including URLs, YouTube videos, and local files. Use the--modelflag to specify the LLM and the--lengthflag to control summary verbosity. For YouTube videos, use the--youtube autoflag to enable automatic caption/transcript handling.Authenticate with an Auth-fronted Ollama
mainIf your Ollama instance is behind an authentication proxy, set theOPENAI_API_KEYenvironment variable.summarizewill forward this value as anAuthorization: Bearer …header. For bare Ollama instances, any value for this variable is acceptable.Release @steipete/summarize via the release script
mainThe recommended way to release the project is using the
scripts/release.shhelper script. This script manages the complex workflow of publishing to npm, building artifacts, and preparing GitHub releases.Release Phases:
gates: Runs pre-flight checks (pnpm install,check,build).build: Builds various artifacts (Bun, Chrome, Firefox).publish: Publishes core and CLI to npm using thenexttag, performs a smoke test, and then promotes tolatest.tag: Creates an annotated git tag.github: Verifies the GitHub Release and assets.homebrew: Verifies the Homebrew installation.deprecate: Used to deprecate a broken version.all: Runs the full release pipeline.
Generate a basic summary
mainRun
summarizefollowed by a URL to generate a streaming Markdown summary in your terminal. The default summary length islong(~4k chars). You can adjust the length using the--lengthflag with predefined values likeshortor specific character counts.summarize "https://en.wikipedia.org/wiki/Llama" # Custom lengths summarize "https://example.com/long-article" --length short summarize "https://example.com/long-article" --length 3k summarize "https://example.com/long-article" --length 30000Summarize web pages, YouTube videos, and local files via CLI
mainThe
summarizeCLI can be used to extract and summarize various content types. It uses Readability for articles,markitdownfor files, and various transcript fetchers for media.Common usage patterns include:
- Web pages: Summarize a URL using the default model.
- YouTube: Summarize a video (prefers captions, falls back to
yt-dlp+ Whisper). - Local files: Summarize PDFs, images, audio, or video files.
- Pipes: Use
--extractto skip the LLM and output only the cleaned content, which is ideal for piping to other tools. - Stdin: Pipe content from the clipboard or standard input into
summarizeusing-.
# Web page summarize "https://example.com/article" # YouTube summarize "https://youtu.be/I845O57ZSy4" # Local file with specific model summarize ./report.pdf --model openai/gpt-5-mini # Extract content only (no LLM) for pipes summarize "https://example.com" --extract --format md | wc -w # From clipboard/stdin pbpaste | summarize -Configure LLM models and API keys via environment variables
mainTo use specific LLM providers with
summarize, you must set the corresponding API key in your environment or a.envfile in the current working directory. Some providers also allow overriding the base URL for OpenAI-compatible endpoints.Required Environment Variables
- xAI:
XAI_API_KEY(Optional:XAI_BASE_URL) - OpenAI:
OPENAI_API_KEY(Optional:OPENAI_BASE_URL,OPENAI_USE_CHAT_COMPLETIONS) - NVIDIA:
NVIDIA_API_KEYorNGC_API_KEY(Optional:NVIDIA_BASE_URL) - MiniMax:
MINIMAX_API_KEY(Optional:MINIMAX_BASE_URL) - OpenRouter:
OPENROUTER_API_KEY(Used ifOPENAI_BASE_URLpoints to OpenRouter) - GitHub Models:
GITHUB_TOKENorGH_TOKEN(forgithub-copilot/...models) - Z.AI:
Z_AI_API_KEYorXAI_API_KEY(Optional:Z_AI_BASE_URL) - Ollama:
OLLAMA_BASE_URL(Default:http://localhost:11434/v1) - Google:
GEMINI_API_KEYorGOOGLE_API_KEYorGOOGLE_GENERATIVE_AI_API_KEY(Optional:GOOGLE_BASE_URLorGEMINI_BASE_URL) - Anthropic:
ANTHROPIC_API_KEY(Optional:ANTHROPIC_BASE_URL)
Configuration Fallback
If process environment variables are missing,
summarizereads fallback defaults from~/.summarize/config.jsonunder theenvkey.- xAI:
Use the Summarize CLI for websites and podcasts
mainThe CLI can summarize websites, handle podcast URLs, and use specific transcription providers.
- Website summary: Provide a URL. Use
--max-output-tokensto limit output. - No-model-needed shortcut: Providing a very high
--max-output-tokensvalue (e.g.,99999) will print the extracted text without invoking an AI model. - Podcast/Audio: When using a podcast URL, the tool will download and transcribe the audio. If
ASSEMBLYAI_API_KEYis set, it will useassemblyaias thetranscriptionProvider. - Detailed metrics: Use
--metrics detailedto see more information during processing.
- Website summary: Provide a URL. Use
Install and pair the Summarize Daemon
mainThe daemon allows the Chrome extension to access native tools (like
yt-dlp,ffmpeg, andtesseractOCR), shared caches, and CLI model fallbacks. To pair the extension with the CLI, you must install the daemon using a token copied from the extension's Side Panel.If you use a non-default port, you must specify it during installation and then update the extension settings in Options → Runtime → Daemon → Port.
Add a new Transcript Provider
mainWhen extending the project with a new transcript provider, follow these implementation rules to maintain architectural consistency:
- Register cloud metadata: Define the provider's characteristics.
- Add a remote attempt handler: Implement how the provider handles byte/file attempts.
- Widen shared capability helpers: Update
transcription-capability.tsto include the new provider's capabilities (e.g.,canTranscribe). - Write focused provider tests: Implement unit tests for the provider logic before integrating into live orchestration tests.
- Keep entrypoints thin: Avoid putting orchestration logic directly in the entrypoint; use pure parser helpers where possible.