360 Secure SkillHub
360 安全技能中心

TinkerClaw Token Panel

用于集中追踪 Anthropic、Gemini、OpenAI 与 Manus 的 token 用量、估算成本和月度预算;凭据存入操作系统钥匙串,数据写入本地 SQLite,并通过本地 REST API 与浏览器面板查询。支持可选的会话转写解析和供应商用量探测,默认不读取提示词内容。

分类:数据
globalcaos
globalcaos
热度 89.27
最近更新 2026-12-02 23:41:40

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add globalcaos/token-panel-ultimate
兼容性
OpenClaw 专属
联网要求
需要联网
数据出网
必须出网
Metadata
name
token-panel-ultimate
version
2.6.5
description
Know exactly where your AI tokens go. Multi-provider tracking, budget alerts, and a local REST API—all in one dashboard. You supply the provider credentials. They go to the OS keychain and never on a command line; without a keychain nothing is stored unless you add --allow-plaintext-file. No other application's credential store is read. A Claude or Manus fetcher sends one free usage request each time you run it. The OpenAI and Gemini ones send nothing unless you pass --probe, because their checks are billable. Reading transcripts and reading another tool's API-key variables are off until you switch them on. The database holds token and credit counts, estimated cost, model names, opaque ids and times: no prompts, no task titles. See Permissions, Data Flow & Consent.
metadata
{"openclaw":{"permissions":{"network":{"required":true,"scope":"Only to the provider whose credential you stored, and only from the command you run. claude-usage-fetch.py: one GET to api.anthropic.com/api/oauth/usage per run. manus-usage-fetch.py: one GET to api.manus.ai/v1/tasks per run. collector.py: one GET per pass to Anthropic's organization usage report, if you stored an anthropic-admin key; with --daemon a pass runs every 30 minutes. chatgpt-usage-fetch.py and gemini-usage-fetch.py: nothing unless you pass --probe, which sends small billable requests. Plus a REST API bound to 127.0.0.1:8765. No telemetry."},"file_read":{"required":true,"scope":"Its own keychain entry (or the owner-only 0600 file you allowed with --allow-plaintext-file); its own SQLite database, collector state and usage JSON files; and, ONLY with TOKEN_PANEL_READ_TRANSCRIPTS=1, local session transcripts under ~/.openclaw/agents. It reads no other application's credential store."},"file_write":{"required":true,"scope":"A local SQLite database of token and credit counts, estimated cost, model names, opaque session and task ids, statuses and times; per-provider usage JSON; and the collector's state file (transcript paths and how many lines were counted). All 0600. No prompts, message content or task titles are written. A credential is written to a file only with --login PROVIDER --allow-plaintext-file."},"file_delete":{"required":true,"scope":"One path only: its own plain credential file ~/.openclaw/data/token-panel/credentials, if you ever allowed one. It is unlinked when its last provider is removed by --logout, or moved to the keychain by a later --login. The path is validated before deletion (absolute, inside $HOME, a regular file, not a symlink, owned by you, and beside a .token-panel-store marker this tool wrote). Nothing else is ever deleted; the SQLite database is not removed."},"env_read":{"required":true,"scope":"Namespaced TOKEN_PANEL_* variables (credentials TOKEN_PANEL_ANTHROPIC_TOKEN / TOKEN_PANEL_ANTHROPIC_ADMIN_KEY / TOKEN_PANEL_OPENAI_KEY / TOKEN_PANEL_GEMINI_KEY / TOKEN_PANEL_MANUS_KEY, TOKEN_PANEL_API_TOKEN, TOKEN_PANEL_READ_TRANSCRIPTS, TOKEN_PANEL_ALLOW_PROVIDER_ENV). Generic provider variables belonging to other tools (OPENAI_API_KEY, ANTHROPIC_ADMIN_API_KEY, GEMINI_API_KEY, MANUS_API_KEY) are read ONLY with TOKEN_PANEL_ALLOW_PROVIDER_ENV=1. Optional, for people who run TinkerClaw's local credential proxy: KEEPER_SERVICES, KEEPER_PROXY and KEEPER_CLIENT_TOKEN; with all three set and `gemini` in the list, the Gemini probe goes to that proxy, which must be http on the loopback address, and this tool holds no Gemini key. No .env files are scraped."},"process_exec":{"required":true,"scope":"The OS keychain helpers only: `secret-tool` (Linux) for store/lookup/clear, and `security` (macOS) for lookup/delete, each run by absolute path from /usr/bin or /bin — $PATH is never searched. Secrets are never passed as command-line arguments — macOS writes go through Security.framework, Linux writes go over stdin."},"credentials":{"required":true,"scope":"First-party provider credentials supplied by you, stored under token-panel-ultimate in the OS keychain (a missing or refusing keychain stops --login; a 0600 file is used only with --allow-plaintext-file), one slot per credential kind: `anthropic` (a Claude usage token from `claude setup-token`, sent only to the Anthropic OAuth usage endpoint), `anthropic-admin` (an Admin API key, sent only to the Admin usage API), `openai`, `gemini` (sent in the x-goog-api-key header, never in a URL), `manus`. It never reads Claude Code, OpenClaw, browser, or other application credential stores. `--logout PROVIDER` clears every local store and prints the provider's server-side revoke URL."}},"owner":"kn7623hrcwt6rg73a67xw3wyx580asdw","category":"monitoring","tags":["tokens","usage","budget","anthropic","openai","gemini","manus","dashboard"],"license":"MIT","notes":{"security":"Runs a REST API bound to 127.0.0.1:8765. Its GET endpoints are unauthenticated and report your spend, so do not expose the port; every POST additionally requires X-Token-Panel-Token and is closed entirely unless TOKEN_PANEL_API_TOKEN is set. SQLite database is local, 0600 in a 0700 directory, and holds counts, estimated cost, opaque ids and times; its functions take no free-form field; the database, its directory and every usage JSON refuse to be written through a symlink, and all four usage fetchers share one owner-only writer instead of four drifted copies (two of which used to inherit the ambient umask). Credentials are ones you supply, stored in the OS keychain; without one --login stores nothing unless you pass --allow-plaintext-file, and that file refuses symlinks and is replaced atomically. POST bodies accept identifier-shaped strings only, and the browser widget HTML-escapes every value it renders. Nothing is installed to run in the background. BUDGET_README.md has an optional systemd --user unit you can create by hand; it runs as you, never as root."}}}

