Config Commands
Manage the OpenFang configuration file (config.toml), API keys (.env), and system diagnostics.
openfang init
Initialize the OpenFang workspace. Creates~/.openfang/ with subdirectories and a default config.toml.
Options
| Option | Description |
|---|---|
--quick | Skip interactive prompts. Auto-detects the best available LLM provider and writes config immediately. Suitable for CI/scripts. |
Behavior
- Interactive Mode (Default)
- Quick Mode
Launches a 5-step onboarding wizard (ratatui TUI) that walks through:
- Provider selection
- API key configuration
- Model selection
- Daemon start
- Launch choice (Desktop App, Dashboard, or Chat)
Created Structure
File Permissions
On Unix systems, OpenFang restricts permissions:- Files:
0600(owner read/write only) - Directories:
0700(owner read/write/execute only)
Examples
openfang config show
Display the current configuration file.Output
Example
openfang config edit
Open the configuration file in your editor.Behavior
Uses the first available editor:$EDITORenvironment variable$VISUALenvironment variablenotepad(Windows)vi(Unix)
Examples
openfang config get
Get a single configuration value by dotted key path.Arguments
| Argument | Description |
|---|---|
<KEY> | Dotted key path into the TOML structure (e.g., default_model.provider). |
Examples
openfang config set
Set a configuration value by dotted key path.Arguments
| Argument | Description |
|---|---|
<KEY> | Dotted key path (e.g., default_model.provider). |
<VALUE> | New value. Type is inferred from the existing value (integer, float, boolean, or string). |
Examples
openfang config set-key
Save an LLM provider API key to~/.openfang/.env.
Arguments
| Argument | Description |
|---|---|
<PROVIDER> | Provider name (e.g., groq, anthropic, openai, gemini, deepseek). |
Behavior
- Prompts interactively for the API key (input is hidden)
- Saves to
~/.openfang/.envas<PROVIDER_NAME>_API_KEY=<value> - Runs a live validation test against the provider’s API
- Sets file permissions to
0600(owner-only) on Unix
Supported Providers
| Provider | Environment Variable |
|---|---|
groq | GROQ_API_KEY |
gemini | GEMINI_API_KEY |
deepseek | DEEPSEEK_API_KEY |
anthropic | ANTHROPIC_API_KEY |
openai | OPENAI_API_KEY |
openrouter | OPENROUTER_API_KEY |
together | TOGETHER_API_KEY |
mistral | MISTRAL_API_KEY |
fireworks | FIREWORKS_API_KEY |
perplexity | PERPLEXITY_API_KEY |
cohere | COHERE_API_KEY |
xai | XAI_API_KEY |
brave→BRAVE_API_KEYtavily→TAVILY_API_KEY
Example Session
Examples
openfang config delete-key
Remove an API key from~/.openfang/.env.
Arguments
| Argument | Description |
|---|---|
<PROVIDER> | Provider name (e.g., groq, anthropic, openai). |
Examples
Output
openfang config test-key
Test provider connectivity with the stored API key.Arguments
| Argument | Description |
|---|---|
<PROVIDER> | Provider name to test. |
Behavior
- Reads the API key from the environment (loaded from
~/.openfang/.env) - Hits the provider’s models/health endpoint
- Reports
OK(key accepted) orFAILED (401/403)(key rejected) - Exits with code
1on failure
Examples
openfang doctor
Run diagnostic checks on the OpenFang installation.Options
| Option | Description |
|---|---|
--json | Output results as JSON for scripting. |
--repair | Attempt to auto-fix issues (create missing directories, config, remove stale files). Prompts for confirmation before each repair. |
Checks Performed
System Checks (6)
System Checks (6)
- OpenFang directory —
~/.openfang/exists - .env file — exists and has correct permissions (0600 on Unix)
- Config TOML syntax —
config.tomlparses without errors - Daemon status — whether a daemon is running
- Port 4200 availability — if daemon is not running, checks if the port is free
- Stale daemon.json — leftover
daemon.jsonfrom a crashed daemon
Storage Checks (2)
Storage Checks (2)
- Database file — SQLite magic bytes validation
- Disk space — warns if less than 100MB available (Unix only)
Agent & Config Checks (2)
Agent & Config Checks (2)
- Agent manifests — validates all
.tomlfiles in~/.openfang/agents/ - Config consistency — checks that
api_key_envreferences in config match actual environment variables
Provider Checks (1)
Provider Checks (1)
- LLM provider keys — checks env vars for 10 providers (Groq, OpenRouter, Anthropic, OpenAI, DeepSeek, Gemini, Google, Together, Mistral, Fireworks), performs live validation (401/403 detection)
Channel Checks (1)
Channel Checks (1)
- Channel tokens — format validation for Telegram, Discord, Slack tokens
Toolchain Checks (1)
Toolchain Checks (1)
- Rust toolchain —
rustc --version
Examples
Example Output
openfang status
Show the current kernel/daemon status.Options
| Option | Description |
|---|---|
--json | Output machine-readable JSON for scripting. |
Behavior
- If a daemon is running: queries
GET /api/statusand displays agent count, provider, model, uptime, API URL, data directory, and lists active agents. - If no daemon is running: boots an in-process kernel and shows persisted state. Displays a warning that the daemon is not running.
Example Output (Daemon Running)
Example Output (No Daemon)
Examples
Environment File Format
OpenFang loads~/.openfang/.env into the process environment on every CLI invocation. System environment variables take priority over .env values.
.env
Next Steps
Agent Commands
Spawn and manage agents
Channel Commands
Setup messaging integrations
Skill Commands
Install agent capabilities
CLI Overview
Back to CLI overview
