Skip to main content
Freesona reads configuration from a .env file at startup. Copy .env.sample to .env and fill in the values you need. Variables you leave blank are ignored unless the feature that depends on them is used.

Required

These three variables must be set for the bot to start.
VariableDescription
BOT_TOKENYour Discord bot token from the Developer Portal
CHANNEL_IDDiscord channel ID where the bot sends startup messages
HTTP_PORTPort for the built-in FastAPI health/webhook server (default: 10000)

AI Provider

VariableDescription
AI_PROVIDERActive provider: gemini, openai, ollama, nim, azure, groq, or openrouter
AI_PROVIDER_MODELOverride the default model for the chosen provider (leave blank to use the provider default)
MODEL_NAMEDefault model name used when AI_PROVIDER=gemini (e.g. gemini-flash-lite-latest)
BOT_NAMEDisplay name used in startup and status messages (default: Freesona)
AI_PERSONAInline persona text used as the bot’s system instruction (e.g. You are a helpful assistant.). Overridden by AI_PERSONA_JSON_FILE or AI_PERSONA_FILE if those are set.

Provider API Keys

Set only the key for the provider you chose in AI_PROVIDER. You do not need all of these.
VariableProvider
GOOGLE_API_KEYGemini (AI_PROVIDER=gemini)
OPENAI_API_KEYOpenAI (AI_PROVIDER=openai)
OPENAI_BASE_URLOpenAI endpoint (default: https://api.openai.com/v1/chat/completions)
OLLAMA_BASE_URLOllama (AI_PROVIDER=ollama, default: http://localhost:11434/api/chat)
NVIDIA_API_KEYNVIDIA NIM (AI_PROVIDER=nim); also accepted as NIM_API_KEY
NVIDIA_NIM_BASE_URLNVIDIA NIM endpoint (default: https://integrate.api.nvidia.com/v1/chat/completions)
AZURE_AI_KEYAzure AI Foundry (AI_PROVIDER=azure)
AZURE_AI_BASE_URLYour Azure AI Foundry endpoint URL
GROQ_API_KEYGroq (AI_PROVIDER=groq)
GROQ_BASE_URLGroq endpoint (default: https://api.groq.com/openai/v1/chat/completions)
OPENROUTER_API_KEYOpenRouter (AI_PROVIDER=openrouter)
OPENROUTER_BASE_URLOpenRouter endpoint (default: https://openrouter.ai/api/v1/chat/completions)
OPENROUTER_SITE_URLYour site URL sent in OpenRouter attribution headers
OPENROUTER_SITE_NAMEYour site name sent in OpenRouter attribution headers (default: Freesona)

Optional Integrations

Set these only if you want to use the corresponding feature.
VariableDescription
MVSEP_API_KEYMVSEP API key for the ~separate / /separate audio separation command
MVSEP_WEBHOOK_URLPublic URL for MVSEP completion callbacks (e.g. https://your-host.example.com/webhooks/mvsep); falls back to polling every 10 seconds if unset
MVSEP_WEBHOOK_SEND_MAIL_ON_ERRORSend an email on MVSEP error (default: false)
WOLFRAM_APPID_SHORTWolfram Short Answer API key for ~math (primary)
WOLFRAM_APPID_LLMWolfram LLM API key for ~math (fallback when the Short Answer API returns no result)
GOOGLE_SEARCH_API_KEYLegacy Google Custom Search key — fallback for /search when Gemini grounding is unavailable
SEARCH_ENGINE_IDLegacy Google Custom Search engine ID — required alongside GOOGLE_SEARCH_API_KEY
LOGOKIT_TOKENLogoKit API key for fetching publisher logos in RSS feed embeds
CHROMA_COLLECTIONChromaDB collection name (default: freesona)
CHROMA_PERSIST_DIRECTORYPath to the ChromaDB vector store directory (default: ./.chroma)

File Paths

Freesona persists its state — persona, memory, warnings, and config — to local files. The right path depends on where you’re running the bot.
VariableLocal defaultCloud (Railway / Render)
AI_PERSONA_FILEpersona.txt/data/persona.txt
AI_PERSONA_JSON_FILEpersona.json/data/persona.json
AI_PERSONAS_FILEpersonas.json/data/personas.json
CONFIG_FILE_PATHconfig.json/data/config.json
MEMORY_FILE_PATHmemory.db/data/memory.db
WARNINGS_FILE_PATHwarnings.db/data/warnings.db
AI_PERSONA_JSON_FILE takes precedence over AI_PERSONA_FILE. If a persona.json is found it is loaded first; persona.txt is only used as a fallback for existing installs.
On Railway and Render, you must mount a persistent volume at /data and use the /data/ paths shown above. Without a persistent volume, all data — including your persona, conversation memory, warnings, and runtime config — is wiped on every redeploy.