Skip to content

Configuration

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

Use task guides first when you are trying to accomplish something:

TaskGuide
Configure a modelHow to configure your first model
Connect TelegramHow to connect Telegram
Reach the gateway from another deviceHow to expose the gateway safely
Add another agentHow to create a second agent
Debug a broken setupHow to diagnose a broken setup

For the exhaustive field reference, see Configuration reference.

The rest of this page is reference material for the xopc.json shape.

Quick Start

Run the interactive setup wizard:

bash
xopc onboard

Or create manually:

json
{
  "agents": {
    "default": "main",
    "defaultPreset": "default",
    "capabilityPresets": {
      "default": {
        "id": "default",
        "name": "Global defaults",
        "models": {
          "defaultRole": "deep",
          "roles": {
            "deep": { "model": "anthropic/claude-sonnet-4-5" }
          }
        }
      }
    },
    "list": [
      {
        "id": "main",
        "identity": {
          "name": "Main",
          "role": "General assistant",
          "language": "en",
          "tone": "direct"
        },
        "responsibilities": {
          "primary": ["Help the user complete tasks"]
        },
        "workspace": { "root": "~/.xopc/workspace/main" },
        "tools": { "builtin": {} },
        "skills": { "mode": "all" },
        "memory": {
          "mode": "confirmWrite",
          "sources": ["session", "curated"],
          "writePolicy": { "curated": "confirm" },
          "understanding": { "enabled": true, "adaptiveCadence": true, "reviewIntervalTurns": 10 }
        },
        "workflows": {},
        "boundaries": { "requiresConfirmation": [], "forbidden": [], "escalation": [] }
      }
    ]
  },
  "providers": {
    "anthropic": "${ANTHROPIC_API_KEY}"
  }
}

Full Configuration Example

json
{
  "agents": {
    "default": "main",
    "list": [
      {
        "id": "main",
        "identity": { "name": "Main", "role": "General assistant" },
        "responsibilities": { "primary": ["Help the user complete tasks"] },
        "workspace": { "root": "~/.xopc/workspace/main" },
        "models": {
          "defaultRole": "deep",
          "roles": {
            "deep": { "model": "deepseek/deepseek-v4-flash" }
          }
        },
        "tools": { "builtin": {} },
        "skills": { "mode": "all" },
        "memory": { "mode": "confirmWrite", "sources": ["session"] },
        "workflows": {},
        "boundaries": { "requiresConfirmation": [], "forbidden": [], "escalation": [] }
      }
    ]
  },
  "providers": {
    "deepseek": "${DEEPSEEK_API_KEY}"
  },
  "channels": {
    "telegram": {
      "enabled": true,
      "defaults": {
        "dmPolicy": "pairing",
        "groupPolicy": "open",
        "streaming": { "mode": "partial" }
      },
      "accounts": {
        "personal": {
          "name": "Personal Bot",
          "botToken": "BOT_TOKEN",
          "dmPolicy": "allowlist",
          "groupPolicy": "open",
          "allowFrom": [123456789],
          "streaming": { "mode": "partial" }
        }
      }
    }
  },
  "gateway": {
    "host": "0.0.0.0",
    "port": 18790
  },
  "tools": {
    "web": {
      "search": {
        "maxResults": 5,
        "providers": [{ "type": "brave", "apiKey": "BSA_your_key_here" }]
      }
    },
    "media": {
      "audio": {
        "enabled": true,
        "provider": "alibaba",
        "alibaba": {
          "apiKey": "${DASHSCOPE_API_KEY}",
          "model": "paraformer-v2"
        }
      }
    }
  },
  "messages": {
    "tts": {
      "enabled": true,
      "provider": "openai",
      "trigger": "inbound",
      "openai": {
        "apiKey": "${OPENAI_API_KEY}",
        "model": "tts-1",
        "voice": "alloy"
      }
    }
  },
  "heartbeat": {
    "enabled": true,
    "intervalMs": 300000
  }
}

Configuration Sections

agents

Agent configuration is manifest-first. The required runtime entries live in agents.list; each entry is an Agent Capability Manifest. Routing and session keys use the first segment of the session key as the agent id. Reusable capabilityPresets and defaultPreset are optional policy patch mechanisms. There is no agents.defaults merge layer.

