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

# moorcheh configure

> Set embedding provider, model, and API keys; saved to ~/.moorcheh/config.json.

## Overview

Interactive setup for **text embeddings** and the **LLM used by `/answer`**: provider (Ollama, OpenAI, or Cohere), model from a curated list, and API key for cloud providers. Settings are written to `~/.moorcheh/config.json`.

`moorcheh configure` only updates that file. It does **not** restart a running Docker stack. After you change embedding or LLM settings, stop and start the server so the container picks up new environment variables (see [Apply changes](#apply-changes-after-configure)).

You can run this before or instead of answering prompts during the first `moorcheh up`.

## Synopsis

```bash theme={null}
moorcheh configure [--force]
```

## Options

| Flag      | Description                                            |
| --------- | ------------------------------------------------------ |
| `--force` | Re-run the wizard even if `config.json` already exists |

## What it asks

1. **Provider** — `ollama`, `openai`, or `cohere` (default in wizard: `ollama`)
2. **Model** — numbered menu per provider (see [Embedding providers](/on-prem/guides/embedding-providers))
3. **API key** — required for `openai` and `cohere` (hidden input); not asked for `ollama`
4. **LLM** — provider and model for `/answer` (defaults to same provider; Ollama LLM default: `qwen2.5`)

`base_url` is saved from release defaults (edit `config.json` to point at a proxy or alternate endpoint).

<Warning>
  If you already have data under `~/.moorcheh/data` (namespaces or uploaded documents), changing the **embedding provider or model** can break **search** and **RAG `/answer`** for existing **text** namespaces. Those vectors were built with your previous embedding model. The wizard detects existing data, warns you, and asks for confirmation before saving new embedding settings. Re-upload text documents after a change, or keep your current embedding config. Changing only the **LLM** (answer model) does not require re-uploading data, but you still need to restart the server (below).
</Warning>

## Apply changes after configure

If Moorcheh is already running and you change **embedding** or **LLM** settings (via `moorcheh configure --force` or by editing `config.json`), recreate the stack so the server container receives the new `EMBEDDING_*` and `LLM_*` values:

```bash theme={null}
moorcheh down
moorcheh up
moorcheh status   # confirm embedding_provider / llm_provider in health
```

Skipping this step leaves the old provider and models active inside Docker even though `config.json` was updated.

## Ollama-specific behavior

| Situation                                              | What happens                                                       |
| ------------------------------------------------------ | ------------------------------------------------------------------ |
| Ollama **already running** on `http://127.0.0.1:11434` | Checks for the model; offers to pull if missing                    |
| Ollama **not running**                                 | Saves config; tells you model will be pulled on next `moorcheh up` |

Configure does **not** start Docker or the bundled Ollama container. Use `moorcheh up` for that.

## Examples

```bash theme={null}
# First-time setup
moorcheh configure

# Change provider or model (wizard warns if ~/.moorcheh/data already has namespaces)
moorcheh configure --force

# Apply to a running server — required after any config change
moorcheh down
moorcheh up
```

## Config file example

```json theme={null}
{
  "embedding": {
    "provider": "openai",
    "model": "text-embedding-3-small",
    "api_key": "sk-...",
    "base_url": "https://api.openai.com/v1"
  },
  "llm": {
    "provider": "openai",
    "model": "gpt-4o-mini",
    "api_key": "sk-...",
    "base_url": "https://api.openai.com/v1"
  }
}
```

Full field reference: [Configuration file](/on-prem/guides/embedding-providers#configuration-file).

<Note>
  On Unix, `config.json` is created with mode `600`. Do not commit this file or share it; it may contain API keys.
</Note>

## Non-interactive overrides

You can skip the wizard and set values on `moorcheh up`:

```bash theme={null}
moorcheh up --embedding-provider cohere --embedding-model embed-v4.0 --embedding-api-key "$COHERE_API_KEY"
```

Or use `--no-configure` after `config.json` exists.

## Related

* [Embedding providers](/on-prem/guides/embedding-providers)
* [moorcheh up](/on-prem/cli/runtime/up)
* [Prerequisites](/on-prem/prerequisites)
