AI Config Admin
Identify which target the user wants to modify first: OpenClaw, OpenCode, Codex CLI, or Claude Code. Then use the bundled script for that target.
Required rules
- - Follow this skill and the existing script capabilities exactly.
- Do not manually edit config files to bypass script limitations.
- If the request is outside current script support, say so clearly and explain what is missing.
- Before every write, create a backup in the same directory as the original file.
- Perform backup and write through the bundled script, not manual editing.
- Do not echo secrets such as
apiKey, OPENAI_API_KEY, ANTHROPIC_AUTH_TOKEN, tokens, or refresh tokens in replies.
Target files
- - OpenClaw: INLINECODE3
- OpenCode: INLINECODE4
- Codex CLI:
~/.codex/config.toml, INLINECODE6 - Claude Code: INLINECODE7
Routing
- - OpenClaw requests:
openclaw.json, default model, agent model, add/remove provider, add/remove model, memory search. - OpenCode requests:
opencode.json, OpenCode config, replace full JSON. - Codex CLI requests:
config.toml, auth.json, Codex CLI, model_provider, review_model, wire_api, requires_openai_auth. - Claude Code requests:
settings.json, Claude Code, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL, ANTHROPIC_MODEL, CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC, CLAUDE_CODE_ATTRIBUTION_HEADER.
Input handling
- - Accept natural language, semi-structured JSON, or mixed descriptions.
- Convert user intent into explicit script parameters or complete JSON/TOML text before invoking scripts.
- Ask follow-up questions only when critical parameters cannot be inferred.
OpenClaw
- - Infer supported arguments from user intent.
- When fields are missing, prefer filling from the current config when safe.
- Use
add-model to add a model to an existing provider, or to create/update a provider when the user also supplies the required provider fields. - For a brand-new provider,
add-model needs enough provider config to make it valid: at minimum --base-url and --api; use --api-key and --auth-header when appropriate. - Use
add-openai-model only for OpenAI-compatible provider setup flows that require explicit apiKey and api handling in one step.
OpenCode
- - If the user provides complete JSON, replace the file directly.
- Do not merge partial JSON.
Codex CLI
- -
config.toml: infer structured parameters and call the script. - INLINECODE32 : write only when the user provides a complete JSON payload; default to full replacement.
- Do not delete unknown TOML sections such as
projects, notice, or tui. - If existing
auth.json contains login-state fields, replace it only when the user explicitly asks for full replacement.
Claude Code
- - Full
settings.json input may be replaced directly. - If the user provides only an
{"env": {...}} fragment:
- If
ANTHROPIC_BASE_URL is present, replace the Claude-related env key set.
- Otherwise, update only the explicitly provided Claude-related env keys.
- - Do not invent missing model fields.
- Do not modify non-Claude env keys.
Commands
Use {baseDir} as the skill root.
OpenClaw
CODEBLOCK0
Supported operations:
- - INLINECODE41
- INLINECODE42
- INLINECODE43
- INLINECODE44
- INLINECODE45
- INLINECODE46
- INLINECODE47
- INLINECODE48
- INLINECODE49
OpenCode
CODEBLOCK1
Supported operations:
- - INLINECODE50
- INLINECODE51
Codex CLI
CODEBLOCK2
Supported operations:
- - INLINECODE52
- INLINECODE53
- INLINECODE54
- INLINECODE55
Claude Code
CODEBLOCK3
Supported operations:
- - INLINECODE56
- INLINECODE57
- INLINECODE58
- INLINECODE59
Defaults and safeguards
- - Do not write
headers.User-Agent unless explicitly needed. - Do not switch the default model unless the user asks.
- Do not change
memorySearch unless the user asks. - Stop if the script reports validation or dependency errors.
- For OpenCode, default to full replacement when complete JSON is provided.
- For Claude Code, if
ANTHROPIC_BASE_URL is present, rebuild the Claude-related env set instead of carrying forward stale provider-specific env/model keys.
AI 配置管理
首先识别用户想要修改的目标:OpenClaw、OpenCode、Codex CLI 或 Claude Code。然后使用该目标对应的捆绑脚本。
必要规则
- - 严格遵循本技能和现有脚本的功能。
- 不要手动编辑配置文件以绕过脚本限制。
- 如果请求超出当前脚本支持范围,请明确说明并解释缺失的内容。
- 每次写入前,在与原始文件相同的目录中创建备份。
- 通过捆绑脚本执行备份和写入,不要手动编辑。
- 不要在回复中回显诸如 apiKey、OPENAIAPIKEY、ANTHROPICAUTHTOKEN、令牌或刷新令牌等机密信息。
目标文件
- - OpenClaw:~/.openclaw/openclaw.json
- OpenCode:~/.config/opencode/opencode.json
- Codex CLI:~/.codex/config.toml、~/.codex/auth.json
- Claude Code:~/.claude/settings.json
路由
- - OpenClaw 请求:openclaw.json、默认模型、代理模型、添加/删除提供商、添加/删除模型、记忆搜索。
- OpenCode 请求:opencode.json、OpenCode 配置、替换完整 JSON。
- Codex CLI 请求:config.toml、auth.json、Codex CLI、modelprovider、reviewmodel、wireapi、requiresopenaiauth。
- Claude Code 请求:settings.json、Claude Code、ANTHROPICAUTHTOKEN、ANTHROPICBASEURL、ANTHROPICMODEL、CLAUDECODEDISABLENONESSENTIALTRAFFIC、CLAUDECODEATTRIBUTION_HEADER。
输入处理
- - 接受自然语言、半结构化 JSON 或混合描述。
- 在调用脚本前,将用户意图转换为明确的脚本参数或完整的 JSON/TOML 文本。
- 仅当关键参数无法推断时才提出后续问题。
OpenClaw
- - 从用户意图推断支持的参数。
- 当字段缺失时,优先在安全的情况下从当前配置中填充。
- 使用 add-model 向现有提供商添加模型,或在用户同时提供所需提供商字段时创建/更新提供商。
- 对于全新的提供商,add-model 需要足够的提供商配置才能生效:至少需要 --base-url 和 --api;在适当时使用 --api-key 和 --auth-header。
- 仅在需要一步完成显式 apiKey 和 api 处理的 OpenAI 兼容提供商设置流程中使用 add-openai-model。
OpenCode
- - 如果用户提供完整的 JSON,直接替换文件。
- 不要合并部分 JSON。
Codex CLI
- - config.toml:推断结构化参数并调用脚本。
- auth.json:仅在用户提供完整 JSON 负载时写入;默认为完全替换。
- 不要删除未知的 TOML 部分,如 projects、notice 或 tui。
- 如果现有的 auth.json 包含登录状态字段,仅在用户明确要求完全替换时才替换。
Claude Code
- - 完整的 settings.json 输入可以直接替换。
- 如果用户仅提供 {env: {...}} 片段:
- 如果存在 ANTHROPIC
BASEURL,替换与 Claude 相关的环境键集。
- 否则,仅更新明确提供的与 Claude 相关的环境键。
- - 不要发明缺失的模型字段。
- 不要修改非 Claude 环境键。
命令
使用 {baseDir} 作为技能根目录。
OpenClaw
bash
python3 {baseDir}/scripts/openclaw_config.py --help
python3 {baseDir}/scripts/openclaw_config.py --file ~/.openclaw/openclaw.json summary
python3 {baseDir}/scripts/openclaw_config.py --file ~/.openclaw/openclaw.json add-model \
--provider-id minimax-cn \
--model-id MiniMax-M2.7 \
--name MiniMax M2.7 \
--context-window 200000 \
--max-tokens 8192 \
--set-default
支持的操作:
- - summary
- add-model [--provider-id ...] [--model-id ...] [--name ...] [--context-window ...] [--max-tokens ...] [--reasoning true|false] [--allowlist] [--set-default] [--input text|image ...] [--base-url ...] [--api-key ...] [--api ...] [--auth-header true|false]
- add-openai-model ...
- set-openai-provider [--base-url ...] [--api-key ...]
- remove-model
- set-memory-search on|off
- set-default-model
- set-agent-model
- remove-provider
OpenCode
bash
python3 {baseDir}/scripts/opencode_config.py --file ~/.config/opencode/opencode.json summary
python3 {baseDir}/scripts/opencode_config.py --file ~/.config/opencode/opencode.json replace-from-stdin <
{...完整 JSON...}
EOF
支持的操作:
- - summary
- replace-from-stdin
Codex CLI
bash
python3 {baseDir}/scripts/codex_config.py --help
python3 {baseDir}/scripts/codex_config.py --config-file ~/.codex/config.toml --auth-file ~/.codex/auth.json summary
python3 {baseDir}/scripts/codex_config.py --config-file ~/.codex/config.toml replace-config-from-stdin <
model_provider = OpenAI
model = gpt-5.4
EOF
python3 {baseDir}/scripts/codex_config.py --auth-file ~/.codex/auth.json replace-auth-from-stdin <
{OPENAIAPIKEY:sk-...}
EOF
支持的操作:
- - summary
- replace-config-from-stdin
- replace-auth-from-stdin
- set-openai-provider [--model-provider ...] [--model ...] [--review-model ...] [--reasoning-effort ...] [--disable-response-storage true|false] [--network-access ...] [--windows-wsl-setup-acknowledged true|false] [--model-context-window ...] [--model-auto-compact-token-limit ...] [--provider-name ...] [--base-url ...] [--wire-api ...] [--requires-openai-auth true|false]
Claude Code
bash
python3 {baseDir}/scripts/claude_config.py --help
python3 {baseDir}/scripts/claude_config.py --file ~/.claude/settings.json summary
python3 {baseDir}/scripts/claude_config.py --file ~/.claude/settings.json set-env \
--anthropic-auth-token sk-... \
--attribution-header 0
python3 {baseDir}/scripts/claude_config.py --file ~/.claude/settings.json replace-env \
--anthropic-base-url https://example.invalid \
--anthropic-auth-token sk-... \
--attribution-header 0
python3 {baseDir}/scripts/claude_config.py --file ~/.claude/settings.json replace-from-stdin <
{env:{ANTHROPICBASEURL:https://example.invalid}}
EOF
支持的操作:
- - summary
- replace-from-stdin
- set-env [--anthropic-auth-token ...] [--anthropic-base-url ...] [--anthropic-default-haiku-model ...] [--anthropic-default-opus-model ...] [--anthropic-default-sonnet-model ...] [--anthropic-model ...] [--api-timeout-ms ...] [--disable-nonessential-traffic ...] [--attribution-header ...]
- replace-env [--anthropic-auth-token ...] [--anthropic-base-url ...] [--anthropic-default-haiku-model ...] [--anthropic-default-opus-model ...] [--anthropic-default-sonnet-model ...] [--anthropic-model ...] [--api-timeout-ms ...] [--disable-nonessential-traffic ...] [--attribution-header ...]
默认值与安全措施
- - 除非明确需要,否则不要写入 headers.User-Agent。
- 除非用户要求,否则不要切换默认模型。
- 除非用户要求,否则不要更改 memorySearch。
- 如果脚本报告验证或依赖错误,请停止。
- 对于 OpenCode,当提供完整 JSON 时,默认为完全替换。
- 对于 Claude Code,如果存在 ANTHROPICBASEURL,则重建与 Claude 相关的环境集,而不是沿用过时的特定提供商环境/