Skip to main content
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.

The minimum

Set these in your .env and you’re ready to call Khora():
# 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.
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:
KHORA_STORAGE_BACKEND=sqlite_lance
KHORA_STORAGE_SQLITE_LANCE_DB_PATH=./khora.db
Production traffic should stay on postgres. See the embedded backends notes for the scale ceiling and known gaps.

Retrieval mode

KHORA_QUERY_DEFAULT_MODE defaults to hybrid (vector, graph, and keyword fused). To force a single channel:
KHORA_QUERY_DEFAULT_MODE=vector
Valid values: vector, graph, hybrid, all.

Programmatic alternative

If env vars aren’t your style, pass a KhoraConfig directly:
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

tune

Full Configuration

Every KHORA_* knob with defaults and tuning guidance.
database

Storage backends

Postgres + Neo4j vs SQLite + LanceDB: which to pick, what each gives up.