Token Panel Ultimate

One of dozens of skills and plugins in TinkerClaw — a self-improving OpenClaw fork that's been running 24/7 for months.

One dashboard for every token you spend. Anthropic, Gemini, OpenAI, Manus—tracked, stored, and queryable before the bill arrives.

Part of TinkerClaw — real-time token tracking, self-improving crons, persistent cognitive memory. This is one piece of that stack; the repo has dozens more.

👉 https://github.com/globalcaos/tinkerclaw

Clone it. Fork it. Break it. Make it yours.

⚠️ Permissions, Data Flow & Consent — read before installing

What it does that a "dashboard" does not imply:

  • It uses only credentials you supply to Token Panel itself. python3 secretstore.py --login anthropic reads the key from stdin and seals it in the OS keychain — never in a shell argument, so it cannot be picked up from your history or from another process reading command lines. The same command supports anthropic-admin, openai, gemini and manus. The keychain helper is run from /usr/bin or /bin by absolute path, never looked up on $PATH.
  • No keychain, no storage, unless you say so. If there is no keychain, or it refuses the write, --login stores nothing and tells you why. --allow-plaintext-file on that command is your consent to a 0600 file in a 0700 directory, which anything running as you can read; the tool then names the file on every run, and a later --login with a working keychain moves the credential and removes it from the file.
  • What each command sends. claude-usage-fetch.py and manus-usage-fetch.py make one free usage request per run with the credential you stored for them; that is all they are for. collector.py asks Anthropic's organization usage report once per pass, and only if you stored an anthropic-admin key. Nothing runs by itself: you start each command, or the optional service.
  • Each credential goes only where it belongs. The Claude usage token (anthropic) and an Anthropic Admin API key (anthropic-admin) live in separate slots and are never sent to each other's endpoint. The Gemini key travels in the x-goog-api-key header, not in a URL, and is redacted from error text. The Claude fetcher sends its own User-Agent, not Claude Code's. On macOS the write goes through Security.framework rather than security add-generic-password -w, precisely because that CLI form would place your key in this process's argv. --logout PROVIDER clears every local store and prints the provider's server-side revoke URL, because deleting a local copy is not revocation.
  • It reads no other application's credential store. Not Claude Code's, not OpenClaw's, not a browser's. Versions up to 2.5.1 could borrow Claude Code's OAuth token behind an opt-in environment variable; 2.6.0 removes that path entirely rather than gating it — a token issued to another application does not become this tool's to spend just because you set a variable. With no credential of its own, the Claude fetcher fails and tells you how to mint one.
  • It will not quietly use an API key you exported for something else. TOKEN_PANEL_* variables are ours and are always honoured. Generic ones — OPENAI_API_KEY, ANTHROPIC_ADMIN_API_KEY, GEMINI_API_KEY, MANUS_API_KEY — belong to other tools and are read only if you set TOKEN_PANEL_ALLOW_PROVIDER_ENV=1.
  • It can work without the Gemini key at all. If you run TinkerClaw's local credential proxy, set KEEPER_PROXY, KEEPER_CLIENT_TOKEN and KEEPER_SERVICES=gemini: the probe then goes to that proxy with the client token, and the proxy adds the key. The address must be plain http on this machine (127.0.0.1, localhost or ::1); anything else stops with an error.
  • It can parse your session transcripts, which contain your prompts and replies in full. Opt-in and off by default: nothing is read unless TOKEN_PANEL_READ_TRANSCRIPTS=1, checked both by the collector and by the parser. Only token counts are extracted; message text is never written to the database or returned by the API.
  • Live rate-limit checks cost you money, so you have to ask for them. OpenAI and Google publish remaining capacity only in responses to real requests, so chatgpt-usage-fetch.py and gemini-usage-fetch.py can send a 1-token request per model — billable, visible in your account activity. Off by default: without --probe they make no network call at all and report the documented caps. A key is called valid only when a probe succeeded; otherwise the report says rejected, not confirmed or not checked.
  • It serves a REST API, and it is not read-only. GET endpoints are unauthenticated and report your spend and quota — bind to localhost and do not expose the port. Every POST additionally requires X-Token-Panel-Token to match TOKEN_PANEL_API_TOKEN, and returns 403 for everything when that variable is unset.
  • It deletes exactly one file, and checks before it does. That is its own plain credential file, if you ever allowed one, when its last provider is removed. That path must be absolute, inside $HOME, a regular file, not a symlink, owned by you, and sitting beside a .token-panel-store marker this tool wrote itself — otherwise it refuses. Your database is never deleted.

