Reference

Configuration

SOBA configuration file, CLI flags, environment variables, and precedence rules.

SOBA reads configuration from several places with a clear priority: CLI flags > environment variables > config.json > defaults. This guide explains the main options and how they work together.


1. Configuration file

The configuration file is ~/.soba/config.json. SOBA creates it on first run, or you can write it by hand.

{
  "baseUrl": "https://api.deepseek.com",
  "apiKey": "YOUR_API_KEY",
  "model": "deepseek/deepseek-v4-flash",
  "maxOutputTokens": 8192,
  "maxCompletionTokens": 0,
  "reasoning": { "mode": "provider_default" },
  "contextWindow": 65536,
  "temperature": 0.7,
  "maxAgentIterations": 0,
  "maxStalledIterations": 4,
  "maxRunMinutes": 0,
  "bashMaxTimeoutSeconds": 300,
  "sessionDir": "~/.soba/sessions",
  "lang": "en",
  "theme": "graphite",
  "compaction": {
    "auto": true,
    "compactOnTurnComplete": true,
    "compactOnMilestone": true,
    "minTokensForAutoCompact": 32000,
    "minReclaimableTokens": 12000,
    "minSavingsRatio": 0.25,
    "keepRecentTokens": 20000,
    "safetyReserveTokens": 8192,
    "autoCompactThresholdRatio": 0.8,
    "timeoutMs": 15000
  },
  "registry": {
    "activeProvider": "deepseek",
    "activeModelId": "deepseek-v4-flash",
    "customProviders": []
  }
}

Minimal configuration:

{
  "apiKey": "YOUR_API_KEY",
  "model": "deepseek/deepseek-v4-flash"
}

2. Options

2.1. Provider

OptionTypeDefaultDescription
baseUrlstring""Base URL of the OpenAI-compatible API. If empty, SOBA derives it from the active provider
apiKeystring""API key
modelstring""Full model identifier, for example deepseek/deepseek-v4-flash or openrouter/anthropic/claude-sonnet-4.6

2.2. Model response

OptionTypeDefaultDescription
maxOutputTokensnumber8192Max output tokens per model response. The default is a placeholder; the real value is read from the active model definition when available
maxCompletionTokensnumber0Maximum output plus reasoning tokens where the transport supports it. 0 leaves the provider default in place
reasoningReasoningSelection{ "mode": "provider_default" }Requested reasoning policy. The effective policy is recomputed from the active model's capabilities
contextWindownumber128000Model context window. Provider metadata wins when available; the fallback is marked as assumed in the UI
temperaturenumber0.7Sampling temperature, from 0 to 2

2.3. Runtime safety

OptionTypeDefaultDescription
maxAgentIterationsnumber0Emergency limit for model calls in one task. 0 means unlimited
maxStalledIterationsnumber4Consecutive no-progress iterations before SOBA treats the loop as stalled
maxRunMinutesnumber0Max task duration in minutes. 0 means unlimited
bashMaxTimeoutSecondsnumber300Upper timeout limit for one bash tool call

2.4. Sessions

OptionTypeDefaultDescription
sessionDirstring~/.soba/sessionsDirectory for JSONL session files

2.5. Interface

OptionTypeDefaultDescription
lang"en" | "ru" | "zh""en"Default interface language
themeTuiThemeName"graphite"TUI theme: graphite, vscode, github, aurora, synthwave, paper, forest, highContrast, clay, operator, or ink

3. Environment variables

Environment variables override config.json.

