# CLI

SleekAI is scriptable under `wp sleek ai`. The terminal does what the screens
cannot do headlessly: provisioning API keys, describing every image of a
media library, forcing a chatbot's file synchronization or setting options
the screens do not show. The [CLI reference](/docs/ai/reference/cli.md) lists
every command with its options and examples, and `wp help sleek ai` prints
the same.

## The command groups

| Commands                        | For                                                                                                        |
| ------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `wp sleek ai key`               | Storing, listing and deleting provider API keys; see [API Keys](/docs/ai/settings/api-keys.md).               |
| `wp sleek ai models list`       | The model identifiers available with the stored keys.                                                      |
| `wp sleek ai generate`          | One reply from a model, to try a key and a model.                                                          |
| `wp sleek ai alt-text generate` | Alt text for chosen images or every image without one; see [Alt text](/docs/ai/alt-text.md).                  |
| `wp sleek ai chatbot`           | Chatbots from JSON, their logs, and their file synchronization; see [Chatbots](/docs/ai/chatbots/general.md). |
| `wp sleek ai settings`          | Reading and writing SleekAI's settings by dot path.                                                        |
| `wp sleek ai agent caps`        | The Agent capabilities of each role; see [Agent settings](/docs/ai/agent/settings.md).                        |
| `wp sleek ai cleanup`           | The maintenance jobs, on demand.                                                                           |
| `wp sleek ai pt-sync`           | [Agent Sync](/docs/ai/agent-sync.md) of chatbots and Agent records to theme files.                            |

Commands that list things take `--format=json` for scripts.

## Settings by dot path

`wp sleek ai settings get` and `wp sleek ai settings update` read and write
the `sleek-ai_settings` option by dot path. `true`, `false` and numbers are
stored as such; anything else as text.

```bash
wp sleek ai settings get altText
wp sleek ai settings update altText.autoGenerate true
wp sleek ai settings update retention.days 30
```

`retention.days` has no screen: it sets how many days chats, Agent
conversations and chatbot logs are kept, and `0`, the default, keeps them
all. See [Chat](/docs/ai/chat.md#keeping-chats-for-a-limited-time).

## Maintenance

- `wp sleek ai cleanup completions` deletes stale polling files, as the hourly
  cron event does.
- `wp sleek ai cleanup retention` deletes chats older than the retention
  period now, as the daily action does.

## In the workspace assistant

The workspace assistant can run most of these commands for you while SleekAI
is installed: listing and reading, generating alt text, synchronizing
chatbots, changing settings and Agent capabilities. Before a command that
deletes something, such as `wp sleek ai chatbot delete`, it asks you to
confirm. It cannot store API keys, run `wp sleek ai generate`, create or
update chatbots from files, or run `wp sleek ai pt-sync`.
