Skip to content

Configuration Reference

All xopc configuration is centralized in ~/.xopc/xopc.json.

Quick Start

Run the interactive setup wizard:

bash
xopc onboard

Or create manually:

json
{
  "agents": {
    "defaults": {
      "model": "anthropic/claude-sonnet-4-5",
      "max_tokens": 8192,
      "temperature": 0.7
    }
  },
  "providers": {
    "anthropic": "${ANTHROPIC_API_KEY}"
  }
}

Full Configuration Example

json
{
  "agents": {
    "defaults": {
      "workspace": "~/.xopc/workspace",
      "model": {
        "primary": "anthropic/claude-sonnet-4-5",
        "fallbacks": ["openai/gpt-4o", "minimax/minimax-m2.1"]
      },
      "max_tokens": 8192,
      "temperature": 0.7,
      "max_tool_iterations": 20
    }
  },
  "providers": {
    "openai": "${OPENAI_API_KEY}",
    "anthropic": "${ANTHROPIC_API_KEY}",
    "deepseek": "${DEEPSEEK_API_KEY}",
    "groq": "${GROQ_API_KEY}",
    "google": "${GOOGLE_API_KEY}",
    "minimax": "${MINIMAX_API_KEY}"
  },
  "channels": {
    "telegram": {
      "enabled": true,
      "accounts": {
        "personal": {
          "name": "Personal Bot",
          "botToken": "BOT_TOKEN",
          "dmPolicy": "allowlist",
          "groupPolicy": "open",
          "allowFrom": [123456789],
          "streamMode": "partial"
        }
      }
    }
  },
  "gateway": {
    "host": "0.0.0.0",
    "port": 18790
  },
  "tools": {
    "web": {
      "search": {
        "maxResults": 5,
        "providers": [{ "type": "brave", "apiKey": "BSA_your_key_here" }]
      }
    }
  },
  "stt": {
    "enabled": true,
    "provider": "alibaba",
    "alibaba": {
      "apiKey": "${DASHSCOPE_API_KEY}",
      "model": "paraformer-v1"
    }
  },
  "tts": {
    "enabled": true,
    "provider": "openai",
    "trigger": "auto",
    "openai": {
      "apiKey": "${OPENAI_API_KEY}",
      "model": "tts-1",
      "voice": "alloy"
    }
  },
  "heartbeat": {
    "enabled": true,
    "intervalMs": 300000
  }
}

Configuration Sections

agents

Agent configuration has three parts: optional default id, shared defaults, and per-identity list entries. Routing and session keys use the first segment of the session key as the agent id; the effective profile for that turn merges defaults with the matching enabled list row (model, workspace, tools, prompts, etc.).

Top-level agents fields

FieldTypeDescription
defaultstringOptional. Default agent id when the session key or API does not specify one. If omitted: first list entry with default: true, else first enabled entry in list, else main.
defaultsobjectBaseline settings merged into every agent (see agents.defaults below).
listarrayRegistered identities; each object can override fields for that id.

agents.list entries

Each entry must include id. Other fields are optional overrides (same shapes as in defaults where applicable).

FieldTypeDescription
idstringAgent id (also the first segment of the session key).
defaultbooleanOptional. When true, marks this entry as the default agent when top-level agents.default is unset.
namestringDisplay name.
enabledbooleanDefault true. When false, the id is ignored for routing defaults and effective profile resolution falls back to the default agent.
workspacestringPer-agent Markdown workspace root (~ expanded). Tool cwd, daily memory/, and user files. Bootstrap Markdown, inbound/TTS blobs, and curated memories/ are resolved under agents/<id>/ (agent home), not inside this directory.
agentDirstringOptional. Overrides the internal agent state directory (credentials, agent.json, inbox, pid) — default <stateDir>/agents/<id>/agent.
modelstring | objectSame as agents.defaults.model (string or { primary, fallbacks }).
thinkingDefaultstringOptional. One of off, minimal, low, medium, high, xhigh, adaptive.
reasoningDefaultstringOptional. off, on, stream.
verboseDefaultstringOptional. off, on, full.
systemPromptOverridestringOptional. When set, replaces the usual base system prompt; skills block is still appended (subject to skills allowlist).
skillsstring[]Optional. Allowlist of skill names for <available_skills>; when set, only those skills are advertised.
toolsobjectOptional. { "disable": ["tool_name", ...] } — built-in tools to omit by tool name (e.g. shell, web_search, session_search, image; use extensions to disable extension tools).
paramsobjectOptional. Reserved for future use.

The same optional keys can appear under agents.defaults for global defaults (e.g. agents.defaults.tools.disable merged with per-agent disables).

Note: On-disk paths (~/.xopc/agents/<id>/ for sessions and internal state, per-agent Markdown workspace beside state) are derived from config.json (agents.list, agents.defaults, optional agentDir overrides). Use xopc agents add / agents delete to manage entries and directories; there is no separate agent “registry” outside config.

agents.defaults

FieldTypeDefaultDescription
workspacestring~/.xopc/workspaceWorkspace directory
modelstring/objectanthropic/claude-sonnet-4-5Default model
max_tokensnumber8192Maximum output tokens
temperaturenumber0.7Temperature (0-2)
max_tool_iterationsnumber20Max tool call iterations

agents.defaults.model

Model configuration supports two formats:

Simple format:

json
{
  "model": "anthropic/claude-sonnet-4-5"
}

Object format (with fallbacks):

json
{
  "model": {
    "primary": "anthropic/claude-sonnet-4-5",
    "fallbacks": ["openai/gpt-4o", "minimax/minimax-m2.1"]
  }
}

Model ID format: provider/model-id (e.g., anthropic/claude-opus-4-5).

agents.defaults.memory

Curated long-term memory under agents/<agentId>/memories/ (MEMORY.md / USER.md), optional stub external provider for wiring tests, and controls for prefetch injection (fenced <memory-context> prefix on user turns). See Curated memory.

FieldTypeDefaultDescription
enabledbooleantrueMaster switch. When false: no curated snapshot, no curated_memory tool, no external memory provider, no prefetch/sync.
useEnhancedSystembooleantrueWhen false: disable curated snapshot and curated_memory; workspace bootstrap MEMORY.md still applies.
userProfileEnabledbooleantrueWhen false: omit USER.md from the system prompt; curated_memory cannot mutate the user target (read still allowed).
memoryCharLimitnumber2200Max characters for MEMORY.md entries (total).
userCharLimitnumber1375Max characters for USER.md entries (total).
providerstringnoneExternal provider: none or stub (ignored when enabled is false).
injectionFrequencystringevery-turnPrefetch injection: every-turn or first-turn (first user message of the session only).
contextCadencenumber1When injectionFrequency is every-turn, inject prefetch on turns 1, 1+N, 1+2N, … (minimum 1).
dialecticCadencenumberReserved for future external sync cadence (not wired yet).

agents.defaults.sessionSearch

Cross-session transcript search via the session_search tool (when session persistence is available).

FieldTypeDefaultDescription
summaryModelstringModel ref for per-session summaries (e.g. openai/gpt-4o-mini). Overrides env XOPC_SESSION_SEARCH_MODEL when set.

providers

Configure LLM provider API keys. Use environment variable references:

json
{
  "providers": {
    "openai": "${OPENAI_API_KEY}",
    "anthropic": "${ANTHROPIC_API_KEY}",
    "deepseek": "sk-...",
    "groq": "${GROQ_API_KEY}"
  }
}

Supported Providers:

ProviderEnvironment Variable
openaiOPENAI_API_KEY
anthropicANTHROPIC_API_KEY
googleGOOGLE_API_KEY or GEMINI_API_KEY
groqGROQ_API_KEY
deepseekDEEPSEEK_API_KEY
minimaxMINIMAX_API_KEY
xaiXAI_API_KEY
mistralMISTRAL_API_KEY
cerebrasCEREBRAS_API_KEY
openrouterOPENROUTER_API_KEY
huggingfaceHF_TOKEN or HUGGINGFACE_TOKEN

Note: Environment variables take priority over config file values.

See Models Documentation for custom provider configuration.


bindings