VariableConfig optionDescription
SOBA_BASE_URLbaseUrlAPI base URL
SOBA_API_KEYapiKeyAPI key
SOBA_MODELmodelModel identifier
SOBA_MAX_OUTPUT_TOKENSmaxOutputTokensOutput token limit
SOBA_MAX_TOKENSmaxOutputTokensDeprecated alias for SOBA_MAX_OUTPUT_TOKENS
SOBA_MAX_COMPLETION_TOKENSmaxCompletionTokensReasoning token limit
SOBA_REASONING_EFFORTreasoningdefault, none, minimal, low, medium, high, xhigh, or max
SOBA_REASONING_BUDGETreasoningPositive numeric reasoning budget
SOBA_REASONING_ENABLEDreasoningtrue/1 or false/0 for toggle-based models
SOBA_CONTEXT_WINDOWcontextWindowContext window size
SOBA_MAX_AGENT_ITERATIONSmaxAgentIterationsIteration limit
SOBA_MAX_STALLED_ITERATIONSmaxStalledIterationsNo-progress iterations before stall recovery
SOBA_MAX_RUN_MINUTESmaxRunMinutesMax task duration in minutes
SOBA_BASH_MAX_TIMEOUT_SECONDSbashMaxTimeoutSecondsMax timeout for one bash tool call
SOBA_LANGlangInterface language
SOBA_THEMEthemeTUI theme
SOBA_AUTO_COMPACTcompaction.autofalse or 0 disables auto-compaction
SOBA_SOUND_ENABLEDsound.enabledEnable or disable sound notifications
SOBA_SOUND_VOLUMEsound.volumeVolume from 0.0 to 1.0
SOBA_SOUND_REPEATsound.repeatModerepeat/true/1 repeats, once/false/0 plays once
SOBA_CONFIG_PATHconfig file pathUse a non-default config file
NO_COLORoutput colorsDisable ANSI colors, same effect as --no-color
DEEPSEEK_API_KEYDeepSeek provider keyDeepSeek API key
MOONSHOT_API_KEYKimi provider keyMoonshot Kimi API key
DASHSCOPE_API_KEYAlibaba provider keyAlibaba Qwen API key
OPENROUTER_API_KEYOpenRouter provider keyOpenRouter API key
OPENAI_API_KEYOpenAI provider keyOfficial OpenAI API key

4. CLI flags

CLI flags have the highest priority.

4.1. Run modes

FlagShortDescription
--interactive-iStart interactive TUI mode
--continue-cContinue the latest session
--resume-rResume a session through the interactive picker
--session <id>-sContinue a specific session by ID

4.2. Provider and model

FlagShortDescription
--model <id>-mOverride model identifier
--api-key <key>-kOverride API key
--base-url <url>Override API base URL

4.3. Limits

FlagDescription
--max-output-tokens <n>Output token limit
--max-tokens <n>Deprecated alias for --max-output-tokens
--max-completion-tokens <n>Reasoning/thinking token limit
--reasoning-effort <level>Requested effort: default, none, minimal, low, medium, high, xhigh, or max
--reasoning-budget <n>Positive numeric reasoning budget
--reasoning-enabledEnable reasoning for a toggle-based model
--no-reasoningDisable reasoning when the model allows it
--context-window <n>Override model context window
--budget <n>Set total token budget for the task
--max-agent-iterations <n>Emergency iteration limit
--max-stalled-iterations <n>No-progress iterations before stall recovery
--max-run-minutes <n>Max task duration in minutes
--bash-max-timeout-seconds <n>Max timeout for one bash tool call

4.4. Control and debugging

FlagDescription
--no-sessionInteractive mode without persisting a session
--no-colorDisable colors
--no-streamDisable streaming
--streamEnable streaming explicitly
--debugWrite loop decisions into the JSONL session file
--no-auto-compactDisable proactive compaction, same as compaction.auto: false
--lang <locale>Override interface language: en, ru, or zh
--theme <name>Override TUI theme

4.5. Info

FlagShortDescription
--help-hShow help
--version-vShow version

5. Provider configuration

SOBA v0.6.x uses a provider registry. See Providers and models for details.

Built-in providers:

IDNameBase URL
deepseekDeepSeekhttps://api.deepseek.com
kimiMoonshot Kimi (K2 for code)https://api.moonshot.cn/v1
alibabaAlibaba Qwen (Singapore)https://dashscope-intl.aliyuncs.com/compatible-mode/v1
openrouterOpenRouterhttps://openrouter.ai/api/v1
openai-officialOpenAI Responses APIhttps://api.openai.com/v1

