Lines 1-39javascript
3// tokmax — scan local Codex + Claude Code logs, aggregate per-model token
4// usage, preview the API-equivalent $, and publish the aggregate to the
5// tokmax leaderboard (tokmax.dev).
8// npx tokmax → interactive onboarding (Quick anonymous OR Sign in with X)
9// npx tokmax <nick> → fast direct anonymous path (no prompts)
10// npx tokmax login → Sign in with X (nick = your @handle, multi-machine)
11// npx tokmax logout → sign out on this machine (logout --all = every machine)
12// npx tokmax publish → non-interactive publish using the saved token (daily job)
13// npx tokmax daily ... → on | off | status for the daily auto-update
15// SAFETY INVARIANT: only numeric token aggregates per model + dates leave this
16// machine. Never prompt text, file contents, API keys, or raw log lines.
18import path from 'node:path';
19import readline from 'node:readline';
20import { spawn } from 'node:child_process';
21import { readFile } from 'node:fs/promises';
HighSandbox Evasion Gated Capability
Source gates dangerous network, credential, or execution behavior behind CI, host, platform, time, or geo fingerprint checks.
bin/tokmax.mjsView on unpkg · L19 22import { fileURLToPath } from 'node:url';
24import { scanClaudeCode } from '../src/adapters/claude-code.mjs';
25import { scanCodex } from '../src/adapters/codex.mjs';
26import { aggregate } from '../src/aggregate.mjs';
31 aggregateDailyModelSpend,
34} from '../src/pricing.mjs';
35import { publish } from '../src/publish.mjs';
36import { anonymousMachineLabel } from '../src/util.mjs';