Skip to content

clawSean/tide-pools-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Tide Pools v2 ๐ŸŒŠ๐Ÿฆž

Provider usage at a glance โ€” with dashboard-accurate numbers and session breakdowns.


What changed in v2

v1 had one source per provider: openclaw status --usage. v2 introduces source adapters that hit provider APIs directly for more accurate data, plus an enrichment layer that mines session logs to show where your usage went.

Architecture

Layer 1 (Accuracy)     โ†’ Adapter registry: direct provider APIs with fallback
Layer 2 (Enrichment)   โ†’ Session JSONL mining: per-session token breakdown

Layer 2 is 100% optional. If it fails, the report renders perfectly without it.


Commands

Command Description
/tidepools Tide-themed report (providers + session breakdown)
/quota_all Plain report (supports flags below)

Flags on /quota_all

Flag Effect
--json JSON output
--no-venice Skip Venice/Diem probe
--no-enrich Skip session JSONL enrichment
--no-cache Bypass cache
--cache-ttl-ms N Override cache TTL (default: 45000)
--lookback-hours N Enrichment lookback period (default: 24)
`--anthropic-source auto api

Source Adapters

Adapter Provider Source Priority
openai-codex-oauth OpenAI/Codex ~/.codex/auth.json โ†’ OAuth usage API Direct (primary)
anthropic-cli-usage Anthropic (subscription) Claude CLI /usage via tmux session Direct (primary for subscription mode)
openrouter-api OpenRouter OpenRouter /credits + /key endpoints Direct (primary)
venice-diem Venice Diem plugin script โ†’ HTTP headers Direct (primary)
openclaw-status All openclaw status --usage --json Fallback (and Anthropic API mode source)

Direct adapters take priority. If they fail or aren't available, openclaw-status fills the gap.


OpenRouter

Requirements: An OpenRouter API key accessible by one of these methods (checked in order):

  1. Environment variable: OPENROUTER_API_KEY, OPENROUTER_KEY, or OPEN_ROUTER_API_KEY
  2. OpenClaw auth-profiles: any auth-profiles.json under ~/.openclaw/agents/*/agent/ with provider: "openrouter" and type: "api_key"

If you've already onboarded OpenRouter as an OpenClaw provider, the key is already in auth-profiles and no extra setup is needed.

How it works: Two direct HTTPS calls to OpenRouter โ€” GET /api/v1/key (key-level usage/limits) and GET /api/v1/credits (account-wide balance; may require a management key).

If OpenRouter doesn't show up: No API key was found. Either set the env var or onboard OpenRouter via openclaw onboard --auth-choice openrouter-api-key.

Optional env overrides: OPENROUTER_API_URL, OPENROUTER_HTTP_REFERER, OPENROUTER_X_TITLE.


Codex (OpenAI)

Requirements: The Codex CLI must have been logged in at least once to create ~/.codex/auth.json. The CLI does not need to be running.

npm install -g @openai/codex
codex auth

How it works: Reads the saved OAuth token from ~/.codex/auth.json and makes a direct HTTPS call to OpenAI's usage endpoint โ€” the same source the web dashboard uses.

If Codex doesn't show up: The file ~/.codex/auth.json doesn't exist. Install the Codex CLI and run codex auth once. After that, Tide Pools will pick it up automatically. If the token has expired, you may need to run codex auth again.

Note: Codex data will still appear via the openclaw-status fallback even without this adapter, but with less detail (no per-window breakdown).


Anthropic (Claude subscription)

Requirements: Both claude (Claude Code CLI) and tmux must be installed and on $PATH.

# Claude Code โ€” see https://docs.anthropic.com/en/docs/claude-code
npm install -g @anthropic-ai/claude-code

# tmux โ€” usually available via your system package manager
apt install tmux     # Debian/Ubuntu
brew install tmux    # macOS

How it works: Creates a background tmux session running claude, sends the /usage slash command, and parses the terminal output. This is the only way to get Claude subscription quota data (5-hour window, weekly window, extra usage) โ€” Anthropic does not expose a public API for this.

On first run, the Claude CLI may prompt to "trust this folder." The adapter handles this automatically by accepting the prompt. It also retries from scratch if the session is in a broken state.

If Anthropic doesn't show up or says "no quota windows":

  • claude or tmux not installed โ†’ adapter is silently skipped, falls back to openclaw-status
  • Claude CLI not logged in โ†’ /usage output won't contain subscription windows
  • tmux session in a bad state โ†’ adapter retries once automatically; if it still fails, check with tmux capture-pane -t claude_usage_cmd -p to see what Claude is showing

Optional env overrides:

  • TIDE_POOLS_ANTHROPIC_TMUX_SESSION (default: claude_usage_cmd)
  • TIDE_POOLS_ANTHROPIC_CLAUDE_CMD (default: claude)
  • TIDE_POOLS_ANTHROPIC_TIMEOUT_MS (default: 20000)

Anthropic source modes

  • auto (default): uses direct Claude /usage data when subscription windows are present; falls back to openclaw status --usage for API-style usage.
  • api: disables Claude /usage adapter and forces Anthropic data from openclaw status fallback.
  • subscription: requires Claude /usage subscription windows (same source as Anthrometer).

Enrichment

When enabled (default), Tide Pools scans recent session JSONL logs to show:

  • Per-session token usage (which sessions burned what)
  • Cost breakdown (when pricing data available)
  • Total tokens and cost for the lookback period

This data comes from OpenClaw's own session logs โ€” it answers "where did my usage go?" while the adapters answer "how much do I have left?"

Fault-isolated: If enrichment fails for any reason (missing files, parse errors, permission issues), the main provider report still renders cleanly. The session breakdown section simply doesn't appear.


Installation

Put the plugin in your OpenClaw extensions:

~/.openclaw/extensions/
โ””โ”€โ”€ tide-pools/
    โ”œโ”€โ”€ openclaw.plugin.json
    โ”œโ”€โ”€ index.ts
    โ”œโ”€โ”€ usage-core.mjs
    โ”œโ”€โ”€ enrichment.mjs
    โ”œโ”€โ”€ cli.mjs
    โ”œโ”€โ”€ adapters/
    โ”‚   โ”œโ”€โ”€ index.mjs
    โ”‚   โ”œโ”€โ”€ openclaw-status.mjs
    โ”‚   โ”œโ”€โ”€ openai-codex-oauth.mjs
    โ”‚   โ”œโ”€โ”€ anthropic-cli-usage.mjs
    โ”‚   โ”œโ”€โ”€ openrouter-api.mjs
    โ”‚   โ””โ”€โ”€ venice-diem.mjs
    โ””โ”€โ”€ README.md

Ensure your openclaw.json includes:

  • plugins.allow contains "tide-pools"
  • plugins.entries["tide-pools"].enabled = true

Restart gateway. โœ…


Example Output

๐ŸŒŠ Tide Pools

๐Ÿ›ฐ๏ธ Providers
โ€ข Anthropic Claude [subscription]: 5h: 99% left (in 4h 3m) | week: 22% left (in 3d 16h) โ€” via Claude /usage
  โ””โ”€ ๐Ÿ’ณ Extra usage: status enabled ยท $5.75 / $5.00 spent ยท $0.00 available ยท reset in 24d
โ€ข OpenRouter: credits: $0.35 / $20.00 (2% used) | balance: $19.65 | key limit: $0.35 / $5.00 (93% left) โ€” via OpenRouter API
โ€ข Venice [Diem]: Diem: 0.0000 โ€” via Diem API
โ€ข Codex [team]: 5h: 99% left (in 4h 17m) | Week: 88% left (in 5d 6h) โ€” via OpenClaw status

๐Ÿงฎ Usage ยท last 24h
โ€ข Groups: 11.5M tok ยท $6.10 (4)
โ€ข Cron: 724K tok ยท $0.52 (6)
โ€ข DMs: 153K tok ยท $0.09 (1)

๐Ÿค– Top model(s)
โ€ข google/gemini-3.1-flash-lite: 10.4M tok ยท $4.87
โ€ข gpt-5.3-codex: 2.0M tok ยท $1.83

๐Ÿ’ฐ Total
โ€ข 12.4M tok ยท $6.71

Made with saltwater and stubbornness. ๐ŸŒŠ๐Ÿฆž๐Ÿ’™

About

๐ŸŒŠ๐Ÿฆž Tide Pool: no-LLM OpenClaw quota board commands (/tide_pool, /quota_all) with optional Venice augmentation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors