Configuration Reference

AI Friend is configured via environment variables defined in .env (copied from .env.example).


Core Operational Settings

VariableDefault ValueDescription
DEBUGfalseEnables verbose debug logging and diagnostics.
ENVIRONMENTproductionDeployment mode (development / production). Production enforces secret presence.
MOCK_LLM_TEXTfalseSet to true for hermetic testing without running a live LLM model.
LLM_PROVIDERollamaLLM inference backend (ollama or anthropic).
OLLAMA_BASE_URLhttp://host.docker.internal:11434Endpoint for host-native Ollama server.
OLLAMA_MODELllama3.2:3bTarget conversational LLM model tag.

Database & Persistence Endpoints

VariableDefault ValueDescription
DATABASE_URLpostgresql://ai_friend:ai_friend@127.0.0.1:5432/ai_friendPrimary Postgres + pgvector connection string.
NEO4J_URIbolt://127.0.0.1:7687Relational Knowledge Graph Bolt endpoint.
NEO4J_USERneo4jNeo4j database username.
NEO4J_PASSWORDyour_secure_passwordNeo4j database password.
REDIS_URLredis://127.0.0.1:6379/0Ephemeral state cache and distributed turn lock broker.
QDRANT_HOST127.0.0.1Vector similarity engine host.
QDRANT_PORT6333Vector similarity engine HTTP port.

NATS JetStream Signal Mesh

VariableDefault ValueDescription
NATS_URLnats://127.0.0.1:4222Core message bus connection URI.
NATS_USERai_friendNATS client authentication username.
NATS_PASSWORDnats_secret_passwordNATS client authentication password.

Voice & Audio Configuration

VariableDefault ValueDescription
SOVITS_URLhttp://127.0.0.1:9880Self-hosted GPT-SoVITS synthesis service.
REF_AUDIO_PATHoutput/sample_en_gold.wavPath to reference WAV clip for voice cloning.
REF_TEXT"Hello, I am ready to talk."Exact transcript of reference voice audio clip.
REF_CALM_AUDIO_PATH(optional)Audio reference for Calm emotional state.
REF_WARM_AUDIO_PATH(optional)Audio reference for Warm emotional state.
REF_CONCERNED_AUDIO_PATH(optional)Audio reference for Concerned emotional state.
REF_EXCITED_AUDIO_PATH(optional)Audio reference for Excited emotional state.

LiveKit WebRTC Gateway

VariableDefault ValueDescription
LIVEKIT_URLws://127.0.0.1:7880Internal LiveKit SFU WebSocket endpoint.
LIVEKIT_PUBLIC_URLws://127.0.0.1:7880Publicly reachable LiveKit SFU endpoint for browser clients.
LIVEKIT_API_KEYdevkeyAPI authentication key for JWT token issuance.
LIVEKIT_API_SECRETsecretAPI authentication secret for JWT token issuance.

Cloud Fallback (Optional)

When running on resource-constrained hardware without local GPU/Ollama:

ini
LLM_PROVIDER=anthropic
ANTHROPIC_API_KEY=sk-ant-api03-...
ANTHROPIC_MODEL=claude-3-5-sonnet-20241022

[!NOTE] Enabling cloud fallback transmits conversation transcripts to a third party. Local inference is always the zero-leak default.