Ramesh Inampudi

Tools

Lexa: A System-Wide AI English Corrector and Explainer

By Ramesh Inampudi · 2026-03-12 · 4 min read

I write English every day in emails, Slack messages, code comments and terminal commit notes, and English is not my first language. Most grammar tools live inside one app or one browser tab. Lexa is my attempt to fix that: select text anywhere, right-click, and get a corrected version or a plain-English explanation, powered by an LLM through OpenRouter.

Why I built it

The problem was friction. Copying a sentence into a separate grammar site, reading the result and pasting it back is enough effort that I often skipped it and sent the message as written. I wanted the correction step to be as cheap as a copy and paste, and to work in every app, not only the ones with a plugin.

I also wanted it to cost nothing to try. OpenRouter offers free-tier models, so Lexa can run at $0 with no credit card needed for those models. Paid models are available if you prefer them.

What it does

Lexa has two actions:

On macOS the actions appear under right-click, then Services, as Correct English (Lexa) and Explain Text (Lexa). There is also a Stop Lexa Services entry that kills any running Lexa process, which is useful when a slow free model hangs. Keyboard shortcuts are Cmd+Shift+E and Cmd+Shift+X on macOS, and Ctrl+Shift+E and Ctrl+Shift+X on Linux.

It also works from the terminal:

How it works

The project is mostly Python, with Shell scripts for installation. The core is a small set of files:

One engine, thin OS wrappers

The main design choice was keeping all the logic in one Python CLI and letting each operating system provide only a trigger. On macOS, the setup script registers Automator Quick Actions in ~/Library/Services/ and refreshes the services cache. On Linux, the setup script installs xclip, libnotify-bin and python3-tk through apt-get and registers GNOME keyboard shortcuts. Both end up calling the same script. This is reusable: if your tool is a command that reads text and writes text, the OS integration is just glue.

Clipboard as the interface

Using the clipboard as input and output avoids needing accessibility permissions or app-specific plugins. On Linux, selected text is already in the X11 selection, and after correction the result sits in the clipboard for Ctrl+V. The trade-off is that Lexa does not replace text in place; you paste it yourself.

Configuration through .env

Settings live in a .env file, or in ~/Library/Application Support/Lexa/.env for the macOS app install:

The input cap matters. Since every selection goes to a remote model, a limit stops an accidental select-all from sending a huge document.

Model choice

Because OpenRouter exposes many models behind one API, switching is a one-line change to CORRECTOR_MODEL. The README lists free options such as Llama 3.3 70B, Gemini 2.0 Flash, DeepSeek R1 and V3, Mistral 7B, Qwen 2.5 72B and Gemma 3 12B, plus paid ones like GPT-4o Mini and Claude Haiku.

Installing it

On macOS, the recommended route is the DMG: drag Lexa.app into Applications, open it, enter your OpenRouter key, choose a model, and enable the three services under System Settings, Keyboard, Shortcuts, Services, Text. Opening the app again re-runs setup. Developers can clone the repository and run bash mac/setup_mac.sh instead, which needs Python 3.9 or newer. On Linux, run bash linux/setup_linux.sh on a GNOME desktop, then add your key to .env.

What I learned

Conclusion

Lexa is a small tool with a narrow job: make checking my English cost one right-click. A single Python CLI, a clipboard-based workflow and an OpenRouter model of your choice are enough to make that work across apps on macOS and Linux. If you try it, start with the free default model and adjust the timeout before anything else.