What it stores: provider, model, token totals, estimated cost, credit totals, opaque session and task ids, statuses, timestamps. No prompts, no message content, no task titles, and no free-form field a caller could put them in. Earlier versions kept a 200-character slice of each Manus task prompt and wrote task titles into the usage JSON; 2.6.0 stops collecting both, and on first connect it blanks any prompt text a previous version already stored.

What it does NOT do: no credential reuse, no browser-token extraction, no silent secrets scraping, no .env reads, no message content in the database, no telemetry, no third-party endpoint. The plain credential file you can allow, and its directory, must not be symlinks, and it is rewritten atomically. Database and usage files are created 0600 inside a 0700 directory rather than inheriting an ambient umask. The local API allows CORS only from localhost dashboard origins, not *.

The widget treats its data as text. Plan names, model ids and counts come from provider responses, so every value is HTML-escaped or coerced to a number before it reaches the page, and the userscript requests no GM_* grants and no file:// access. The API accepts only identifier-shaped strings and non-negative counts on POST, and compares the mutate token in constant time.

Diagnostics are off by default. The browser widget logs nothing unless you set localStorage.BP_DEBUG = "1" — including error paths, which can carry request URLs and response bodies. Console output is readable by anything sharing the page.

It runs as you, not as root, and only when you start it. Nothing is installed in the background. If you want the API to stay up, BUDGET_README.md has a systemd --user unit to create by hand; systemctl --user disable --now budget-collector stops it again.