Models are discovered dynamically through GET /models and cached in the current process. Opening the model picker in the TUI with F2 or /model refreshes built-in providers.

Discovery also resolves model limits and reasoning controls when the provider publishes them. Explicit user limits take priority, followed by runtime/route/model metadata, maintained exact-model profiles, and finally conservative assumed values. SOBA does not infer capabilities from a model name. An assumed context window is shown with ~ in the model picker and produces a warning when selected.

Add a custom provider:

soba provider add my-llm \
  --base-url https://api.myllm.com/v1 \
  --api-key-env MY_LLM_KEY \
  --model my-code-model="My Code Model",128000,8192

Custom providers are saved in registry.customProviders.

Model-specific wire compatibility is declared in a complete provider JSON loaded with soba provider add <id> --from-file <path>. For example, "compatibility": ["single_system_message"] makes SOBA emit one leading system message for chat templates that reject multiple system messages. See model compatibility metadata for the full schema and supported features.


6. Compaction configuration

Compaction is configured through the compaction section.

OptionDefaultDescription
autotrueEnable soft deferred preflight compaction
compactOnTurnCompletetrueMark compaction pending after a turn completes
compactOnMilestonetrueMark compaction pending at milestone checkpoints
minTokensForAutoCompact32000Minimum effective tokens before considering auto-compaction
minReclaimableTokens12000Minimum reclaimable tokens for useful ROI
minSavingsRatio0.25Minimum savings ratio, 25% by default
keepRecentTokens20000Recent tokens to keep after compaction
safetyReserveTokens8192Safety reserve subtracted from the context window
autoCompactThresholdRatio0.8Soft threshold as a fraction of the request hard limit
timeoutMs15000Model-summary deadline before deterministic fallback
backgroundTimeoutMsDeprecated alias for timeoutMs

Hard limit:

hardLimit = contextWindow - maxOutputTokens - safetyReserveTokens

When effective tokens exceed hardLimit, SOBA runs blocking compaction. This cannot be disabled with auto: false. See Compaction and Context Capsules for the complete lifecycle and threshold guide.


7. Precedence

CLI flags
    ↓ override
Environment variables
    ↓ override
config.json
    ↓ override
Defaults

Example: if config.json contains "theme": "graphite", SOBA_THEME=forest is set, and --theme paper is passed, SOBA uses paper.

Special rules:

  • Reasoning precedence is request/session override → CLI → environment → config → provider default. /reasoning and F4 affect the next model request without restarting SOBA.
  • Requested and effective reasoning are separate. Unsupported controls fall back to provider default with a visible reason; SOBA never silently clamps to a nearby level.
  • maxOutputTokens and contextWindow are taken from the active model definition when possible. CLI flags and explicitly configured model limits override provider metadata for local proxies or incorrect catalogues.
  • compaction.auto can be overridden by SOBA_AUTO_COMPACT=false or --no-auto-compact.
  • Disabling auto-compaction turns off only soft triggers. Hard-limit and provider-overflow recovery remain mandatory.
  • Turn and milestone triggers are deferred: SOBA shows progress and awaits compaction immediately before the next model call.
  • Numeric 0 means unlimited for maxAgentIterations and maxRunMinutes; for maxCompletionTokens, it means no explicit limit.

8. Validation

SOBA validates configuration at startup:

  • API key is required unless the selected provider is keyless.
  • model is required.
  • Compaction invariants must hold:
    • contextWindow > 0
    • maxOutputTokens > 0
    • safetyReserveTokens >= 0
    • maxOutputTokens + safetyReserveTokens < contextWindow
    • keepRecentTokens < contextWindow - maxOutputTokens - safetyReserveTokens

If compaction invariants fail, compaction is disabled with a warning:

⚠️  Compaction disabled: config validation failed:
    keepRecentTokens (50000) must be < hard limit (47360)

On this page