Skip to main content
SAFIA is configured through a .env file created during safia setup. You can re-open that file at any time using the interactive editor, or edit it directly with a text editor. All variables below correspond to entries in .env.
The sections below group every supported variable by function. Variables marked required must be set before SAFIA will start successfully.

Required

These four variables are the minimum needed to run the bot. A minimal .env for getting started:
Never commit your .env file to version control. It contains credentials that grant full access to your bot and LLM account.

LLM Settings

SAFIA supports four LLM providers out of the box. Each provider’s base URL is set automatically — you only need to supply LLM_PROVIDER and LLM_API_KEY.
The Lunos base URL (https://api.lunosrouter.com/v1) is set automatically.
Speech-to-text always uses Whisper via Groq, regardless of which LLM provider you select for chat. If you use a non-Groq LLM provider, set GROQ_API_KEY separately to enable voice message transcription.
Two optional integrations expand what SAFIA can do:

Database & Cache

SAFIA stores all financial data in a relational database. Chat history, price caches, and per-user rate limits run in an in-memory cache that is transparently persisted to SQLite, so state survives restarts without an external cache server. SQLite (default) — no additional setup required. The database file is created automatically at data/safia.db. PostgreSQL — swap DATABASE_URL with an asyncpg connection string:
SQLite is the recommended choice for personal use. Switch to PostgreSQL only if you plan to run SAFIA for multiple users concurrently or need point-in-time backups.

Admin Dashboard

The admin dashboard runs at http://127.0.0.1:5454 and provides usage metrics, a user registry, and knowledge base management. Protect it with HTTP Basic Auth before using it.
If ADMIN_USERNAME and ADMIN_PASSWORD are left empty, the dashboard is accessible without authentication. Always set these before exposing port 5454 beyond localhost.

Knowledge Base

The knowledge base (RAG) lets you upload documents that SAFIA uses to ground its responses. Embeddings and vector storage run locally by default. Optional: Remote Qdrant
Optional: Remote Embeddings
The local embedding model downloads automatically on first use and runs on CPU via ONNX Runtime. No GPU is required. Switching to remote embeddings is only necessary if your machine has very limited disk space or you want to use a higher-dimensional model.

Reminders

SAFIA can send scheduled reminders for price alerts, news digests, and portfolio summaries.

Rate Limiting

SAFIA enforces a daily message limit per user to manage LLM API costs.
Increase DAILY_MESSAGE_LIMIT if you are the sole user of your SAFIA instance and want unrestricted access. Be mindful of your LLM provider’s rate limits and billing when raising this value.