Documentation
LexAI is an open-source, bring-your-own-LLM assistant. This page covers every package and its features. Contributor setup lives on the{' '} Contribute page.
Overview
Three clients share one provider/prompt core. There is no LexAI backend — you supply an API key for OpenAI, Anthropic, Groq, or OpenRouter.
- Chrome — writing help on any webpage
- VS Code / Cursor — writing actions + workspace-aware Code Assist
- CLI — Prompt Builder for the terminal
Free LLM setup
LexAI is free — no subscription, no LexAI account. To use it at $0 ongoing, connect a provider that offers a free API tier. Groq and OpenRouter are the most practical; Anthropic and OpenAI offer small trial credits but not a permanent free API.
Recommended path
- Install LexAI (Chrome, VS Code, or CLI) — see Install.
- Sign up for Groq{' '} (no credit card) or{' '} OpenRouter {' '} (no card for free models).
- Create an API key on that provider's dashboard.
-
In LexAI: choose the provider, paste the key, and set the model slug below (Chrome
Options → Model; VS Code Settings → Model; CLI{' '}
LEXAI_MODEL). - Select text and run an action — requests go directly to your provider, not LexAI.
Providers
{FREE_PROVIDERS.map((provider) => ({provider.name}
{provider.summary}
- Credit card: {provider.creditCard}
- Limits: {provider.limits}
-
Suggested LexAI model:
{provider.lexaiModel}
Setup
-
{provider.steps.map((step) => (
- {step} ))}
CLI example (Groq, free tier)
{`# PowerShell
$env:LEXAI_API_KEY = "gsk_..."
$env:LEXAI_PROVIDER = "groq"
$env:LEXAI_MODEL = "llama-3.3-70b-versatile"
lexai prompt "rewrite this email to sound more professional"
# bash
export LEXAI_API_KEY=gsk_...
export LEXAI_PROVIDER=groq
export LEXAI_MODEL=llama-3.3-70b-versatile
lexai prompt "summarize this README"`}
CLI example (OpenRouter, free models)
{`export LEXAI_API_KEY=sk-or-...
export LEXAI_PROVIDER=openrouter
export LEXAI_MODEL=openrouter/free
lexai prompt "turn this bullet list into a user story"`}
Limits and trial amounts change. Check each provider's pricing and rate-limit pages before relying on a free tier in production.
Chrome extension
Manifest V3. Select text on any page, run an action, Replace or Copy. API key encrypted locally with tweetnacl secretbox.
Setup
Options page → choose provider (OpenAI, Anthropic, Groq, or OpenRouter) and paste your API key. There are no environment variables.
Features
- Fix Grammar, Rephrase, Shorten, Expand, Explain, Make Prompt
- Writing styles: Formal, Casual, Academic, Creative, Concise
- Floating toolbar, right-click context menu, popup editor
- Prompt Builder — patterns, persona, output format
- Providers: OpenAI · Anthropic · Groq · OpenRouter
- Works in text boxes, email composers, forms, and contenteditable pages
VS Code / Cursor extension
Editor twin of LexAI. Select text or code → action or Code Assist → Accept / Regenerate / Discard. Key lives in VS Code Secret Storage.
Published listing:{' '} JuanKibin.lexai-vscode
Setup
Command Palette → LexAI: Open Settings → provider, model, and API key.
The key is stored in VS Code Secret Storage. There are no environment variables.
Code Assist
- Freeform instruction in an inline prompt above the selection
- Workspace context: surrounding code, imports, and symbol definitions from other files
- Entry points: CodeLens, context menu, Command Palette, Activity Bar sidebar
Writing actions
- Fix Grammar · Rephrase · Shorten · Expand · Explain · Make Prompt
- Writing styles + Prompt Builder option chips in the suggestion zone
- Suggestion UI: zone (default), side panel, or both
- Status bar: ready / processing / not configured
- Sidebar workspace panel for paste → run → Copy
CLI — Prompt Builder
Improves a rough idea into a paste-ready engineered prompt before you send it to another agent.
Setup
Environment variables (PowerShell shown; bash uses export NAME=value):
{`$env:LEXAI_API_KEY = "sk-..." # required
$env:LEXAI_PROVIDER = "openai" # optional: openai | anthropic | groq | openrouter
$env:LEXAI_MODEL = "gpt-4o" # optional`}
Optional defaults file (never put the API key here): ~/.lexai/config.json
{`{
"provider": "openai",
"model": "gpt-4o",
"pattern": "role",
"persona": "Expert Developer",
"format": "Markdown",
"style": "Concise"
}`}
Precedence: flags → config file → env → defaults. The key is always{' '}
LEXAI_API_KEY.
Features
-
Command:
lexai prompt -
Input from args, stdin, or
-f/--file - Flags: pattern, persona, format, style, provider, model
-
Also
--list(patterns, personas, formats, styles) and{' '}--help - Engineered prompt on stdout (pipe-safe); progress and errors on stderr
Examples
{`lexai prompt "add rate limiting to the express auth routes"
echo "debug flaky playwright on CI" | lexai prompt --pattern role
lexai prompt -f draft.txt --format Markdown --model gpt-4o`}
Install
Published builds:
- Chrome —{' '} Chrome Web Store
-
VS Code / Cursor —{' '}
Visual Studio Marketplace
{' '}
(
JuanKibin.lexai-vscode)
From source (Node.js 22+):
{`git clone https://git.juankibin.space/kibin/LexAI.git
cd LexAI
npm run install:all
# Chrome
npm run chrome:dev # or chrome:build → load packages/chrome/.output/chrome-mv3
# VS Code
npm run vscode:build # or install from Marketplace
# CLI
npm run cli:build
export LEXAI_API_KEY=sk-... # required
export LEXAI_PROVIDER=openai # optional: openai | anthropic | groq | openrouter
export LEXAI_MODEL=gpt-4o # optional
node packages/cli/out/cli.js prompt "your rough idea"
# Website
npm run website:dev`}
Privacy
- No LexAI backend, account, or subscription
- No LexAI telemetry
-
Chrome: encrypted key in
chrome.storage.local - VS Code: Secret Storage
-
CLI:
LEXAI_API_KEYrequired; optionalLEXAI_PROVIDERand{' '}LEXAI_MODEL. Never store the key in~/.lexai/config.json - Text is sent only to the LLM provider you configure