Optional array of rules that assign an agentId to incoming traffic. Rules are sorted by priority (higher first). Each rule’s match requires an exact channel value (e.g. telegram); peerId may use * glob patterns. If nothing matches, routing uses the default agent id: agents.default if set, else the first enabled entry in agents.list, else main. See Session Routing System.


session

FieldTypeDefaultDescription
dmScopestringmainHow DM sessions are merged or split: main, per-peer, per-channel-peer, per-account-channel-peer
identityLinksobject-Map of canonical id → ["channel:peerId", ...] aliases for cross-channel identity
storageobject-Optional session store tuning (pruneAfterMs, maxEntries)

Details and examples: Session Routing System.


channels

Communication channels configuration.

channels.telegram

Multi-account Telegram configuration:

json
{
  "channels": {
    "telegram": {
      "enabled": true,
      "accounts": {
        "personal": {
          "name": "Personal Bot",
          "botToken": "BOT_TOKEN",
          "dmPolicy": "allowlist",
          "groupPolicy": "open",
          "allowFrom": [123456789],
          "streamMode": "partial"
        }
      }
    }
  }
}
FieldTypeDefaultDescription
enabledbooleanfalseEnable Telegram
accountsobject-Multi-account config
accounts.<id>.namestring-Display name
accounts.<id>.botTokenstring-Bot token
accounts.<id>.dmPolicystringopenDM policy
accounts.<id>.groupPolicystringopenGroup policy
accounts.<id>.allowFromarray[]Allowed user IDs
accounts.<id>.streamModestringpartialStream mode

DM Policies: pairing | allowlist | open | disabled

Group Policies: open | allowlist | disabled

Stream Modes: off | partial | block

channels.feishu

json
{
  "channels": {
    "feishu": {
      "enabled": true,
      "appId": "APP_ID",
      "appSecret": "APP_SECRET",
      "verificationToken": "VERIFICATION_TOKEN"
    }
  }
}

gateway

HTTP API gateway configuration.

FieldTypeDefaultDescription
hoststring0.0.0.0Bind address
portnumber18790Port number
authobject-Authentication config
corsobject-CORS settings

gateway.auth

FieldTypeDefaultDescription
enabledbooleanfalseEnable auth
usernamestring-Auth username
passwordstring-Auth password
api_keystring-API key auth

gateway.cors

FieldTypeDefaultDescription
enabledbooleanfalseEnable CORS
originsarray[]Allowed origins
credentialsbooleanfalseAllow credentials

tools

Tool configurations.

tools.web

FieldTypeDefaultDescription
searchobject-Web search config
browseobject-Web browsing config
FieldTypeDefaultDescription
maxResultsnumber5Default result count when the tool omits count
providersarray[]Ordered list of search backends (brave, tavily, bing, searxng). Empty → HTML fallback only.

Each provider entry: type, optional apiKey, optional url (SearXNG base URL), optional disabled.


stt

Speech-to-Text configuration for voice messages.

FieldTypeDefaultDescription
enabledbooleanfalseEnable STT
providerstringalibabaProvider: alibaba, openai
alibabaobject-Alibaba DashScope config
openaiobject-OpenAI Whisper config
fallbackobject-Fallback configuration

stt.alibaba

FieldTypeDefaultDescription
apiKeystring-DashScope API key
modelstringparaformer-v1Model: paraformer-v1, paraformer-8k-v1

stt.openai

FieldTypeDefaultDescription
apiKeystring-OpenAI API key
modelstringwhisper-1Model: whisper-1

stt.fallback

FieldTypeDefaultDescription
enabledbooleantrueEnable fallback
orderarray["alibaba", "openai"]Fallback order

Example:

json
{
  "stt": {
    "enabled": true,
    "provider": "alibaba",
    "alibaba": {
      "apiKey": "${DASHSCOPE_API_KEY}",
      "model": "paraformer-v1"
    },
    "fallback": {
      "enabled": true,
      "order": ["alibaba", "openai"]
    }
  }
}

tts

Text-to-Speech configuration for voice replies.

FieldTypeDefaultDescription
enabledbooleanfalseEnable TTS
providerstringopenaiProvider: openai, alibaba
triggerstringautoTrigger: auto, never
openaiobject-OpenAI TTS config
alibabaobject-Alibaba CosyVoice config

tts.openai