Top-level agents fields

FieldTypeDescription
defaultstringOptional. Default agent id when the session key or API does not specify one. If omitted: first enabled manifest in list, else main.
defaultPresetstringOptional. Global preset id applied before each agent's own extends. Defaults to default when omitted. Use it only when you want shared baseline capabilities.
capabilityPresetsobjectOptional. Named reusable policy patches keyed by preset id. Presets may define model roles, tools, skills, memory, workflows, boundaries, runtime limits, and locks.
listarrayConcrete Agent Capability Manifests. Each entry can be complete on its own, including its own models.

agents.list entries

Each entry must include id, identity, responsibilities, workspace, tools, skills, workflows, and boundaries. Add models directly to the agent when the agent owns its model roles. Profile Markdown still lives under agents/<id>/profile/ for long-form persona/context files, but the structured manifest is the source of truth for runtime policy. User understanding and memory are configured once in top-level userContext.

FieldTypeDescription
idstringAgent id (also the first segment of the session key).
extendsstring[]Optional list of preset ids from agents.capabilityPresets. Later presets and the manifest override earlier fields.
enabledbooleanDefault true. When false, the id is ignored for routing and runtime resolution.
identityobjectStructured display/model identity: name, role, optional description, language, tone, avatar.
responsibilitiesobjectprimary, optional secondary, and optional outOfScope lists.
workspace.rootstringPer-agent Markdown workspace root (~ expanded). Tool cwd, generated artifacts, and user files.
models.defaultRolestringRole id used when a workflow/session does not request a named role.
models.rolesobjectNamed model roles. Each role uses { "model": "provider/model", "description": "..." }.
tools.builtinobjectBuilt-in tool policy by tool name: `{ "mode": "allow"
tools.mcpobjectOptional MCP server/tool policies.
skillsobjectSkill visibility policy: all, allowlist, denylist, or off.
memoryobjectMemory mode, sources, write policy, retention, privacy, and optional background user-understanding review policy.
workflowsobjectOptional default/allowed/suggested workflow policy.
boundariesobjectConfirmation, forbidden, and escalation rules.
runtimeobjectOptional runtime limits (maxTurns, timeoutMs, maxToolFailuresPerTurn).
promptobjectOptional structured prompt customizations.

Use xopc agents add / agents delete to manage entries and directories; there is no separate agent registry outside config.

models.roles

json
{
  "models": {
    "defaultRole": "deep",
    "roles": {
      "small": {
        "model": "openai/gpt-4o-mini",
        "description": "Fast low-cost model"
      },
      "large": {
        "model": "anthropic/claude-sonnet-4-5"
      }
    }
  }
}

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

Preset model patches use the same models shape, without requiring a complete manifest.


providers

Configure LLM provider API keys. Use environment variable references:

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

Built-in provider ids match @earendil-works/pi-ai KnownProvider. Env var names are defined in src/providers/env-keys.ts (PROVIDER_ENV_MAP); the table below mirrors that file. Other vendors (e.g. DashScope-only HTTP APIs) use models.json, not xopc.jsonproviders, unless you add a custom id there.

Provider idEnvironment variables (first match wins where listed)
amazon-bedrockAWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION (and other AWS envs per pi-ai / SDK)
anthropicANTHROPIC_OAUTH_TOKEN, ANTHROPIC_API_KEY
azure-openai-responsesAZURE_OPENAI_API_KEY, AZURE_OPENAI_BASE_URL
cloudflare-ai-gatewayCLOUDFLARE_API_KEY (model URLs may also need account/gateway ids—see pi-ai model baseUrl)
cloudflare-workers-aiCLOUDFLARE_API_KEY
cerebrasCEREBRAS_API_KEY
dashscopeDASHSCOPE_API_KEY (image/STT/TTS; not an LLM KnownProvider in pi-ai)
deepseekDEEPSEEK_API_KEY
fireworksFIREWORKS_API_KEY
github-copilotCOPILOT_GITHUB_TOKEN, GH_TOKEN, GITHUB_TOKEN, GITHUB_COPILOT_TOKEN
googleGEMINI_API_KEY, GOOGLE_API_KEY
google-antigravityANTIGRAVITY_API_KEY
google-gemini-cliGEMINI_CLI_TOKEN, GOOGLE_TOKEN
google-vertexGOOGLE_CLOUD_API_KEY, GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION
groqGROQ_API_KEY
huggingfaceHF_TOKEN, HUGGINGFACE_TOKEN
kimi-codingKIMI_API_KEY, MOONSHOT_API_KEY
minimaxMINIMAX_API_KEY
minimax-cnMINIMAX_CN_API_KEY, MINIMAX_API_KEY
mistralMISTRAL_API_KEY
moonshotaiMOONSHOT_API_KEY
moonshotai-cnMOONSHOT_API_KEY
openaiOPENAI_API_KEY
openai-codex(no env map row—use OAuth / xopc auth login openai-codex)
opencodeOPENCODE_API_KEY
opencode-goOPENCODE_API_KEY
openrouterOPENROUTER_API_KEY
togetherTOGETHER_API_KEY
vercel-ai-gatewayAI_GATEWAY_API_KEY, VERCEL_AI_GATEWAY_API_KEY
xaiXAI_API_KEY
xiaomiXIAOMI_API_KEY
xiaomi-token-plan-cnXIAOMI_TOKEN_PLAN_CN_API_KEY
xiaomi-token-plan-amsXIAOMI_TOKEN_PLAN_AMS_API_KEY
xiaomi-token-plan-sgpXIAOMI_TOKEN_PLAN_SGP_API_KEY
zaiZAI_API_KEY

For why there are four Xiaomi ids, see Models — Built-in LLM providers.

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.

Keys under channels depend on which channel types you use. Built-in Telegram and Weixin accept the shapes documented in Channel configuration. Other keys may come from extensions—follow each extension’s README.

channels.telegram

Multi-account Telegram configuration:

json
{
  "channels": {
    "telegram": {
      "enabled": true,
      "defaults": {
        "dmPolicy": "pairing",
        "groupPolicy": "open",
        "streaming": { "mode": "partial" }
      },
      "accounts": {
        "personal": {
          "name": "Personal Bot",
          "botToken": "BOT_TOKEN",
          "dmPolicy": "allowlist",
          "groupPolicy": "open",
          "allowFrom": [123456789],
          "streaming": { "mode": "partial" }
        }
      }
    }
  }
}
FieldTypeDefaultDescription
enabledbooleanfalseEnable Telegram
accountsobject-Multi-account config
accounts.<id>.namestring-Display name
accounts.<id>.botTokenstring-Bot token
defaults.dmPolicystringpairingDefault DM policy for accounts
defaults.groupPolicystringopenDefault group policy for accounts
defaults.streaming.modestringpartialDefault stream mode for accounts
accounts.<id>.dmPolicystringinherits defaults.dmPolicyDM policy
accounts.<id>.groupPolicystringinherits defaults.groupPolicyGroup policy
accounts.<id>.allowFromarray[]Allowed user IDs
accounts.<id>.streaming.modestringinherits defaults.streaming.modeStream mode

DM policies (pairing | allowlist | open | disabled):

  • pairing (recommended): unknown users are not passed to the agent until their Telegram / Feishu / Weixin sender id is allowed. For Telegram, allow sources are channels.telegram.accounts.<id>.allowFrom plus entries in the Telegram credential file created after you run xopc channels pairing approve. First contact receives a pairing code in DM. See Channels — DM pairing and CLI — channels.
  • allowlist: same merge rules as pairing for the allow list, but no pairing code message; unknown senders are dropped.
  • open: any user can DM (avoid on public bots).
  • disabled: DMs are rejected.

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
bindstringloopbackauto, loopback, lan, tailnet, custom
customBindHoststring-IPv4 address when bind is custom
portnumber18790Port number
modestringlocallocal or remote (CLI target)
remoteobject-Persistent remote URL/token for CLI when mode=remote
tailscaleobject{ mode: off }serve / funnel / off — see network.md
tlsobject-Native HTTPS (optional)
authobject-Authentication config
corsOriginsstring[][]Browser origin allowlist

gateway.auth

FieldTypeDefaultDescription
modestringtokenAuth mode: none, token, password
tokenstringauto-generatedBearer / X-Api-Key credential when mode: "token"
passwordstring-Password credential when mode: "password"
rateLimitobjectenabledBrute-force protection for failed auth attempts

Notes:

  • gateway.auth.token and gateway.auth.password are mutually exclusive; setting both is rejected at startup.
  • In token mode, if no token is configured, xopc generates a random token at startup.
  • Weak / placeholder tokens (for example your-secret-token-here) and tokens shorter than 16 chars are rejected.
  • You can override auth from env: XOPC_GATEWAY_AUTH_MODE, XOPC_GATEWAY_TOKEN, XOPC_GATEWAY_PASSWORD.

gateway.auth.rateLimit

FieldTypeDefaultDescription
enabledbooleantrueEnable auth failure rate limiting
maxAttemptsnumber5Max failed attempts within the window
windowMsnumber900000Rolling window in milliseconds
blockDurationMsnumber300000Temporary block duration in milliseconds

gateway.corsOrigins

FieldTypeDefaultDescription
gateway.corsOriginsstring[][]Browser origin allowlist (exact origins, e.g. http://localhost:5173)

Security behavior:

  • Browser requests with an Origin header are rejected when origin checks fail.
  • Non-browser requests without Origin are validated by the auth middleware instead.
  • Setting corsOrigins to "*" is allowed but flagged by startup security audit logs.

Channel connect defer

Fields live under gateway.* (channelConnectDeferMode, channelConnectDeferIds, channelConnectDeferSkipIds). When you run xopc gateway (the GatewayServer path), outbound-heavy channel plugins (Telegram, Weixin, Feishu) can defer ChannelPlugin.start() until after the HTTP listener has bound, so the control plane and static UI come up first. Plugin authors opt in via meta.deferConnectUntilAfterListen on the channel plugin.

FieldTypeDefaultDescription
channelConnectDeferMode"auto" | "off" | "explicit"(unset →) autoauto — defer set = enabled channels whose plugin meta requests defer, minus channelConnectDeferSkipIds. off — never defer; all channels start() in phase 1. explicit — defer only ids listed in channelConnectDeferIds (empty list → defer none).
channelConnectDeferIdsstring[]-Max 24 entries. Used when channelConnectDeferMode is explicit.
channelConnectDeferSkipIdsstring[]-Max 24 entries. Removed from the defer set after auto or explicit resolution.

Startup logs (structured, phase: "gateway.channel_startup"):

  • stage: "phase1" — includes channelInitMs, deferPlanMs, channelPhase1StartMs, replayOutboundMs (or null when replay runs after listen), channelConnectDeferMode, channelConnectDeferSource (meta | explicit | off), and deferredChannelIds.
  • stage: "phase2" — after HTTP listen: channelPhase2DeferredMs, replayOutboundMs, onHttpListeningTotalMs, plus the same defer mode/source snapshot.

Useful filters: gateway.channel_startup or phase-1 complete / phase-2 complete in log text.

See also Gateway — Channel startup and HTTP listen order.


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.


tools.media.audio (STT)

Speech-to-Text configuration for inbound voice messages. Lives under tools.media.audio (the gateway REST surface still exposes it as stt for backwards-friendly form payloads).

FieldTypeDefaultDescription
enabledbooleanfalseEnable STT
providerstringalibabaPrimary provider: alibaba, openai
alibabaobject-Alibaba DashScope config
openaiobject-OpenAI Whisper config
fallbackobject-Fallback configuration
timeoutMsnumber60000Hard per-call HTTP timeout (ms)

tools.media.audio.alibaba

FieldTypeDefaultDescription
apiKeystring-DashScope API key (env: DASHSCOPE_API_KEY)
modelstringparaformer-v2Model id

tools.media.audio.openai

FieldTypeDefaultDescription
apiKeystring-OpenAI API key (env: OPENAI_API_KEY)
modelstringwhisper-1Whisper model id

tools.media.audio.fallback

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

On failure, the runtime tries each provider in order and records structured attempts (provider, outcome, latency, reason) for diagnostics. All HTTP calls go through the shared media-shared/http chassis with SSRF guard (fetchWithTimeoutGuarded).

Example:

json
{
  "tools": {
    "media": {
      "audio": {
        "enabled": true,
        "provider": "alibaba",
        "alibaba": {
          "apiKey": "${DASHSCOPE_API_KEY}",
          "model": "paraformer-v2"
        },
        "fallback": {
          "enabled": true,
          "order": ["alibaba", "openai"]
        }
      }
    }
  }
}

messages.tts (TTS)

Text-to-Speech configuration for assistant voice replies and the optional text_to_speech agent tool. Lives under messages.tts (the gateway REST surface still exposes it as tts).

FieldTypeDefaultDescription
enabledbooleanfalseEnable TTS (and registration of text_to_speech when true)
providerstringopenaiPrimary provider: openai, alibaba, edge, minimax, tts-local-cli, or any extension-registered SpeechProviderPlugin id
triggerstringalwaysoff, always, inbound, tagged
maxTextLengthnumber512Max characters sent to TTS providers. Conservative default chosen to fit every built-in provider (Alibaba qwen-tts caps at 512). Raise per-provider if your primary supports longer input.
timeoutMsnumber60000Per-request HTTP timeout (ms). Range 1000180000. MiniMax internally bumps to ≥150s for its async polling flow.
fallbackobject-Provider fallback order
summarizationobject-LLM summarization before TTS when text exceeds threshold
modelOverridesobject-Allow [[tts:...]] directives from the model
openaiobject-OpenAI TTS config
alibabaobject-Alibaba DashScope TTS config
edgeobject-Microsoft Edge TTS (no API key)
minimaxobject-MiniMax T2A async TTS config
tts-local-cliobject-Local CLI provider (bundled extension)

messages.tts.openai

FieldTypeDefaultDescription
apiKeystring-OpenAI API key (env: OPENAI_API_KEY)
baseUrlstringhttps://api.openai.com/v1Override base URL (env: OPENAI_TTS_BASE_URL) for OpenAI-compatible vendors
modelstringtts-1Model: tts-1, tts-1-hd, gpt-4o-mini-tts
voicestringalloyVoice: alloy, echo, fable, onyx, nova, shimmer, coral, verse, …

messages.tts.alibaba

FieldTypeDefaultDescription
apiKeystring-DashScope API key (env: DASHSCOPE_API_KEY)
modelstringqwen-ttsTTS model id
voicestringlongxiaochunVoice id (Cherry, Ethan, longxiaochun, longxiaobai, …)

messages.tts.edge

FieldTypeDefaultDescription
enabledbooleantrueWhen false, Edge is excluded from the provider chain
voicestringen-US-MichelleNeuralEdge voice id
langstringen-USBCP-47 language
outputFormatstringaudio-24khz-48kbitrate-mono-mp3Edge output format string
proxystring-Optional HTTP(S) proxy for Edge

messages.tts.minimax

FieldTypeDefaultDescription
apiKeystring-MiniMax API key (env: MINIMAX_API_KEY)
baseUrlstringhttps://api.minimaxi.com/v1Override base URL
modelstringspeech-2.8-hdModel id (speech-2.8-hd, speech-2.8-turbo, …)
voicestringmale-qn-qingseVoice id
groupIdstring-Forward-compat slot for enterprise tier

messages.tts.tts-local-cli

Provided by the bundled tts-local-cli extension (see extensions/tts-local-cli/xopc.extension.json for the authoritative JSON Schema). Spawns any local TTS binary (mlx-audio, sherpa-onnx-tts, piper, …) via shell template and reads the output file.

FieldTypeDefaultDescription
commandstringrequiredShell command template; supports , , , placeholders (case-insensitive)
argsstring[][]Extra args appended after the parsed command
cwdstring-Working directory for the spawned process
outputFormatenumwavFile extension produced by the CLI: mp3 | opus | wav
timeoutMsnumber120000Hard kill timeout (ms)
envobject-Extra env vars merged into the spawned process env (Record<string,string>)

The Voice settings UI exposes the common fields (command, cwd, outputFormat, timeoutMs); args and env are advanced fields — edit ~/.xopc/xopc.json directly to set them.

messages.tts.fallback

FieldTypeDefaultDescription
enabledbooleantrueTry other providers on failure
orderarray["openai","alibaba","edge","minimax"]Order after deduplicating primary

The fallback list accepts any registered SpeechProviderPlugin id, including extension providers like tts-local-cli.

messages.tts.summarization

FieldTypeDefaultDescription
enabledbooleantrueSummarize long text via LLM before TTS
thresholdnumbersame as maxTextLengthMin length to trigger summarization
targetLengthnumbersame as maxTextLengthTarget length after summarization
modelstring-Model ref for summarization; env XOPC_TTS_SUMMARIZE_MODEL if unset

Trigger modes:

  • off: No automatic TTS on outbound
  • always: TTS when outbound rules pass
  • inbound: TTS only when the user message carried voice (transcribedVoice)
  • tagged: TTS only when assistant text contains [[tts]]

See Voice (STT/TTS) for Telegram group voice + mention behavior, /tts status, and channel formats.


mcp

Outbound MCP server registry (agent consumes external MCP tools).

FieldTypeDefaultDescription
sessionIdleTtlMsnumber600000Per-session MCP runtime idle TTL (10 min); 0 disables eviction
serversobject{}Server id → connection definition (stdio or HTTP)

See MCP for configuration, Web UI, and security notes.


heartbeat

Periodic health check configuration.

FieldTypeDefaultDescription
enabledbooleantrueEnable heartbeat
intervalMsnumber300000Interval in ms (5 min)

automations

Automations are managed in SQLite and through the Gateway console/API, not through xopc.json. Open #/automations or use /api/automations and /api/automation-runs.

See Automations for triggers, actions, reliability, and run history.


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
ANTHROPIC_OAUTH_TOKENAnthropic OAuth token (when used)
GOOGLE_API_KEY / GEMINI_API_KEYGoogle AI (Gemini) API keys
GROQ_API_KEYGroq API key
CEREBRAS_API_KEYCerebras API key
DEEPSEEK_API_KEYDeepSeek API key
MINIMAX_API_KEYMiniMax API key
MOONSHOT_API_KEYMoonshot / Kimi-family keys (see PROVIDER_ENV_MAP for moonshotai* vs kimi-coding)
FIREWORKS_API_KEYFireworks AI
TOGETHER_API_KEYTogether AI
CLOUDFLARE_API_KEYCloudflare Workers AI / AI Gateway
XIAOMI_API_KEYXiaomi MiMo (API billing); token-plan variants use XIAOMI_TOKEN_PLAN_*_API_KEY
AI_GATEWAY_API_KEYVercel AI Gateway (alias VERCEL_AI_GATEWAY_API_KEY)
DASHSCOPE_API_KEYAlibaba DashScope (STT/TTS, image gen)
XOPC_TTS_SUMMARIZE_MODELModel ref for TTS long-text summarization when tts.summarization.model is unset
TELEGRAM_BOT_TOKENTelegram bot token
XOPC_CONFIGCustom config file path
XOPC_WORKSPACECustom workspace directory
XOPC_SESSION_SEARCH_MODELDefault model for session_search summaries when the selected manifest does not provide a summary model role
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
XOPC_LOG_LLM_PAYLOADInclude the complete system prompt, messages, and tools in debug logs (sensitive; default false)

Environment variables take priority over config file values.


Configuration Management

Validate Configuration

bash
xopc config validate
# legacy alias:
xopc config --validate

View Configuration

bash
xopc config show
# legacy alias:
xopc config --show

Edit values with xopc config set / xopc config unset, or open xopc config path in your editor.


Update

Controls version checks, optional auto-install, and post-update gateway restart behavior. See Updates.

json
{
  "update": {
    "channel": "stable",
    "checkOnStart": true,
    "auto": {
      "enabled": false,
      "stableDelayHours": 6,
      "stableJitterHours": 12,
      "betaCheckIntervalHours": 1
    }
  },
  "commands": {
    "restart": true
  }
}
KeyDefaultDescription
update.channelstablestable | beta | dev — maps to npm dist-tags latest / beta / dev
update.checkOnStarttrueGateway queries registry on startup
update.auto.enabledfalseAuto-install from gateway (stable/beta npm global only)
update.auto.stableDelayHours6Stable rollout delay after first detection
update.auto.stableJitterHours12Extra random delay for stable auto-update
update.auto.betaCheckIntervalHours1Min hours between auto attempts for same beta version
commands.restarttrueWhen false, disables post-update restart and SIGUSR1 restart paths

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.