Skip to main content
Freesona has two configuration layers. The .env file handles startup configuration — credentials, provider selection, file paths, and optional integration keys. This file is read once when the bot launches and requires a restart to change. The runtime config layer handles tunable behavior values — polling intervals, timeouts, generation pacing — via /config commands that take effect immediately without a restart.

Environment Variables

Copy .env.sample to .env and fill in your values before launching the bot:
cp .env.sample .env

Required

These three variables must be set. The bot refuses to start if any of them is missing or still holds a placeholder value.
VariableDescription
BOT_TOKENYour Discord bot token from the Developer Portal
CHANNEL_IDNumeric channel ID (Discord snowflake) where the bot posts its startup message
AI_PROVIDERActive AI provider: gemini, openai, ollama, nim, azure, groq, or openrouter

AI Provider Keys

You only need to set the key for the provider you’ve selected in AI_PROVIDER. Leave the others blank.
ProviderAI_PROVIDER valueVariable(s) to setNotes
Google GeminigeminiGOOGLE_API_KEYDefault provider
OpenAIopenaiOPENAI_API_KEYAlso set OPENAI_BASE_URL (default: https://api.openai.com/v1/chat/completions)
OllamaollamaOLLAMA_BASE_URLDefaults to http://localhost:11434/api/chat if not set
NVIDIA NIMnimNVIDIA_API_KEYAlso set NVIDIA_NIM_BASE_URL (default: https://integrate.api.nvidia.com/v1/chat/completions)
Azure AI FoundryazureAZURE_AI_KEY + AZURE_AI_BASE_URLAZURE_AI_BASE_URL is your Azure AI Foundry endpoint
GroqgroqGROQ_API_KEYBase URL defaults to https://api.groq.com/openai/v1/chat/completions
OpenRouteropenrouterOPENROUTER_API_KEYOptionally set OPENROUTER_SITE_URL and OPENROUTER_SITE_NAME
You can also set MODEL_NAME to override the default model for your chosen provider, or use AI_PROVIDER_MODEL to set a per-provider model override that persists across provider switches.

Optional Integrations

These variables unlock specific features. The bot starts and runs normally without them — the corresponding commands will simply be unavailable or fall back to a different method.
VariableDescription
MVSEP_API_KEYRequired for audio stem separation via the ~separate command (MVSEP module)
MVSEP_WEBHOOK_URLPublic URL for MVSEP task completion callbacks (e.g. https://your-host.example.com/webhooks/mvsep)
MVSEP_WEBHOOK_SEND_MAIL_ON_ERRORSet to true to have MVSEP send an email on task error (default: false)
WOLFRAM_APPID_SHORTWolfram Short Answer API key used by the ~math command for direct computation
WOLFRAM_APPID_LLMWolfram LLM API key used as a fallback if the short answer API doesn’t return a result
LOGOKIT_TOKENLogoKit API token for fetching publication logos in RSS feed embeds
GOOGLE_SEARCH_API_KEY + SEARCH_ENGINE_IDLegacy fallback for the /search command when the primary search method is unavailable
CHROMA_COLLECTIONChromaDB collection name for the knowledge base (default: freesona)
CHROMA_PERSIST_DIRECTORYLocal path for ChromaDB vector storage (default: ./.chroma)
BOT_NAMEDisplay name used in startup messages and certain response contexts (default: Freesona)
HTTP_PORTPort for the built-in health check and webhook server (default: 10000)

File Paths

Freesona stores several mutable files: a runtime config file, a user memory database, a warnings database, and persona files. The correct paths depend on where you’re hosting the bot.
VariableLocal defaultCloud (Railway / Render)
CONFIG_FILE_PATHconfig.json/data/config.json
MEMORY_FILE_PATHmemory.db/data/memory.db
WARNINGS_FILE_PATHwarnings.db/data/warnings.db
AI_PERSONA_FILEpersona.txt/data/persona.txt
AI_PERSONA_JSON_FILEpersona.json/data/persona.json
AI_PERSONAS_FILEpersonas.json/data/personas.json
On cloud hosts without a persistent volume, file changes don’t survive a redeployment — the container resets to the image state. Mount a persistent volume at /data and switch to the /data/ paths in your .env to keep your config, memory, warnings, and persona across deploys.

Runtime Config

The /config command group lets the bot owner inspect and adjust tunable behavior values while the bot is running. Changes take effect immediately — no restart needed. These commands require you to be the bot owner (the account that owns the Discord application in the Developer Portal).

Commands

/config list
/config show [key]
/config set <key> <value>
/config reset <key>
  • /config list — Prints all configurable keys with their descriptions and current defaults.
  • /config show [key] — Shows the current value and default for one key, or all keys if you omit the argument.
  • /config set <key> <value> — Updates a key to a new value immediately. The bot converts the value to the correct type (int, float, bool, or string) based on the key’s default type.
  • /config reset <key> — Removes the override and restores the key to its compiled-in default.

Configurable Keys

These are the configurable keys and the defaults the bot ships with.
KeyTypeDefaultDescription
mvsep_poll_intervalint10Seconds between MVSEP API polling checks while waiting for a stem separation task
mvsep_poll_timeoutint600Maximum seconds to wait for an MVSEP task before giving up
ytdlp_subprocess_timeoutint300Maximum seconds for a yt-dlp subprocess to complete before it is killed
ytdlp_compress_target_mbfloat9.5Target file size in MB when compressing video for Discord upload
generation_split_min_lengthint280Minimum character length before a long AI response is split into multiple messages
generation_split_delay_basefloat1.2Base delay in seconds between consecutive message segments
generation_split_delay_per_charfloat0.012Additional delay added per character in a segment (creates natural pacing for longer chunks)
generation_split_delay_maxfloat3.5Maximum delay in seconds between any two segments, regardless of length
generation_rate_limitfloat5Minimum seconds between successive AI generation calls (per-bot rate limit)
debounce_secondsfloat1.2Seconds to wait after a user’s last message before generating a reply (collapses rapid-fire messages)
autonomy_cooldown_secondsint120Per-channel cooldown in seconds before the bot can autonomously respond in that channel again
autonomy_user_cooldownint60Per-user cooldown in seconds before the bot can autonomously respond to the same user again

Example Usage

/config show mvsep_poll_interval
/config set generation_rate_limit 2.0
/config reset ytdlp_compress_target_mb
Use /dumpconfig to see the full contents of your current config.json in one shot — useful for verifying the state of all settings at once.

config.json

config.json is the bot’s runtime state file. Freesona reads it on startup and writes to it whenever you use commands that change persistent settings. You don’t need to edit this file manually — the Discord commands are the intended interface. A fresh config.json starts from config.sample.json and contains only:
config.json
{
  "prefix": "~",
  "chat_channel_id": null
}
As you use the bot, it accumulates additional fields:
FieldSet byDescription
prefix~prefix <new_prefix>The active prefix for all prefix commands (max 5 characters)
chat_channel_id/setchannelChannel where the bot responds to general (non-mention) messages
conversation_response_mode/chatmodeHow the bot decides to respond: all, mentions, or smart
autonomy_* settings/autonomyWhether autonomy mode is on, and its frequency setting
enabled_modules/module enable / /module disablePer-module on/off state persisted across restarts
provider / provider_model/provider set / /model setActive AI provider and model overrides
timezone/settimezoneIANA timezone string for time-sensitive features
rss_feeds/rss add / /rss removeConfigured RSS/Atom feed subscriptions
You don’t edit config.json directly. Use the Discord commands — ~prefix, /setchannel, /autonomy, /module, /provider, /model, /settimezone, and /rss — to change these values. The bot writes the file automatically.