OpenClaw Skill Guide

OpenAI Auth Switcher Public

一个面向 OpenClaw 管理员的公开发布版技能,用于安全检查和操作 OpenAI OAuth 账号切换,并提供本地用量统计能力。

摩尔君公众号二维码
公众号:摩尔君

这是什么

这是 openai-auth-switcher 的公开发布版轨道,目标不是复制内部运行环境,而是提供一个 可发布、可移植、可审查 的 OpenClaw Skill,用于:

适合谁用

  • 已经在使用 OpenClaw 的管理员
  • 有多个 OpenAI OAuth 账号需要轮换管理的人
  • 希望把内部技能整理成可公开发布版本的人

不适合谁

  • 完全不了解 OAuth 凭据敏感性的普通用户
  • 希望一键托管所有账号登录流程的人
  • 需要官方账单级 token 统计的人

核心功能

doctor

检查 Python / Node / OpenClaw / 路径发现是否符合要求。

env_detect

发现 OpenClaw 根目录、workspace、agent 路径与 runtime 文件。

inspect_runtime

读取当前账号、provider、模型、最近异常与状态。

profile_slot

管理本地账号槽位元数据,便于切换与记录。

switch_experiment

执行受控切换实验,支持先 dry-run,再写入,再验证,失败自动回滚。

rollback_experiment

基于备份恢复到最近可用状态。

token_ledger

按会话 usage 与切换历史重建本地 token 归因账本。

hourly_usage

输出小时/天维度的本地统计数据,适合图表展示。

环境要求

快速开始

python3 skills/openai-auth-switcher-public/scripts/doctor.py --json
python3 skills/openai-auth-switcher-public/scripts/env_detect.py --json
python3 skills/openai-auth-switcher-public/scripts/inspect_runtime.py --json --include-status --include-sessions

常用命令

# 新增账号槽位
python3 skills/openai-auth-switcher-public/scripts/profile_slot.py create --slot account-a --display-name "主号A"

# dry-run 检查切换目标
python3 skills/openai-auth-switcher-public/scripts/switch_experiment.py --target-slot account-a --dry-run --json

# 执行受控切换实验
python3 skills/openai-auth-switcher-public/scripts/switch_experiment.py --target-slot account-a --json

# 回滚
python3 skills/openai-auth-switcher-public/scripts/rollback_experiment.py --last-known-good --json

# 本地 token 账本
python3 skills/openai-auth-switcher-public/scripts/token_ledger.py

# 小时/天统计
python3 skills/openai-auth-switcher-public/scripts/hourly_usage.py

# 打包
python3 skills/openai-auth-switcher-public/scripts/package_public_skill.py

安全边界

发布说明

推荐首发版本:0.1.0

推荐发布名称:OpenAI Auth Switcher Public

推荐 slug:openai-auth-switcher-public