---
icon: lucide/check-circle
---

# autocorrect

Correct grammar and spelling in text using a local or remote LLM.

## Usage

```bash
agent-cli autocorrect [TEXT]
```

## Description

This is a simple, one-shot command that:

1. Reads text from your system clipboard (or from a direct argument)
2. Sends the text to an LLM with a prompt to perform only technical corrections
3. Copies the corrected text back to your clipboard, replacing the original

This tool is ideal for integrating with a system-wide hotkey.

## Examples

```bash
# Correct text from clipboard
agent-cli autocorrect

# Correct text from argument
agent-cli autocorrect "this text has an eror"
```

## Options

<!-- CODE:START -->
<!-- from agent_cli.docs_gen import all_options_for_docs -->
<!-- print(all_options_for_docs("autocorrect")) -->
<!-- CODE:END -->
<!-- OUTPUT:START -->
<!-- ⚠️ This content is auto-generated by `markdown-code-runner`. -->
### Provider Selection

| Option | Default | Description |
|--------|---------|-------------|
| `--llm-provider` | `ollama` | The LLM provider to use ('ollama', 'openai', 'gemini'). |

### LLM: Ollama

| Option | Default | Description |
|--------|---------|-------------|
| `--llm-ollama-model` | `gemma3:4b` | The Ollama model to use. Default is gemma3:4b. |
| `--llm-ollama-host` | `http://localhost:11434` | The Ollama server host. Default is http://localhost:11434. |

### LLM: OpenAI-compatible

| Option | Default | Description |
|--------|---------|-------------|
| `--llm-openai-model` | `gpt-5-mini` | The OpenAI model to use for LLM tasks. |
| `--openai-api-key` | - | Your OpenAI API key. Can also be set with the OPENAI_API_KEY environment variable. |
| `--openai-base-url` | - | Custom base URL for OpenAI-compatible API (e.g., for llama-server: http://localhost:8080/v1). |

### LLM: Gemini

| Option | Default | Description |
|--------|---------|-------------|
| `--llm-gemini-model` | `gemini-3-flash-preview` | The Gemini model to use for LLM tasks. |
| `--gemini-api-key` | - | Your Gemini API key. Can also be set with the GEMINI_API_KEY environment variable. |

### General Options

| Option | Default | Description |
|--------|---------|-------------|
| `--log-level` | `warning` | Set logging level. |
| `--log-file` | - | Path to a file to write logs to. |
| `--quiet, -q` | `false` | Suppress console output from rich. |
| `--json` | `false` | Output result as JSON (implies `--quiet` and `--no-clipboard`). |
| `--config` | - | Path to a TOML configuration file. |
| `--print-args` | `false` | Print the command line arguments, including variables taken from the configuration file. |


<!-- OUTPUT:END -->

## Workflow Integration

### System-Wide Hotkey

Set up a hotkey to run autocorrect on your clipboard:

=== "macOS (skhd)"

    ```
    cmd + shift + a : /path/to/agent-cli autocorrect
    ```

=== "Linux (Hyprland)"

    ```
    bind = SUPER SHIFT, A, exec, agent-cli autocorrect
    ```

### Typical Usage

1. Select and copy text with errors
2. Press your hotkey (e.g., Cmd+Shift+A)
3. Paste the corrected text
