← Back to Skills Marketplace
Prompt Token Counter
by
Zhaobudaoyuema
· GitHub ↗
· v1.0.11
· MIT-0
345
Downloads
0
Stars
2
Active Installs
12
Versions
Install in OpenClaw
/install prompt-token-counter
Description
Count tokens and estimate costs for 300+ LLM models. Primary use: audit OpenClaw workspace token consumption (memory, persona, skills).
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install prompt-token-counter - After installation, invoke the skill by name or use
/prompt-token-counter - Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Frequently Asked Questions
What is Prompt Token Counter?
Count tokens and estimate costs for 300+ LLM models. Primary use: audit OpenClaw workspace token consumption (memory, persona, skills). It is an AI Agent Skill for Claude Code / OpenClaw, with 345 downloads so far.
How do I install Prompt Token Counter?
Run "/install prompt-token-counter" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Prompt Token Counter free?
Yes, Prompt Token Counter is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Prompt Token Counter support?
Prompt Token Counter is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Prompt Token Counter?
It is built and maintained by Zhaobudaoyuema (@zhaobudaoyuema); the current version is v1.0.11.
More Skills