FieldTypeDefaultDescription
apiKeystring-OpenAI API key
modelstringtts-1Model: tts-1, tts-1-hd
voicestringalloyVoice: alloy, echo, fable, onyx, nova, shimmer

tts.alibaba

FieldTypeDefaultDescription
apiKeystring-DashScope API key
modelstringcosyvoice-v1Model: cosyvoice-v1
voicestring-Voice ID

Trigger modes:

  • auto: Send voice reply when user sends voice message
  • never: Disable TTS, only send text

heartbeat

Periodic health check configuration.

FieldTypeDefaultDescription
enabledbooleantrueEnable heartbeat
intervalMsnumber300000Interval in ms (5 min)

cron

Scheduled tasks configuration.

FieldTypeDefaultDescription
enabledbooleantrueEnable cron
jobsarray[]List of cron jobs

See Cron Documentation for job configuration.


extensions

Extension enable/disable configuration.

json
{
  "extensions": {
    "enabled": ["telegram-channel", "weather-tool"],
    "disabled": ["deprecated-extension"],
    "telegram-channel": {
      "token": "bot-token-here"
    },
    "weather-tool": true
  }
}
FieldTypeDescription
enabledstring[]List of extension IDs to enable
disabledstring[](Optional) List of extension IDs to disable
[extension-id]object/booleanExtension-specific configuration

See Extensions Documentation for details.


Environment Variables

xopc supports environment variables for sensitive data:

VariableDescription
OPENAI_API_KEYOpenAI API key
ANTHROPIC_API_KEYAnthropic API key
GOOGLE_API_KEYGoogle AI API key
GROQ_API_KEYGroq API key
DEEPSEEK_API_KEYDeepSeek API key
MINIMAX_API_KEYMiniMax API key
DASHSCOPE_API_KEYAlibaba DashScope API key (STT/TTS)
TELEGRAM_BOT_TOKENTelegram bot token
XOPC_CONFIGCustom config file path
XOPC_WORKSPACECustom workspace directory
XOPC_SESSION_SEARCH_MODELDefault model for session_search summaries when agents.defaults.sessionSearch.summaryModel is unset
XOPC_LOG_LEVELLog level (trace/debug/info/warn/error/fatal)
XOPC_LOG_DIRLog directory path
XOPC_LOG_CONSOLEEnable console output (true/false)
XOPC_LOG_FILEEnable file output (true/false)
XOPC_LOG_RETENTION_DAYSDays to retain log files
XOPC_PRETTY_LOGSPretty print logs for development

Environment variables take priority over config file values.


Configuration Management

Validate Configuration

bash
xopc config --validate

View Configuration

bash
xopc config --show

Edit Configuration

bash
xopc config --edit

FAQ

Q: How to use multiple providers?

Use the providers configuration to define multiple API keys. The agent automatically selects the appropriate provider based on the model ID:

json
{
  "providers": {
    "openai": "${OPENAI_API_KEY}",
    "anthropic": "${ANTHROPIC_API_KEY}"
  },
  "agents": {
    "defaults": {
      "model": "anthropic/claude-sonnet-4-5"
    }
  }
}

Q: How to use Ollama (local models)?

Configure custom provider in ~/.xopc/models.json:

json
{
  "providers": {
    "ollama": {
      "baseUrl": "http://localhost:11434/v1",
      "api": "openai-completions",
      "apiKey": "ollama",
      "models": [
        { "id": "llama3.1:8b" }
      ]
    }
  }
}

See Models Documentation for details.

Q: How to configure OAuth?

xopc supports OAuth authentication for certain providers:

Kimi (Device Code Flow):

json
{
  "providers": {
    "kimi": {
      "auth": {
        "type": "oauth",
        "clientId": "your-client-id"
      }
    }
  }
}

Kimi uses Device Code Flow - the CLI will prompt you to visit auth.kimi.com and enter a code.

Q: How to use environment variables?

Use ${VAR_NAME} syntax in config:

json
{
  "providers": {
    "openai": "${OPENAI_API_KEY}",
    "anthropic": "${ANTHROPIC_API_KEY}"
  }
}

Or set environment variables directly without adding to config.

Released under the MIT License.