# Model Usage

> Track and display LLM token usage, costs, and model statistics. Use when: user asks about token usage, API costs, how many messages were sent, or model performance stats. NOT for: changing the model or provider (use change_setting), or viewing conversation content (use session_logs).

- **Type:** Skill
- **Install:** `agentstack add skill-ericwang915-pythonclaw-model-usage`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [ericwang915](https://agentstack.voostack.com/s/ericwang915)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [ericwang915](https://github.com/ericwang915)
- **Source:** https://github.com/ericwang915/PythonClaw/tree/main/pythonclaw/templates/skills/system/model_usage
- **Website:** https://github.com/ericwang915/PythonClaw

## Install

```sh
agentstack add skill-ericwang915-pythonclaw-model-usage
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Model Usage

Track and display LLM token usage, costs, and session statistics.

## When to Use

✅ **USE this skill when:**

- "How many tokens have I used?"
- "What's my API cost so far?"
- "Show me model usage stats"
- "How many messages in this session?"
- "Which model am I using?"

## When NOT to Use

❌ **DON'T use this skill when:**

- Changing the LLM model or provider → use `change_setting`
- Viewing conversation content → use `session_logs`
- Checking system status → check agent status directly

## Usage

### Current session stats

```bash
python {skill_path}/usage_stats.py
```

### Check detailed interaction log

The `history_detail.jsonl` file under `~/.pythonclaw/context/logs/` contains
structured records of every agent interaction, including:

- Input messages
- Tool calls and results
- LLM responses
- Timestamps

```bash
python {skill_path}/usage_stats.py --log ~/.pythonclaw/context/logs/history_detail.jsonl
```

### Quick stats via jq (if installed)

```bash
# Count total interactions
wc -l ~/.pythonclaw/context/logs/history_detail.jsonl

# Recent entries
tail -5 ~/.pythonclaw/context/logs/history_detail.jsonl | python -m json.tool
```

## Notes

- Token counts are estimates based on message length
- Cost calculation requires knowing the model's pricing (not tracked automatically)
- The `history_detail.jsonl` is append-only and grows over time
- Use `/status` command in chat for quick session info

## Resources

| File | Description |
|------|-------------|
| `usage_stats.py` | Parse and summarise usage from history logs |

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [ericwang915](https://github.com/ericwang915)
- **Source:** [ericwang915/PythonClaw](https://github.com/ericwang915/PythonClaw)
- **License:** MIT
- **Homepage:** https://github.com/ericwang915/PythonClaw

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-ericwang915-pythonclaw-model-usage
- Seller: https://agentstack.voostack.com/s/ericwang915
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
