Codex Profiler
/install codex-profiler
✅ Maintained path: use
codex-profilerfor all Codex profile operations. Standalonecodex-usageandcodex-authskills are deprecated.
This skill consolidates both scripts:
scripts/codex_usage.py(usage/limits)scripts/codex_auth.py(OAuth helper for start/status)
For auth/profile mutation, this skill now standardizes on gateway-native openclaw models auth ... commands.
Safe defaults
- Usage checks are read-only by default.
- Auth state is runtime-managed; one-shot direct file edits are unreliable and can be overwritten by in-memory/cooldown state.
- Treat
auth-profiles.jsonas gateway-managed state. Never mutate it directly in normal operations. - Prefer gateway-native auth mutation commands (
openclaw models auth ...,openclaw models auth order ...) over script-level file writes. - Use dry-run/read-only preflight first, then apply, then verify (strict anti-drift flow below).
- See
RISK.mdfor allowed/denied operation boundaries.
Commands
Usage
/codex_usage→ selector (default / all / discovered profiles)/codex_usage \x3Cprofile>
Auth
/codex_auth→ selector (profiles)/codex_auth \x3Cprofile>/codex_auth finish \x3Cprofile> \x3Ccallback_url>(helper only; profile/order mutation must use gateway-native commands)
UX requirements (cross-channel)
For /codex_usage, send immediate progress message first as a separate message:
- "Running Codex usage checks now…"
Delivery rule:
- If progress is sent through channel message tool path, send final result through the same path (same target/session), then return
NO_REPLY. - Avoid mixed delivery (tool progress + plain reply final).
For auth/profile/order mutation, warn that writes are gateway-managed and enforce verify-after-apply:
- "I will apply this via
openclaw models auth ...and then verify withmodels status+auth order get." - "I won’t hand-edit auth files directly because runtime state can drift/overwrite one-shot edits."
Interaction adapter
- If inline buttons are supported: use selector buttons.
- If inline buttons are not supported: use text fallback prompts.
- Apply duplicate-request suppression per user for ~20s.
- Never echo full callback URLs in responses.
Profile removal policy (MANDATORY)
- Best method (default): operational retire, not hard delete
- Remove the target profile from active provider order (
openclaw models auth order set ...) so it is never selected. - Keep profile data intact unless the user explicitly requests permanent deletion.
- Remove the target profile from active provider order (
- Hard delete only on explicit user instruction
- Perform permanent profile deletion only when the user clearly asks to hard delete/remove permanently.
- If gateway-native delete is unavailable in the installed OpenClaw version, do not improvise risky live edits; use a controlled maintenance window flow.
Strict anti-drift auth mutation flow (MANDATORY)
For auth/profile/order changes, use this exact 3-step flow:
- Preflight (read-only)
openclaw models status --json
openclaw models auth order get --provider openai-codex --agent \x3Cagent-id>
- Apply (gateway-native command)
openclaw models auth order set --provider openai-codex --agent \x3Cagent-id> \x3Cprofile1> \x3Cprofile2>
# or
openclaw models auth order clear --provider openai-codex --agent \x3Cagent-id>
# or provider login flow
openclaw models auth login --provider openai-codex
- Verify (post-apply, no assumptions)
openclaw models status --json
openclaw models auth order get --provider openai-codex --agent \x3Cagent-id>
Never skip verification. If results mismatch expectation, do not hand-edit files; diagnose and re-apply via gateway-native commands.
How to run
# Usage checks (read-only)
python3 skills/codex-profiler/scripts/codex_usage.py --profile all --timeout-sec 25 --retries 1 --debug
python3 skills/codex-profiler/scripts/codex_usage.py --profile all --format text
# OAuth helper (callback parsing/status only)
python3 skills/codex-profiler/scripts/codex_auth.py start --profile default
python3 skills/codex-profiler/scripts/codex_auth.py status
Safety posture
- No remote shell execution (
curl|bash,wget|sh) is allowed by this skill. - No
sudo/SSH/system-level host mutation commands are part of this skill path. - Usage checks are restricted to trusted HTTPS endpoint host allowlist (
chatgpt.com). - Callback URLs and token material must be treated as sensitive and never echoed in full.
Multi-account rotation guidance
When asked about running multiple Codex accounts/profiles, rotation policy, or fallback strategy, read:
references/multi-account-rotation.md
Use the short template for quick chat answers and the deep-dive template for setup/troubleshooting requests.
Notes
- Uses auth profiles at
~/.openclaw/agents/main/agent/auth-profiles.jsonby default. - Current source of truth is
auth-profiles.json;auth.jsonis legacy compatibility and should not be used as primary state. - If profile routing behaves unexpectedly, check for mixed state (missing/stale
auth-profiles.json, leftover legacy files, or stale runtime cooldown) before assuming model fallback bugs. - Same
accountIdacross two profile labels is not automatically a defect. In this environment, multiple labels can map to the same workspace/account identity while still operating correctly. Treat it as healthy when both profiles are auth-valid and usable in/codex_usage; investigate only when auth failures or routing failures appear. - Codex usage endpoint:
https://chatgpt.com/backend-api/wham/usage. - Usage script now surfaces
401asauth_not_accepted_by_usage_endpointwith a clear hint, while still returning local profile health. - Usage output now includes top-level
summary,formatted_profiles, andsuggested_user_messagefor cleaner slash-command formatting. - Preferred strict output format for
/codex_usage(single line per profile):🟢 \%profile%` — 5h %5h_left% | week %week_left% | r5 %5h_reset% | rw %week_reset%`- Use
🟠when limited and🔴when unusable/auth-invalid. - No preface, no table, no trailing summary unless explicitly requested.
- OAuth flow: OpenAI auth endpoints + localhost callback on port 1455.
- Preferred mutation path is gateway-native (
openclaw models auth .../openclaw models auth order ...) with mandatory preflight + verify. codex_auth.py status --profile \x3Cprofile>remains useful for per-profile helper status checks.- Keep temporary payload/token artifacts only until verification succeeds, then clean them up.
- Codex CLI installation is not required for usage endpoint reads in this skill path.
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install codex-profiler - 安装完成后,直接呼叫该 Skill 的名称或使用
/codex-profiler触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Codex Profiler 是什么?
Manage OpenAI Codex profiles via Telegram commands for usage checks and OAuth token refresh with queued safe apply and progress updates. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 586 次。
如何安装 Codex Profiler?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install codex-profiler」即可一键安装,无需额外配置。
Codex Profiler 是免费的吗?
是的,Codex Profiler 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Codex Profiler 支持哪些平台?
Codex Profiler 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Codex Profiler?
由 DeadlySilent(@deadlysilent)开发并维护,当前版本 v1.0.27。