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

# Basic Configuration

> The handful of settings you actually need to get a Khora instance running.

Khora has many knobs. Most have sane defaults. To get a working instance, you only need storage connections and an LLM API key.

For the full surface (pool sizing, HNSW tuning, dream-phase toggles, telemetry), see [Full Configuration](/khora/configuration).

## The minimum

Set these in your `.env` and you're ready to call `Khora()`:

```dotenv theme={null}
# Storage (the production stack)
KHORA_DATABASE_URL=postgresql://khora:khora@localhost:5434/khora
KHORA_NEO4J_URL=bolt://neo4j:pleaseletmein@localhost:7688

# LLM (defaults to OpenAI gpt-4o-mini + text-embedding-3-small)
OPENAI_API_KEY=sk-...
```

Everything else has a default that works for development.

## Things you'll probably want to change next

### Generation model

`KHORA_LLM_MODEL` (default `gpt-4o-mini`) picks the model used for extraction and generation. Any litellm-supported provider works. Set `KHORA_LLM_API_KEY_ENV` to point at the matching env var.

```dotenv theme={null}
KHORA_LLM_MODEL=claude-3-5-sonnet-20241022
KHORA_LLM_API_KEY_ENV=ANTHROPIC_API_KEY
ANTHROPIC_API_KEY=sk-ant-...
```

### Embedding model

`KHORA_LLM_EMBEDDING_MODEL` (default `text-embedding-3-small`) controls embeddings. Changing the model usually means changing `KHORA_LLM_EMBEDDING_DIMENSION` to match. That requires a fresh schema, since vector columns are dimension-typed.

### Storage backend

`KHORA_STORAGE_BACKEND` defaults to `postgres`. For demos or single-user CLIs, switch to the embedded SQLite + LanceDB stack:

```dotenv theme={null}
KHORA_STORAGE_BACKEND=sqlite_lance
KHORA_STORAGE_SQLITE_LANCE_DB_PATH=./khora.db
```

Production traffic should stay on `postgres`. See the [embedded backends notes](/khora/configuration#embedded-backends) for the scale ceiling and known gaps.

### Retrieval mode

`KHORA_QUERY_DEFAULT_MODE` defaults to `hybrid` (vector and graph fused; the BM25 keyword channel is opt-in via `KHORA_QUERY_ENABLE_BM25_CHANNEL`). To force a single channel:

```dotenv theme={null}
KHORA_QUERY_DEFAULT_MODE=vector
```

Valid values: `vector`, `graph`, `hybrid`, `keyword`, `all`.

## Programmatic alternative

If env vars aren't your style, pass a `KhoraConfig` directly:

```python theme={null}
from khora import Khora, KhoraConfig
from khora.config.schema import LLMSettings

config = KhoraConfig(
    database_url="postgresql://khora:khora@localhost:5434/khora",
    neo4j_url="bolt://neo4j:pleaseletmein@localhost:7688",
    llm=LLMSettings(model="gpt-4o"),
)

async with Khora(config) as kb:
    ...
```

Programmatic values override environment variables.

## Next steps

<CardGroup cols={2}>
  <Card title="Full Configuration" icon={<span className="material-symbols-sharp">tune</span>} href="/khora/configuration">
    Every `KHORA_*` knob with defaults and tuning guidance.
  </Card>

  <Card title="Storage backends" icon={<span className="material-symbols-sharp">database</span>} href="/khora/storage-backends">
    Postgres + Neo4j vs SQLite + LanceDB: which to pick, what each gives up.
  </Card>
</CardGroup>
