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
| Option | Type | Default | Description |
|---|---|---|---|
baseUrl | string | "" | Base URL of the OpenAI-compatible API. If empty, SOBA derives it from the active provider |
apiKey | string | "" | API key |
model | string | "" | Full model identifier, for example deepseek/deepseek-v4-flash or openrouter/anthropic/claude-sonnet-4.6 |
2.2. Model response
| Option | Type | Default | Description |
|---|---|---|---|
maxOutputTokens | number | 8192 | Max output tokens per model response. The default is a placeholder; the real value is read from the active model definition when available |
maxCompletionTokens | number | 0 | Maximum output plus reasoning tokens where the transport supports it. 0 leaves the provider default in place |
reasoning | ReasoningSelection | { "mode": "provider_default" } | Requested reasoning policy. The effective policy is recomputed from the active model's capabilities |
contextWindow | number | 128000 | Model context window. Provider metadata wins when available; the fallback is marked as assumed in the UI |
temperature | number | 0.7 | Sampling temperature, from 0 to 2 |
2.3. Runtime safety
| Option | Type | Default | Description |
|---|---|---|---|
maxAgentIterations | number | 0 | Emergency limit for model calls in one task. 0 means unlimited |
maxStalledIterations | number | 4 | Consecutive no-progress iterations before SOBA treats the loop as stalled |
maxRunMinutes | number | 0 | Max task duration in minutes. 0 means unlimited |
bashMaxTimeoutSeconds | number | 300 | Upper timeout limit for one bash tool call |
2.4. Sessions
| Option | Type | Default | Description |
|---|---|---|---|
sessionDir | string | ~/.soba/sessions | Directory for JSONL session files |
2.5. Interface
| Option | Type | Default | Description |
|---|---|---|---|
lang | "en" | "ru" | "zh" | "en" | Default interface language |
theme | TuiThemeName | "graphite" | TUI theme: graphite, vscode, github, aurora, synthwave, paper, forest, highContrast, clay, operator, or ink |
3. Environment variables
Environment variables override config.json.
| Variable | Config option | Description |
|---|---|---|
SOBA_BASE_URL | baseUrl | API base URL |
SOBA_API_KEY | apiKey | API key |
SOBA_MODEL | model | Model identifier |
SOBA_MAX_OUTPUT_TOKENS | maxOutputTokens | Output token limit |
SOBA_MAX_TOKENS | maxOutputTokens | Deprecated alias for SOBA_MAX_OUTPUT_TOKENS |
SOBA_MAX_COMPLETION_TOKENS | maxCompletionTokens | Reasoning token limit |
SOBA_REASONING_EFFORT | reasoning | default, none, minimal, low, medium, high, xhigh, or max |
SOBA_REASONING_BUDGET | reasoning | Positive numeric reasoning budget |
SOBA_REASONING_ENABLED | reasoning | true/1 or false/0 for toggle-based models |
SOBA_CONTEXT_WINDOW | contextWindow | Context window size |
SOBA_MAX_AGENT_ITERATIONS | maxAgentIterations | Iteration limit |
SOBA_MAX_STALLED_ITERATIONS | maxStalledIterations | No-progress iterations before stall recovery |
SOBA_MAX_RUN_MINUTES | maxRunMinutes | Max task duration in minutes |
SOBA_BASH_MAX_TIMEOUT_SECONDS | bashMaxTimeoutSeconds | Max timeout for one bash tool call |
SOBA_LANG | lang | Interface language |
SOBA_THEME | theme | TUI theme |
SOBA_AUTO_COMPACT | compaction.auto | false or 0 disables auto-compaction |
SOBA_SOUND_ENABLED | sound.enabled | Enable or disable sound notifications |
SOBA_SOUND_VOLUME | sound.volume | Volume from 0.0 to 1.0 |
SOBA_SOUND_REPEAT | sound.repeatMode | repeat/true/1 repeats, once/false/0 plays once |
SOBA_CONFIG_PATH | config file path | Use a non-default config file |
NO_COLOR | output colors | Disable ANSI colors, same effect as --no-color |
DEEPSEEK_API_KEY | DeepSeek provider key | DeepSeek API key |
MOONSHOT_API_KEY | Kimi provider key | Moonshot Kimi API key |
DASHSCOPE_API_KEY | Alibaba provider key | Alibaba Qwen API key |
OPENROUTER_API_KEY | OpenRouter provider key | OpenRouter API key |
OPENAI_API_KEY | OpenAI provider key | Official OpenAI API key |
4. CLI flags
CLI flags have the highest priority.
4.1. Run modes
| Flag | Short | Description |
|---|---|---|
--interactive | -i | Start interactive TUI mode |
--continue | -c | Continue the latest session |
--resume | -r | Resume a session through the interactive picker |
--session <id> | -s | Continue a specific session by ID |
4.2. Provider and model
| Flag | Short | Description |
|---|---|---|
--model <id> | -m | Override model identifier |
--api-key <key> | -k | Override API key |
--base-url <url> | Override API base URL |
4.3. Limits
| Flag | Description |
|---|---|
--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-enabled | Enable reasoning for a toggle-based model |
--no-reasoning | Disable 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
| Flag | Description |
|---|---|
--no-session | Interactive mode without persisting a session |
--no-color | Disable colors |
--no-stream | Disable streaming |
--stream | Enable streaming explicitly |
--debug | Write loop decisions into the JSONL session file |
--no-auto-compact | Disable proactive compaction, same as compaction.auto: false |
--lang <locale> | Override interface language: en, ru, or zh |
--theme <name> | Override TUI theme |
4.5. Info
| Flag | Short | Description |
|---|---|---|
--help | -h | Show help |
--version | -v | Show version |
5. Provider configuration
SOBA v0.6.x uses a provider registry. See Providers and models for details.
Built-in providers:
| ID | Name | Base URL |
|---|---|---|
deepseek | DeepSeek | https://api.deepseek.com |
kimi | Moonshot Kimi (K2 for code) | https://api.moonshot.cn/v1 |
alibaba | Alibaba Qwen (Singapore) | https://dashscope-intl.aliyuncs.com/compatible-mode/v1 |
openrouter | OpenRouter | https://openrouter.ai/api/v1 |
openai-official | OpenAI Responses API | https://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,8192Custom 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.
| Option | Default | Description |
|---|---|---|
auto | true | Enable soft deferred preflight compaction |
compactOnTurnComplete | true | Mark compaction pending after a turn completes |
compactOnMilestone | true | Mark compaction pending at milestone checkpoints |
minTokensForAutoCompact | 32000 | Minimum effective tokens before considering auto-compaction |
minReclaimableTokens | 12000 | Minimum reclaimable tokens for useful ROI |
minSavingsRatio | 0.25 | Minimum savings ratio, 25% by default |
keepRecentTokens | 20000 | Recent tokens to keep after compaction |
safetyReserveTokens | 8192 | Safety reserve subtracted from the context window |
autoCompactThresholdRatio | 0.8 | Soft threshold as a fraction of the request hard limit |
timeoutMs | 15000 | Model-summary deadline before deterministic fallback |
backgroundTimeoutMs | — | Deprecated alias for timeoutMs |
Hard limit:
hardLimit = contextWindow - maxOutputTokens - safetyReserveTokensWhen 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
DefaultsExample: 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.
/reasoningandF4affect 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.
maxOutputTokensandcontextWindoware 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.autocan be overridden bySOBA_AUTO_COMPACT=falseor--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
0means unlimited formaxAgentIterationsandmaxRunMinutes; formaxCompletionTokens, it means no explicit limit.
8. Validation
SOBA validates configuration at startup:
- API key is required unless the selected provider is keyless.
modelis required.- Compaction invariants must hold:
contextWindow > 0maxOutputTokens > 0safetyReserveTokens >= 0maxOutputTokens + safetyReserveTokens < contextWindowkeepRecentTokens < 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)
