> ## Documentation Index
> Fetch the complete documentation index at: https://docs.q-uestionable.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration

> Set up the assistant with a local or cloud LLM provider

The assistant requires a provider and model to be configured before use. All other settings have sensible defaults.

## Provider and Model

Set the provider and model via CLI:

```bash theme={null}
qai config set assist.provider ollama
qai config set assist.model llama3.1
```

Or use the **Settings** page in the web UI — the Assistant section has provider and model selectors that save to the same configuration store.

The `assist.model` value is the model name without a provider prefix. The runtime builds the full `provider/model` string from `assist.provider` and `assist.model` automatically. See [LLM Provider Configuration](/config/providers) for the full list of supported providers.

### Environment Variable Override

You can set provider and model via environment variables instead of the config store:

<CodeGroup>
  ```bash Linux / macOS theme={null}
  export QAI_ASSIST_PROVIDER="ollama"
  export QAI_ASSIST_MODEL="llama3.1"
  ```

  ```powershell Windows PowerShell theme={null}
  $env:QAI_ASSIST_PROVIDER = "ollama"
  $env:QAI_ASSIST_MODEL = "llama3.1"
  ```
</CodeGroup>

Environment variables take precedence over stored settings.

## Base URL

If your assistant's LLM provider runs on a remote host or non-default port, set a custom base URL. This is useful when targeting a remote Ollama instance, LM Studio on another machine, or any custom OpenAI-compatible endpoint.

```bash theme={null}
qai config set assist.base_url http://inference-server:11434
```

Or via environment variable:

<CodeGroup>
  ```bash Linux / macOS theme={null}
  export QAI_ASSIST_BASE_URL="http://inference-server:11434"
  ```

  ```powershell Windows PowerShell theme={null}
  $env:QAI_ASSIST_BASE_URL = "http://inference-server:11434"
  ```
</CodeGroup>

You can also set it in the **Settings** page under the Assistant section.

<Note>
  `assist.base_url` controls only the assistant's LLM endpoint. It is completely independent of the base URLs used for testing targets (e.g., `ollama.base_url`). You can point the assistant at one Ollama instance while running inject campaigns against a different one.
</Note>

If not set, litellm uses the provider's default endpoint (e.g., `http://localhost:11434` for Ollama).

## Credentials

Cloud providers require an API key. Store credentials using the same keyring/environment variable pattern as other qai providers:

```bash theme={null}
# Store in OS keyring (masked input)
qai config set-credential anthropic

# Or set as environment variable
export ANTHROPIC_API_KEY="sk-ant-..."
```

Local providers — `ollama`, `lmstudio`, and `custom` — skip the credential check entirely. If you're using Ollama, no API key is needed; just ensure Ollama is running (`ollama serve`).

See [LLM Provider Configuration](/config/providers) for credential management details.

## Embedding Model

The knowledge base uses a sentence-transformers model to generate embeddings for retrieval. The default is `all-MiniLM-L6-v2`, which runs locally and requires no API key.

To override:

```bash theme={null}
qai config set assist.embedding_model "all-mpnet-base-v2"
```

Or via environment variable:

<CodeGroup>
  ```bash Linux / macOS theme={null}
  export QAI_ASSIST_EMBEDDING_MODEL="all-mpnet-base-v2"
  ```

  ```powershell Windows PowerShell theme={null}
  $env:QAI_ASSIST_EMBEDDING_MODEL = "all-mpnet-base-v2"
  ```
</CodeGroup>

<Note>
  The embedding model runs locally via sentence-transformers regardless of which LLM provider you use. If you change the embedding model, run `qai assist reindex` to rebuild the knowledge base with the new embeddings.
</Note>

## User Knowledge Directory

The assistant indexes user-provided reference files from `~/.qai/knowledge/` by default. To use a different directory:

```bash theme={null}
qai config set assist.knowledge_dir "/path/to/your/docs"
```

Or via environment variable:

<CodeGroup>
  ```bash Linux / macOS theme={null}
  export QAI_ASSIST_KNOWLEDGE_DIR="/path/to/your/docs"
  ```

  ```powershell Windows PowerShell theme={null}
  $env:QAI_ASSIST_KNOWLEDGE_DIR = "C:\path\to\your\docs"
  ```
</CodeGroup>

See [Knowledge Base](/assist/knowledge-base) for what to put in this directory.

## Configuration Summary

| Setting             | CLI                                     | Env Var                      | Default                   |
| ------------------- | --------------------------------------- | ---------------------------- | ------------------------- |
| Provider            | `qai config set assist.provider`        | `QAI_ASSIST_PROVIDER`        | None (required)           |
| Model               | `qai config set assist.model`           | `QAI_ASSIST_MODEL`           | None (required)           |
| Base URL            | `qai config set assist.base_url`        | `QAI_ASSIST_BASE_URL`        | None (provider default)   |
| Embedding model     | `qai config set assist.embedding_model` | `QAI_ASSIST_EMBEDDING_MODEL` | `all-MiniLM-L6-v2`        |
| Knowledge directory | `qai config set assist.knowledge_dir`   | `QAI_ASSIST_KNOWLEDGE_DIR`   | `~/.qai/knowledge/`       |
| Credentials         | `qai config set-credential <provider>`  | `{PROVIDER}_API_KEY`         | None (required for cloud) |

## Quick Start

Three commands to get started with a local model:

```bash theme={null}
qai config set assist.provider ollama
qai config set assist.model llama3.1
qai assist "what can qai test?"
```

For a cloud provider, add a credential first:

```bash theme={null}
qai config set assist.provider anthropic
qai config set assist.model claude-sonnet-4-20250514
qai config set-credential anthropic
qai assist "how do I scan an MCP server?"
```
