Skip to main content

Spegel - Reflect the web through AI. A terminal browser with multiple AI-powered views.

Project description

Spegel - Reflect the web through AI

Automatically rewrites the websites into markdown optimised for viewing in the terminal. Read intro blog post here

This is a proof-of-concept, bugs are to be expected but feel free to raise an issue or pull request.

Screenshot

Sometimes you don't want to read through someone's life story just to get to a recipe Recipe Example

Installation

Requires Python 3.11+

$ pip install spegel

or clone the repo and install it in editable mode

# Clone and enter the directory
$ git clone https://github.com/simedw/spegel.git
$ cd spegel

# Install dependencies and the CLI
$ pip install -e .

API Keys

Spegel is using litellm, which allows the use of the common LLMs, both local and external.

By default Gemini 2.5 Flash Lite is used, which requires you to set the GEMINI_API_KEY, see env_example.txt

Usage

Launch the browser

spegel                # Start with welcome screen
spegel bbc.com        # Open a URL immediately

Or, equivalently:

python -m spegel      # Start with welcome screen
python -m spegel bbc.com

Basic controls

  • / – Open URL input
  • Tab/Shift+Tab – Cycle links
  • Enter – Open selected link
  • e – Edit LLM prompt for current view
  • b – Go back
  • q – Quit

Editing settings

Spegel loads settings from a TOML config file. You can customize views, prompts, and UI options.

Config file search order:

  1. ./.spegel.toml (current directory)
  2. ~/.spegel.toml
  3. ~/.config/spegel/config.toml

To edit settings:

  1. Copy the example config:
    cp example_config.toml .spegel.toml
    # or create ~/.spegel.toml
    
  2. Edit .spegel.toml in your favorite editor.

Example snippet:

[settings]
default_view = "terminal"
app_title = "Spegel"

[ai]
default_model="gpt-4.1-nano"

[[views]]
id = "raw"
name = "Raw View"
hotkey = "1"
order  = "1"
prompt = ""

[[views]]
id = "terminal"
name = "Terminal"
hotkey = "2"
order = "2"
prompt = "Transform this webpage into the perfect terminal browsing experience! ..."
model="claude-3-5-haiku-20241022"

Local Models with Ollama

To run with a local model using Ollama, first pull and serve your desired model:

$ ollama pull llama2
$ ollama serve

Then set the model in .spegel.toml as follows:

model = "ollama/llama2"

Ollama supports models like Llama, Mistral, and many others.

License

MIT License - see LICENSE file for details.

For more, see the code or open an issue!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spegel-0.1.2.tar.gz (129.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spegel-0.1.2-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file spegel-0.1.2.tar.gz.

File metadata

  • Download URL: spegel-0.1.2.tar.gz
  • Upload date:
  • Size: 129.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for spegel-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a8d46dc64dc76b4ea36776059d461d6f0182601f3df1de3347ff5fee846a640a
MD5 afa71c751c96284796180c4cae43fdb8
BLAKE2b-256 ecdda7baaf5e9c83c2c7606e39aff654bdd19902fad6c74e06d89ac797b58222

See more details on using hashes here.

Provenance

The following attestation bundles were made for spegel-0.1.2.tar.gz:

Publisher: publish.yml on simedw/spegel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spegel-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: spegel-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 22.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for spegel-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d18d85e2447588578a6094c58bd4ce7c4c829cea31ee3deb820c985be540b1dc
MD5 a20ae474546b6227a397d9991502ebc8
BLAKE2b-256 3e7fdaa4ef063b6a0c93aacaa185e456c289a3a35dcc9843f499e61ae49cce85

See more details on using hashes here.

Provenance

The following attestation bundles were made for spegel-0.1.2-py3-none-any.whl:

Publisher: publish.yml on simedw/spegel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page