Skip to content

Configuration

Bub resolves configuration in this order (highest priority first):

  1. Environment variables (BUB_ prefix);
  2. .env in the current workspace;
  3. ~/.bub/config.yml (created by bub onboard).

Unset fields use their defaults. See the Settings reference for all options.

Run the following command in your terminal to start the interactive setup wizard and generate ~/.bub/config.yml:

Terminal window
bub onboard

Now inspect ~/.bub/config.yml. Here is an example of what it looks like:

~/.bub/config.yml
model: openrouter:openrouter/free
api_key: sk-or-...
telegram:
token: "123456789:your-telegram-bot-token"
allow_users: "123456789,your_username"

Common environment variables:

Variable Description
BUB_MODEL Model identifier in provider:model format (e.g. openrouter:openrouter/free, codex:<model>)
BUB_API_KEY API key for the current provider (not needed with bub login)
BUB_API_BASE Provider API base URL; leave blank for the default endpoint
BUB_HOME Runtime data directory (default ~/.bub)
BUB_<PROVIDER>_API_KEY Provider-specific API key, e.g. BUB_OPENROUTER_API_KEY
BUB_<PROVIDER>_API_BASE Provider-specific API base URL

See the Settings reference for the full table.

Set fallback_models to try backup models in order when the primary model is unavailable:

~/.bub/config.yml
model: openai:gpt-5-mini
fallback_models:
- openrouter:openrouter/free

Each candidate provider requires valid credentials. Fallbacks apply only when creating a client or opening the request stream fails; errors after streaming has started do not retry on another model to avoid duplicate tool side effects. See Models and fallback.

If you want to use Bub as a Telegram bot, configure the built-in Telegram channel in .env:

.env
BUB_TELEGRAM_TOKEN=123456789:your-telegram-bot-token
BUB_TELEGRAM_ALLOW_USERS=123456789,your_username
BUB_TELEGRAM_ALLOW_CHATS=-1001234567890
BUB_TELEGRAM_PROXY=http://127.0.0.1:7890 # optional

See Telegram gateway for details.

Now try talking to Bub with a one-off prompt to verify your setup:

Terminal window
$ bub run "Can you introduce yourself?"
[cli:local]
I'm a virtual assistant designed to support a wide range of tasks...