AI assistant on the selection (Ctrl+K / Ctrl+I)

Asking and editing with AI

Default AI. At the top of Settings → AI Assistants, the Default AI chooses the assistant used by Ctrl+K/Ctrl+I, by the AI Chat chat (which you can change per session) and by the automatic tasks (rewrite the question, summarize, audio summary, generate context). It lists both the CLIs and the API providers. Audio transcription and embeddings have their own provider, and LightNote suggests a model based on the chosen provider.

Press Ctrl+K (Ask AI) or Ctrl+I (Edit with AI) in the editor — with or without a selection — to open a floating, inline-chat style popup: the prompt field comes pre-filled with the selection below a blank line; type the instruction above it and send with Ctrl+Enter. In the popup you pick the AI (the default one comes pre-selected) and the result mode: replace the selection through a diff (Original × Suggestion, with Accept / Copy / Reject) or just display the answer as text.

LightNote runs the AI CLI in "one-shot" mode (without opening a terminal). The CLIs and the default AI live in Settings → AI Assistants.

Connecting a model

Watch the videoAI in the cloud 00:24

Models via API. Besides local CLIs, you can register LLM models via an OpenAI-compatible API (OpenAI, Groq, DeepSeek, OpenRouter, Gemini, Anthropic, local instances like Ollama/LM Studio…) under Settings → AI Assistants. Pick a provider from the catalog (base URL ready), paste the key (stored encoded only on this machine), use Fetch models… and Test. The registered models appear in the same Ctrl+K selector, alongside the CLIs.

Connecting in one step. The normal path is not filling in the table: under Settings → AI Assistants, click Connect an AI…, pick the provider (the list flags the ones that have a free plan and the ones that run on your computer, no key), follow the three steps, open the API keys page with the button and paste the key. LightNote fills in the address and the model on its own and tests the connection before saving — a wrong key shows up right there, not in the middle of a conversation. The list above shows what is already connected and, for whatever is incomplete, what is missing (“key not pasted yet”, “model not chosen yet”); a double click reopens the assistant on that provider.

Fine tuning. Address, model, MCP permission, CLI commands, audio transcription and embeddings are all still available under Advanced, at the end of the page — and inside the assistant itself, under Advanced options, you can change the base URL and the model before connecting. Nothing was removed: it just moved out of the way of someone starting out. The embeddings section also has an optional Dimensions field: some models accept returning a smaller vector (512 instead of 1536), which halves the cache with little loss. Leave it at (model default) if you are unsure — not every provider accepts the parameter. Changing the value invalidates the cache: vectors of different dimensions cannot be compared, so it is discarded and rebuilt on the next search, which costs new calls.

Not every failure is the same. LightNote tells the classes apart because they call for opposite gestures. Provider overload and rate limits pass on their own: the app repeats the call by itself, honouring the wait the provider asks for, and you only see the error if that does not work either. Balance or spending limit never passes with repetition — the message says so, to stop you from trying. A conversation that grew too long calls for a new session, not another model. And a model failure — retired, outside your account, outside your plan, or it took the call and never answered — is the only one that changing the model fixes. When the requested wait is too long to sit through, the message tells you how many seconds it asked for, instead of leaving the window frozen.

Changing the model by itself. Tick Switch model automatically when the current one fails and LightNote tries, in the order shown right there, the models recommended for that provider. It comes unticked on purpose: each attempt is a call billed to your account. The alternative never costs more than the model you chose — the list is published from the most expensive to the cheapest and the app only goes down it; a custom model, which is not on the list, falls straight to the cheapest one. Only a definitive failure is written to the provider; when it was the network that failed, the switch holds for that call alone and your choice still stands. The switch is never silent: a notification says which model answered and whether the change was saved.

And the notice that arrives before the failure. The automatic switch only acts after the call has failed — but the model catalog, which LightNote checks on its own, usually knows about the retirement before that. When the model that LightNote itself set up for a provider drops out of the catalog, a notice says so, and under Settings → AI Assistants a button appears to move to the replacement — which, by the same rule, is never more expensive. The notice applies only to the model the app chose and you never touched: a model you typed is your choice, and LightNote does not meddle with it.

When nothing answers. LightNote says what happened and offers to change the model, use another assistant or turn that provider off until you sort it out. A provider turned off (the Active column of the table, under Advanced) disappears from the lists without losing the key or the rest of the settings. In the list of assistants each one says whether it is local or in the cloud — picking one in the cloud makes the text you send leave your machine.

Set up AI. The guided path to any AI is the Set up AI… button, at the top of Settings → AI Assistants (it is also what the empty chat's Connect an AI… and the Ctrl+K notice with no AI open). It asks what you want to set up and takes you, step by step, along five paths: AI in the cloud, AI on your computer with Ollama or LM Studio, AI on your computer directly through LightNote, command-line assistant and search by meaning. Next to the button, the What each feature uses table shows which AI serves the chat, Ctrl+K, Block AI, automatic tasks and search by meaning. The details are in AI on your computer.

No key: a local LLM

No AI yet? If you press Ctrl+K with no assistant connected, LightNote explains it and offers to connect one right there — and as soon as you do, the action you asked for goes ahead, with no need to press the shortcut again.

Local LLM (no API key). Local providers — Ollama, LM Studio, llama.cpp — need no API key: pick one under Add (the picker shows whether the server is running) and use Fetch models… to choose among the models you have pulled. If Ollama isn't installed, LightNote offers to install it for you. It comes pre-registered on the first run — you only pick the model. Because a local model can take much longer to answer (especially on the first generation, while the model loads), LightNote waits far longer for it than for a cloud service. None of your text leaves the machine.

Running the model with no separate program. Besides Ollama and LM Studio, LightNote can download and run a model on its own, with the official llama.cpp program: the Set up AI wizard shows beforehand how much disk and memory it takes and measures the speed on your computer. See AI on your computer.

Accepting, prompts and where the actions live

Accept hunk by hunk. When the result comes as a diff, you don't have to take all of it: each changed block has a checkbox to include it or not, and the final text is rebuilt from just the blocks you keep. The prompt also carries automatic context from the file (path, language and the lines around the selection), so the AI answers more precisely without you pasting anything.

Prompt library. AI → Prompt library… keeps reusable prompts as .md files in a Prompts/ folder of your workspace — an open format, versionable in Git and part of your second brain. The picker offers search, a preview and a button to create a new prompt. When you pick one, the fields {selection}, {file}, {folder}, {name} and {language} are filled with the current editor context (your own variables are preserved), and the text is injected into the Ctrl+K field or sent to the active AI terminal, without submitting.

Not only in the code editor. The AI actions (Ctrl+K / Ctrl+I and the context menu) also work in the Markdown editor, in the embedded task note and in the database SQL query editor — in each one the popup opens over the cursor and applies the result in place.

All AI actions live in the AI menu (in the ☰ button and in the wand button of the activity bar): Ask AI (Ctrl+K), Edit with AI (Ctrl+I), AI sessions, AI Chat, Prompt library, Generate the workspace context file, Enable AI in this folder and Configure AI assistants.

The window stays open while you write. It does not close when you click in the editor — you can re-read the code or select another passage without losing the instruction you already typed. What closes it: Esc, the window's own ✕ and the result actions (Accept/Reject). When you switch tabs it tucks itself away keeping what was written: go back to the same file, press Ctrl+K and the instruction comes back where you left it.