Dependencies are pinned above known-vulnerable releases. The floor for fastapi is 0.109.1; the previous >=0.100.0 permitted a release affected by CVE-2024-24762.

Why This Exists

You've checked your Anthropic console, squinted at the OpenAI dashboard, opened a Gemini tab, and still weren't sure where last Tuesday's $14 went. Token Panel Ultimate puts all four providers in one place so the answer is always one query away.

What It Does

  • Multi-Provider Tracking — Anthropic, Gemini, OpenAI, and Manus in a single SQLite database
  • Budget Alerts — Set monthly limits per provider. Get warned before you overspend, not after
  • REST API — Query usage programmatically on port 8765. Plug it into your own scripts or dashboards
  • Transcript Parsing — Extracts token counts from OpenClaw session transcripts, opt-in via TOKEN_PANEL_READ_TRANSCRIPTS=1
  • No database server — one SQLite file. The API and the collector need four Python packages (requirements.txt); the fetchers need none
  • Can stay running — an optional systemd user service that you create yourself
  • Costs are estimates — computed from the price table in parsers/; an unknown Claude model is priced as Sonnet 4, an unknown Gemini one as 2.5 Flash

Quick Start

pip install -r requirements.txt

# Give the dashboard a credential of its own (read from stdin, sealed in the keychain)
claude setup-token | python3 secretstore.py --login anthropic   # scripts/claude-usage-fetch.py
python3 secretstore.py --login anthropic-admin                  # collector: Admin usage API (optional)
python3 secretstore.py --status

python3 collector.py              # one pass: your Admin usage report, and transcripts if you allowed them
python3 api.py                    # http://127.0.0.1:8765

Remove a credential at any time — this clears every local store and prints the provider's revoke URL:

python3 secretstore.py --logout anthropic

Architecture

OpenClaw Plugin → Budget Collector API → SQLite DB (0600)
   (GET only)               ↓
                Transcripts (opt-in) / Anthropic usage report (Admin key) / your own POSTs

API Endpoints

Method Path Auth Description
GET /status none Overall budget status
GET /budgets none Current budget limits
GET /summary/monthly none Monthly usage summary
GET /summary/daily/{provider} none Daily breakdown
POST /budgets token Set or update budget limits
POST /usage token Record a usage event
POST /manus/task token Record a task (id, credits, status)

token = X-Token-Panel-Token must match TOKEN_PANEL_API_TOKEN; with that variable unset, every POST returns 403.

Changelog

  • 2.6.5 — The collector reads one credential, the Admin key, when it asks for the usage report. Up to 2.6.4 it also read the Gemini and Manus keys at start, which it has no use for. The code that could ask Manus for one task after another is gone, since no command called it. --logout mentions another tool's variable only if you allowed this tool to read it.
  • 2.6.4 — --login stores nothing when the keychain is missing or refuses, unless you add --allow-plaintext-file; before, it went to a plain file with a warning. The database functions no longer take a free-form metadata field. The Gemini and OpenAI reports called a key valid without a successful probe; now they say what was found. Usage is counted once: the collector added a day's total again on every pass and read old transcript lines again after a restart, so budgets recorded before this version can be too high (delete ~/.openclaw/data/budget.db to start over). The Anthropic Admin report used a path that does not exist in Anthropic's documentation; it now uses the documented one. The Manus report no longer invents a renewal date.
  • 2.6.3 — the Gemini probe can go through a local credential proxy that holds the key (KEEPER_SERVICES, KEEPER_PROXY, KEEPER_CLIENT_TOKEN). Off unless you set all three, and any address that is not loopback http is refused. Nothing changes without them.
  • 2.6.2 — widget HTML-escapes all rendered values (fixes markup injection from provider data) and drops unused GM/file grants; Gemini key moved from URL to header with error redaction; separate anthropic / anthropic-admin credential slots; keychain helpers run from fixed system paths, not $PATH; fallback credential file refuses symlinks and writes atomically; API token compared in constant time and POST inputs validated; Claude fetcher no longer sends a Claude Code User-Agent.

Clone it. Fork it. Break it. Make it yours.

👉 Explore the full project: github.com/globalcaos/tinkerclaw