Spegel: A Terminal Browser That Uses LLMs to Personalize Web Content
Spegel: A Terminal Browser Leveraging LLMs to Transform Webpages On June 23, 2025, a unique terminal web browser called Spegel was introduced. Named "mirror" in Swedish, Spegel is a proof-of-concept tool that processes HTML content through a large language model (LLM) and renders the output as markdown directly in your terminal. How It Began Two weekends ago, after my family had gone to sleep, I had some free time with my laptop and a creative spark. Within a few hours, I developed a minimal web browser running in my terminal. This version supported only basic functionalities—no JavaScript and GET requests only—but it successfully transformed web content based on custom prompts. A few days later, Google released Gemini 2.5 Pro Lite, which offered significantly faster inference speeds. This update made my weekend project more practical and functional, leading to the birth of Spegel. Personalization The concept of tailoring content to individual needs is not new. For example, translating books or summarizing long articles has been done for years. However, these processes were often slow and costly. Large language models have revolutionized this, making such transformations quick and efficient. Spegel allows users to explore web content through personalized views by inputting their own prompts. You can create multiple views for a single webpage, such as one that simplifies complex content to an "Explain Like I'm Five" (ELI5) level or another that highlights key actions. The possibilities are endless, depending on your prompting skills. Technical Overview The workflow of Spegel is simple: Fetching HTML: Spegel retrieves HTML content from web pages. Processing Through LLM: The HTML is then processed through an LLM using prompts stored in a configuration file (~/.spegel.toml). Rendering Markdown: The output is rendered as markdown using Textual, a library for creating terminal user interfaces (TUIs). Prompts and views can be modified in real-time during a browsing session. One challenge was ensuring that only complete lines (those ending in newline characters) were streamed, as partial lines could confuse the markdown renderer and disrupt the formatting. Comparison with Other Terminal Browsers There are several excellent terminal browsers available, such as Lynx and Links2, which hold a special place in my heart. Modern browsers like Browsh even support graphical rendering using half-block Unicode characters (▄█). Spegel is not intended to replace these tools but rather serves as an innovative exploration and proof-of-concept. Most contemporary websites are not optimized for terminal browsing, relying heavily on CSS and JavaScript. This makes them difficult to navigate and read in a terminal environment, often cluttered with unnecessary elements. Spegel aims to streamline the experience by removing distractions and delivering content that is more aligned with your specific needs. Try It Out Spegel is still in its early stages and may have some rough edges, but it is usable and enjoyable to experiment with. Here’s how you can get started: Installation: Install Spegel via pip: pip install spegel Usage: Run Spegel with a URL: spegel https://example.com Configuration: Don’t forget to set up your own configuration file (~/.spegel.toml). Here’s an example: toml [prompts] eli5 = "Summarize this page as if explaining it to a five-year-old." highlight_actions = "Highlight all actionable items on this page." If you’re interested in checking out the source code or contributing to the project, you can find it on GitHub: https://github.com/simedw/spegel Conclusion Spegel represents a promising step in making web content more accessible and relevant through terminal-based browsing. By leveraging LLMs, it offers users a powerful and flexible way to personalize their web experiences. While it is still a work in progress, the potential for further development is exciting. If you enjoy tinkering with technology and want to see how AI can transform web content, give Spegel a try.