← 返回 Skills 市场
zhaobudaoyuema

Prompt Token Counter

作者 Zhaobudaoyuema · GitHub ↗ · v1.0.11 · MIT-0
cross-platform ✓ 安全检测通过
345
总下载
0
收藏
2
当前安装
12
版本数
在 OpenClaw 中安装
/install prompt-token-counter
功能描述
Count tokens and estimate costs for 300+ LLM models. Primary use: audit OpenClaw workspace token consumption (memory, persona, skills).
安全使用建议
This skill appears internally consistent with its purpose, but it legitimately reads sensitive OpenClaw workspace files (AGENTS.md, SOUL.md, MEMORY.md, SKILL.md, etc.). Before installing: (1) review scripts/cli.py and scripts/core.py if you are concerned about data flow; (2) run the CLI locally in an isolated environment against test files to confirm behavior; (3) do not allow URL fetches unless you explicitly confirm each URL (the SKILL.md requires confirmation — ensure the agent follows that); (4) you only need to provide API keys if you intentionally run the example 'API mode' benchmark (otherwise no credentials are required); (5) if your workspace contains secrets, avoid installing or run the tool on a copy of the workspace. If you want stronger assurance, ask the maintainer for a signed release or audit the code paths that read ~/.openclaw/openclaw.json and the workspace to confirm there is no unexpected network exfiltration.
功能分析
Type: OpenClaw Skill Name: prompt-token-counter Version: 1.0.11 The prompt-token-counter bundle is a legitimate utility designed to estimate LLM token usage and API costs. It includes a Python-based CLI (scripts/cli.py) and core logic (scripts/core.py) that support over 300 models. While the skill is designed to read sensitive OpenClaw configuration files (e.g., AGENTS.md, SOUL.md) and fetch content from URLs, these actions are aligned with its stated purpose of auditing workspace token consumption. Crucially, the SKILL.md file includes defensive instructions requiring the AI agent to warn users about SSRF risks and obtain explicit confirmation before making outbound network requests. No evidence of data exfiltration, malicious execution, or obfuscation was found.
能力评估
Purpose & Capability
Name/description align with the code and instructions. The skill explicitly targets counting tokens and auditing OpenClaw workspace components (AGENTS.md, SOUL.md, SKILL.md, etc.), which explains why it reads those files and provides model pricing/registry data.
Instruction Scope
SKILL.md and the CLI explicitly instruct reading files under ~/.openclaw/workspace and ~/.openclaw/skills to perform an audit — this is sensitive but coherent with the stated audit purpose. The CLI also supports HTTP(S) fetches (urllib.request.urlopen) but SKILL.md mandates asking the user and confirming trust before any URL is fetched. Verify the runtime agent actually enforces that confirmation rather than auto-invoking URL fetches.
Install Mechanism
No install spec is provided (instruction-only install path), so there is no remote download/install mechanism to review. The package contains Python source files bundled with the skill; there are no external installers or obscure download URLs.
Credentials
The skill declares no required environment variables or credentials. Some example scripts reference optional API_KEY/BASE_URL and the README notes optional tiktoken for exact OpenAI counts — these are optional and used only for benchmarking/API mode. There is no unexplained request for unrelated secrets.
Persistence & Privilege
always is false and the skill does not request permanent platform privileges. Autonomous invocation is allowed by default (normal), but there are no indicators this skill modifies other skills or global configs.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install prompt-token-counter
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /prompt-token-counter 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.11
**Changelog for version 1.0.11:** - Updated documentation and CLI usage for consistency: now supports batch mode by default, allowing multiple file paths directly as arguments (no segmentation). - Clarified example commands to demonstrate batch mode and simplified file handling syntax. - README and usage examples emphasize file-path-first usage and streamlined batch counting. - No core logic/code changes; this release is focused on improved documentation and clearer workflow presentation.
v1.0.10
Version 1.0.10 - Updated version string in scripts/__init__.py to 1.0.10. - Added benchmark_token_ratio.py to the __all__ list for scripts.examples. - No user-facing functionality changes.
v1.0.9
- Migrated example scripts from shell (.sh/.ps1) to Python (.py) for improved cross-platform support. - Added new example Python scripts: count_prompt.py, estimate_cost.py, and batch_compare.py. - Removed previous shell script examples: count_prompt.sh, estimate_cost.sh, batch_compare.sh. - Updated documentation in SKILL.md to reflect these changes and provide new example usage. - No changes to core functionality or CLI/API; only example and documentation updates.
v1.0.8
- Removed the sample file scripts/examples/token_ratio_report.md from the repository. - No changes to functionality or user-facing features. - Documentation and usage remain unchanged.
v1.0.7
- Added benchmark example script (scripts/examples/benchmark_token_ratio.py) and a token ratio report (scripts/examples/token_ratio_report.md) - Updated core logic and tests to support new examples and benchmarking - Improved documentation in README.md and README.zh.md for ease of use - Version bump and metadata sync in package.json and SKILL.md
v1.0.6
**Changelog for version 1.0.6** - Added initial automated tests to the project (`tests/__init__.py`, `tests/test_main_models.py`). - Improved and updated documentation in `README.md`, `README.zh.md`, and `SKILL.md`. - Made minor updates and housekeeping in code files, such as `scripts/core.py` and `scripts/registry/models.py`. - Updated package metadata in `package.json`.
v1.0.5
- Updated internal version number in scripts/__init__.py to 1.0.5. - No user-facing features or behavioral changes.
v1.0.4
Version 1.0.7 - Added a clear security & privacy section to SKILL.md, informing users about file access and safe usage practices. - Updated documentation to better warn about risks of URL fetching and encourage source review. - Version bumped for sync across SKILL.md, package.json, and scripts/__init__.py. - No code or CLI behavior changes.
v1.0.3
prompt-token-counter 1.0.6 - Updated version numbers in SKILL.md and package.json for release sync. - No functional or CLI/API changes; this is a version and metadata update only.
v1.0.2
**New agent rules and safety guardrails for URL fetching and model selection.** - Added mandatory agent rules: explicitly warn and confirm with users before fetching content from URLs (`-u`), including explaining SSRF/data risks and requiring confirmation for untrusted URLs. - Now requires agents to obtain an exact model name (`-m`) from the user before invoking the CLI; do not guess or assume—ask and confirm if unclear. - Updated CLI usage and option documentation to reflect stricter requirements for URL and model handling. - Clarified correct user-agent interaction workflow in SKILL.md. - Bumped version in SKILL.md and package.json.
v1.0.1
- Added example scripts for batch comparison, prompt counting, and cost estimation under scripts/examples/. - Project layout updated: all CLI examples now moved from the top-level examples/ directory to scripts/examples/. - Added package.json for npm publishing support; project is now also an npm package. - Added README.zh.md for Chinese documentation. - Introduced publish_npm.py for automated version and metadata sync across package.json, SKILL.md, and scripts/__init__.py. - SKILL.md refined with detailed trigger rules, new project structure, and publishing/versioning instructions.
v1.0.0
Initial release—prompt-token-counter v1.0.0 - Counts tokens and estimates costs for 300+ LLM models, supporting a wide range of providers. - Primary focus: auditing OpenClaw workspace token consumption, including memory files, persona files, and skills. - Includes CLI utility (`python -m scripts.cli`) for counting tokens, estimating API costs, and model listing. - Provides Python API for integration and scripting needs. - Detailed audit workflows, usage examples, and troubleshooting guidance in SKILL.md. - Language responses match the user's input language.
元数据
Slug prompt-token-counter
版本 1.0.11
许可证 MIT-0
累计安装 2
当前安装数 2
历史版本数 12
常见问题

Prompt Token Counter 是什么?

Count tokens and estimate costs for 300+ LLM models. Primary use: audit OpenClaw workspace token consumption (memory, persona, skills). 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 345 次。

如何安装 Prompt Token Counter?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install prompt-token-counter」即可一键安装,无需额外配置。

Prompt Token Counter 是免费的吗?

是的,Prompt Token Counter 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Prompt Token Counter 支持哪些平台?

Prompt Token Counter 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Prompt Token Counter?

由 Zhaobudaoyuema(@zhaobudaoyuema)开发并维护,当前版本 v1.0.11。

💬 留言讨论