简介
Codex Usage
原始描述
Manual Telegram slash-style command for Codex profile status and usage checks. Use when the user sends /codex_usage, /codex_usage default, /codex_usage all,...
通过你的 Agent 添加
安装目录:codex-usage/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: codex-usage description: Manual Telegram slash-style command for Codex profile status and usage checks. Use when the user sends /codex_usage, /codex_usage default, /codex_usage all, or /codex_usage , or asks to check openai-codex profile usage/limits/auth health.
Run scripts/codex_usage.py to produce a Codex profile report discovered from local auth profiles.
Safe defaults
/codex_usage is read-only.
- For mutations, require explicit confirmation and prefer
--dry-run first.
- See
RISK.md for allowed/denied operation boundaries.
UX requirements (cross-channel)
/codex_usage is read-only.--dry-run first.RISK.md for allowed/denied operation boundaries.Before running the script for a user-triggered /codex_usage request, send an immediate progress note:
- "Running Codex usage checks now…"
Then send final usage result when complete.
Interaction adapter
- If inline buttons are supported: show selector buttons (default / all / discovered profiles).
- If inline buttons are not supported: show text menu fallback (
default | all | <profile>).
- Apply duplicate-request suppression per user for ~20s to avoid accidental spam retries.
Commands
/codex_usage → MUST return selector buttons first (default / all / discovered profiles)
/codex_usage default
/codex_usage all
/codex_usage <profile>
/codex_usage delete <profile> (must require explicit confirmation before mutation)
How to run
default | all | <profile>)./codex_usage→ MUST return selector buttons first (default / all / discovered profiles)/codex_usage default/codex_usage all/codex_usage <profile>/codex_usage delete <profile>(must require explicit confirmation before mutation)
How to run
From workspace root:
python3 skills/codex-usage/scripts/codex_usage.py --profile all --timeout-sec 25 --retries 1 --debug
Profile-specific examples:
python3 skills/codex-usage/scripts/codex_usage.py --profile default --timeout-sec 25 --retries 1 --debug
python3 skills/codex-usage/scripts/codex_usage.py --profile openai-codex:default --timeout-sec 25 --retries 1 --debug
python3 skills/codex-usage/scripts/codex_usage.py --profile <suffix> --timeout-sec 25 --retries 1 --debug
Delete examples (with safeguards):
# preview only (required guard response without --confirm-delete)
python3 skills/codex-usage/scripts/codex_usage.py --delete-profile openai-codex:mine
# safe preview with explicit confirm but no file mutation
python3 skills/codex-usage/scripts/codex_usage.py --delete-profile openai-codex:mine --confirm-delete --dry-run
# safer default mutation: detach from order/lastGood only (keeps token/profile entry)
python3 skills/codex-usage/scripts/codex_usage.py --delete-profile openai-codex:mine --confirm-delete
# permanent delete: remove profile + usage entries (creates backup first)
python3 skills/codex-usage/scripts/codex_usage.py --delete-profile openai-codex:mine --confirm-delete --hard-delete
Safety posture
- No remote shell execution (
curl|bash, wget|sh) is allowed by this skill.
- No
sudo, SSH, or system service mutations are performed by this skill.
- Network calls are restricted to trusted Codex usage endpoint host allowlist (
chatgpt.com over HTTPS).
- Never print full tokens; treat callback/token material as sensitive.
Notes
- Reads OAuth credentials from
~/.openclaw/agents/main/agent/auth-profiles.json by default (override via --auth-path).
- Uses Codex usage endpoint:
https://chatgpt.com/backend-api/wham/usage.
- Endpoint is restricted to trusted HTTPS host allowlist (currently
chatgpt.com).
- If endpoint is unreachable, script falls back to local health-only output (no hard failure).
- If endpoint returns
401, script reports auth_not_accepted_by_usage_endpoint and keeps local profile health output instead of crashing.
401 in this path usually indicates the endpoint rejected current OAuth/session token format (not a missing Codex CLI install).
- Injects headers expected by Codex usage probe:
Authorization, ChatGPT-Account-Id (when present), User-Agent: CodexBar.
- Reports local profile health (expiry, last used, error/rate-limit counters) + remote windows (5h/week), allowed/limit-reached status.
- Reports user-friendly reset formatting (
reset_in, reset_at in host local timezone).
- Supports retries/timeouts and debug metadata (attempt, elapsed_ms, status) for diagnosis.
- Includes top-level
summary and suggested_user_message fields to simplify slash-command response formatting.
- Never print full tokens.
curl|bash, wget|sh) is allowed by this skill.sudo, SSH, or system service mutations are performed by this skill.chatgpt.com over HTTPS).- Reads OAuth credentials from
~/.openclaw/agents/main/agent/auth-profiles.jsonby default (override via--auth-path). - Uses Codex usage endpoint:
https://chatgpt.com/backend-api/wham/usage. - Endpoint is restricted to trusted HTTPS host allowlist (currently
chatgpt.com). - If endpoint is unreachable, script falls back to local health-only output (no hard failure).
- If endpoint returns
401, script reportsauth_not_accepted_by_usage_endpointand keeps local profile health output instead of crashing. 401in this path usually indicates the endpoint rejected current OAuth/session token format (not a missing Codex CLI install).- Injects headers expected by Codex usage probe:
Authorization,ChatGPT-Account-Id(when present),User-Agent: CodexBar. - Reports local profile health (expiry, last used, error/rate-limit counters) + remote windows (5h/week), allowed/limit-reached status.
- Reports user-friendly reset formatting (
reset_in,reset_atin host local timezone). - Supports retries/timeouts and debug metadata (attempt, elapsed_ms, status) for diagnosis.
- Includes top-level
summaryandsuggested_user_messagefields to simplify slash-command response formatting. - Never print full tokens.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。