Skip to content

Settings

This page lists every BUB_* environment variable read by Bub, the YAML key under ~/.bub/config.yml that maps to it, and the pydantic-settings class that defines it. For deployment recipes see Operate › Configure.

Bub resolves a setting value in this order, highest priority first:

  1. CLI flag (e.g. --workspace, --project, --enable-channel).
  2. Environment variable (BUB_*).
  3. .env values loaded during CLI startup or by settings classes that declare env_file=".env".
  4. ~/.bub/config.yml entry, loaded by bub.configure.load.
  5. Field default declared on the Settings subclass.

Verified via Settings.settings_customise_sources in src/bub/configure.py, which returns (env_settings, dotenv_settings, init_settings, file_secret_settings) — env beats .env, and both beat the dict produced from YAML when ensure_config(...) calls model_validate.

PathSource
~/.bub/config.ymlDEFAULT_CONFIG_FILE in src/bub/framework.py.
Override via BubFramework(config_file=...)Constructor argument.

~/.bub/ is also the default value of bub.home, controlled by the BUB_HOME environment variable (src/bub/__init__.py). BUB_HOME affects bub.home consumers such as history, tapes, and the managed plugin project; the default config file path remains ~/.bub/config.yml unless an embedding application passes BubFramework(config_file=...).

Env varDefaultYAML keyRead byDescription
BUB_HOME~/.bubbub.home (bub/__init__.py)Root directory for history, tape store, and the managed plugin project. Does not move the default config file.
BUB_PROJECTBUB_HOME/bub-project, or ~/.bub/bub-project when BUB_HOME is unset--project option in bub install / uninstall / updatePlugin project directory; created on first install via uv init.

Defined in src/bub/builtin/settings.py:

class AgentSettings(Settings):
    model_config = SettingsConfigDict(env_prefix="BUB_", env_parse_none_str="null", extra="ignore")
    model: str = DEFAULT_MODEL  # "openrouter:openrouter/free"
    fallback_models: list[str] | None = None
    api_key: str | dict[str, str] | None = Field(default_factory=provider_specific("api_key"))
    api_base: str | dict[str, str] | None = Field(default_factory=provider_specific("api_base"))
    api_format: Literal["completion", "responses", "messages"] = "completion"
    max_steps: int = 50
    max_tokens: int = DEFAULT_MAX_TOKENS  # 16384
    model_timeout_seconds: int | None = None
    client_args: dict[str, Any] | None = None
    verbose: int = Field(default=0, ge=0, le=2)

Loaded under the YAML root section.

Env varDefaultYAML keyDescription
BUB_MODELopenrouter:openrouter/freemodelDefault model identifier (provider:model_name).
BUB_FALLBACK_MODELSnullfallback_modelsOptional list of fallback model identifiers.
BUB_API_KEYunsetapi_keyDefault API key. May also be a JSON object mapping provider → key.
BUB_API_BASEunsetapi_baseDefault API base URL or per-provider mapping.
BUB_<PROVIDER>_API_KEYunsetProvider-scoped API key, e.g. BUB_OPENAI_API_KEY. Collected by the provider_specific("api_key") factory.
BUB_<PROVIDER>_API_BASEunsetProvider-scoped API base URL, e.g. BUB_OPENROUTER_API_BASE.
BUB_API_FORMATcompletionapi_formatOne of completion, responses, messages.
BUB_MAX_STEPS50max_stepsMaximum agent loop iterations per turn.
BUB_MAX_TOKENS16384max_tokensMaximum tokens per model call.
BUB_MODEL_TIMEOUT_SECONDSnullmodel_timeout_secondsPer-call timeout in seconds.
BUB_CLIENT_ARGSnullclient_argsExtra kwargs passed to the underlying model client (JSON / dict).
BUB_VERBOSE0verboseLogging verbosity level (02).

Provider-specific defaults are gathered at startup by scanning os.environ for ^BUB_(.+)_(API_KEY|API_BASE)$ and lowercasing the captured provider name.

Defined in src/bub/channels/manager.py:

class ChannelSettings(Settings):
    model_config = SettingsConfigDict(env_prefix="BUB_", extra="ignore", env_file=".env")
    enabled_channels: str = "all"
    debounce_seconds: float = 1.0
    max_wait_seconds: float = 10.0
    active_time_window: float = 60.0
    stream_output: bool = False

Loaded under the YAML root section.

Env varDefaultYAML keyDescription
BUB_ENABLED_CHANNELSallenabled_channelsComma-separated channel names, or all (excludes cli). Overridden per-invocation by bub gateway --enable-channel.
BUB_DEBOUNCE_SECONDS1.0debounce_secondsMinimum gap between two messages from the same channel when the channel sets needs_debounce=True.
BUB_MAX_WAIT_SECONDS10.0max_wait_secondsHard cap for the debounce wait.
BUB_ACTIVE_TIME_WINDOW60.0active_time_windowWindow in seconds during which a session stays “active” for buffered handling.
BUB_STREAM_OUTPUTfalsestream_outputStream model output to channels in real time. bub chat forces True; bub gateway honors the setting.

Defined in src/bub/channels/telegram.py:

@config(name="telegram")
class TelegramSettings(Settings):
    model_config = SettingsConfigDict(env_prefix="BUB_TELEGRAM_", extra="ignore", env_file=".env")
    token: str = ""
    allow_users: str | None = None
    allow_chats: str | None = None
    proxy: str | None = None

Loaded under the YAML telegram: section.

Env varDefaultYAML key (telegram.*)Description
BUB_TELEGRAM_TOKEN""tokenTelegram bot token. Required to enable the channel.
BUB_TELEGRAM_ALLOW_USERSunsetallow_usersComma-separated allowlist of Telegram user IDs. Empty means no restriction.
BUB_TELEGRAM_ALLOW_CHATSunsetallow_chatsComma-separated allowlist of Telegram chat IDs. Empty means no restriction.
BUB_TELEGRAM_PROXYunsetproxyProxy URL for the Telegram API, e.g. http://user:pass@host:port or socks5://host:port.

See Operate › Channels › Telegram for deployment notes.

bub login openai reads one non-BUB_* env var:

Env varDefaultRead byDescription
CODEX_HOME~/.codexbub login openai (src/bub/builtin/auth.py)Directory to store Codex OAuth auth.json. Overridden by --codex-home.

Plugins can register their own Settings subclass via the @config(name="...") decorator (see Build › Plugins). The decorator records the class under CONFIG_MAP[name], which configure.validate then validates and ensure_config reads. The YAML key matches the registered name; env vars follow whatever env_prefix the subclass declares.