AI providers

kvim keeps prompt-oriented AI actions separate from language servers and Copilot inline completion. Grammar/clarity text edits always require explicit review before they can mutate editor state.

Kvim home

To send a prompt plus cursor/selection context to an already-running Copilot CLI conversation, use <space>ac or :copilot send; <space>as chooses the destination. This separate integration saves the file before sending and retains the CLI conversation's normal repository tools and approvals. See live CLI handoff for setup, single-line popup controls, queueing, and the different privacy boundary.

Grammar and clarity actions

Select text in Visual or Visual Line mode, press :, and run:

The request runs asynchronously. Its result opens in a confirmation dialog; press y to replace the captured selection or Esc to cancel. kvim rejects the result if the buffer changed while generation or review was in progress. Visual Block selections are not supported because they are non-contiguous.

Claude setup

  1. Create an Anthropic API key.
  2. Copy the key to the system clipboard.
  3. Run :claude login in kvim.
  4. Select Claude in config.toml:
[ai]
provider = "claude"
model = "claude-sonnet-5"
max_tokens = 512

:claude login imports the clipboard text into the OS credential store through the keyring crate. The key is not written to config.toml, ui_state.toml, the log, or :config-dump. The clipboard is left unchanged. Run :claude logout to remove kvim's stored key. :health reports the configured provider, model, and keychain readiness without displaying the credential.

On Linux, the default keyring backend requires a working Secret Service implementation such as GNOME Keyring or KWallet. Windows uses Credential Manager and macOS uses Keychain Services. Backend failures remain visible in Health and the shared status bar.

Provider selection

[ai] provider accepts:

Selecting Claude does not disable Copilot completion. [completion] copilot and [copilot] continue to control the separate Language Server service.

The Copilot prompt provider invokes copilot non-interactively with repository tools, custom instructions, built-in MCP servers, and remote export disabled. The bounded request is supplied through a temporary attachment that is deleted when the request finishes. Closing the review surface cancels the contained process tree.

Use a concrete Anthropic model identifier. kvim sends requests to https://api.anthropic.com/v1/messages with API version 2023-06-01, bounds requests and responses, and cancels an in-flight request when its UI closes. Provider errors leave the text-edit review open without changing the buffer.

Data sent for text actions

The grammar and clarity commands send only:

No surrounding buffer text is included. Claude receives no file path. The Copilot adapter sends a synthetic document URI rooted under the active workspace because its protocol requires a document location; it does not send the selected file's path. The selected text is labelled as untrusted data, but text-only prompt separation is not a security boundary.