# Token Monitor — environment configuration. # Copy to .env (gitignored) and fill in. Only needed for the hub and the # headless agent; the widget can also read these as first-run defaults # before its GUI settings take over. # Hub URL — required for the agent and for any widget in sync mode. # Leave empty for single-device local mode (widget reads files directly, no hub). # Example: https://token-monitor-hub..workers.dev or http://192.168.1.10:17321 TOKEN_MONITOR_HUB_URL= # Shared secret — must match on the hub, agent, and any widget that syncs. # Leave empty to run the hub without authentication (not recommended). # Generate a random one with: openssl rand -hex 32 TOKEN_MONITOR_SECRET= # Device identifier. Optional — defaults to the machine hostname. TOKEN_MONITOR_DEVICE_ID= # Widget sync upload cadence. Optional — defaults to live uploads. # Accepted values: 0 (live), 600000 (10 min), 1200000 (20 min), 1800000 (30 min). # Used as a first-run default; a saved GUI setting takes precedence. TOKEN_MONITOR_SYNC_UPLOAD_INTERVAL_MS=0 # Comma-separated client list. Optional — leave unset to track all supported tools. # Set to empty to disable tracking. # Example: claude,codex,opencode,hermes,openclaw,cursor,antigravity,cline,amp,droid,kimi,qwen,grok,copilot,pi,omp,zed,kilo,commandcode,mimo,zcode,kiro,codebuddy,workbuddy,proma,reasonix,dsh,cherrystudio,lmstudio,unsloth,devin # Open Code Review is opt-in: append open-code-review to enable its local JSONL usage. TOKEN_MONITOR_CLIENTS=claude,codex,opencode,hermes,openclaw,cursor,antigravity,cline,amp,droid,kimi,qwen,grok,copilot,pi,omp,zed,kilo,commandcode,mimo,zcode,kiro,codebuddy,workbuddy,proma,reasonix,dsh,cherrystudio,lmstudio,unsloth,devin # File-watch strategy — override how client data directories are watched. # Optional. The default is native filesystem events on every platform, in every # collection mode, and in the headless agent. If the OS refuses to hand out # watch descriptors (a per-user budget shared with editors), the collector falls # back to polling on its own, so this is only for filesystems that accept the # watch and then never deliver an event. Overrides both directions: # 1 — force polling. Use when usage stops updating because the tool data lives # somewhere native events never fire: network mounts (SMB/NFS), some FUSE # drivers, container bind mounts. Costs idle CPU, so leave unset unless # updates are actually stalling. # 0 — never poll, including as that automatic fallback. Updates then stop # until watch descriptors free up, so this is for measurement, not for # everyday use. TOKEN_MONITOR_WATCH_POLLING= # Projects — attribute sessions to the workspace they ran in, for the Projects view. # Optional — defaults to enabled. Set to 0 to disable. TOKEN_MONITOR_PROJECTS_ENABLED= # Usage Trends — collect historical trend data for the Trends dashboard. # Optional — defaults to enabled. Set to 0 to disable. TOKEN_MONITOR_HISTORY_ENABLED= # Windows widget only: include CC-Switch's local Claude proxy usage when it can # be separated from dated local Claude sessions. Optional; defaults to off. TOKEN_MONITOR_CC_SWITCH_CLAUDE= # Preserve deleted session usage — archive observed daily usage so heatmap/trend # history survives after a tool prunes its own sessions. # Optional — defaults to enabled. Set to 0 to disable. TOKEN_MONITOR_SESSION_USAGE_ARCHIVE_ENABLED= # AI Tool Limits — detect supported provider session, daily, weekly, billing, and credit windows. # Optional — defaults to enabled. Set to 0 to disable entirely (skips probing the local CLIs). TOKEN_MONITOR_LIMITS_ENABLED= # Providers to probe. Optional — omitting this setting enables all supported providers # (claude, codex, opencode, cursor, antigravity, factory, kimi, grok, copilot, zed, commandcode, mimo, zai, zaiteam, kiro, workbuddy, qoder, deepseek, openrouter, minimax, volcengine, ollama, trae, alibaba, thirdparty). # Example: claude,codex (probe only Claude Code and Codex) # An explicitly empty value probes none. TOKEN_MONITOR_LIMIT_PROVIDERS=claude,codex,opencode,cursor,antigravity,factory,kimi,grok,copilot,zed,commandcode,mimo,zai,zaiteam,kiro,workbuddy,qoder,deepseek,openrouter,minimax,volcengine,ollama,trae,alibaba,thirdparty # How often limits are refreshed. Optional — `fixed` (default) polls on the interval # below; `adaptive` polls every 5 minutes and refreshes a provider sooner when its # quota is being consumed fast enough to run out before the next scheduled poll. TOKEN_MONITOR_LIMITS_REFRESH_MODE= # Interval in milliseconds for `fixed` mode. Optional — defaults to 300000 (5 minutes); # accepts 60000, 120000, 300000, 900000 or 1800000. Ignored when the mode is `adaptive`. TOKEN_MONITOR_LIMITS_REFRESH_MS= # Let the headless agent read OpenCode's device-local SQLite database as a # last-resort quota estimate. Optional — defaults to disabled; set to 1 to opt in. # It only sees this device's records, so it under-reports a shared account. TOKEN_MONITOR_OPENCODE_LOCAL_LIMITS= # OpenCode Go subscription key for the official usage API. Optional — the key is # discovered the way OpenCode itself discovers it: from OPENCODE_AUTH_CONTENT # when that is set (containers, CI runners, and OpenCode's own workspace # subprocesses) and from auth.json otherwise. Set this only to point at a # different account, or when neither source is available. TOKEN_MONITOR_OPENCODE_API_KEY= # Track the OpenCode account this machine is signed in to. Optional — defaults to # enabled, since that key needs no setup; set to 0 on a machine signed in to an # account whose quota should not be reported. Only the auto-detected account is # affected: once a saved account claims that key it follows that account. TOKEN_MONITOR_OPENCODE_AMBIENT= # Antigravity OAuth client override. Optional — the widget includes the official # Antigravity Hub client. Set both only for a custom/development client or an # emergency credential rotation. ANTIGRAVITY_OAUTH_CLIENT_ID= ANTIGRAVITY_OAUTH_CLIENT_SECRET= # Claude Web sessionKey value (`sk-ant-…` or `sessionKey=sk-ant-…`). Optional — Claude Code # OAuth/CLI detection stays automatic; use this for Claude Desktop/Web accounts # in the widget when the secret is managed through the environment. CLAUDE_WEB_COOKIE= # Read the Claude prepaid usage-credit balance from claude.ai (default on). Only ever # applies to the Web session above, and reports nothing until the account actually has # credits. Set to 0 to skip the request entirely and hide the balance. TOKEN_MONITOR_CLAUDE_PREPAID_BALANCE= # Factory API key. Optional — the widget has a GUI field and also recognizes Droid's own # ~/.factory/.env. FACTORY_API_KEY= # Grok bearer token. Optional — Token Monitor normally auto-detects Grok via # ~/.grok/auth.json after `grok login`; use this for the headless agent, # hubless scripts, or environment-managed secrets. GROK_BEARER_TOKEN= # Optional proxy for Grok web billing. Lowercase variants are also supported # and take precedence; NO_PROXY/no_proxy bypasses matching hosts. HTTPS_PROXY= HTTP_PROXY= ALL_PROXY= NO_PROXY= # DeepSeek balance API key. Optional — the widget has a GUI account setting; # use this for the headless agent, hubless scripts, or environment-managed secrets. DEEPSEEK_API_KEY= # ClinePass API key (app.cline.bot → /dashboard/account). Optional — the # widget has a GUI field and also reads the Cline sign-in that Cline Desktop and # the CLI keep on disk; set this for the headless agent, hubless scripts, or a # machine without Cline installed. CLINEPASS_API_KEY is also accepted. CLINE_API_KEY= # OpenRouter API key. Optional — the widget supports multiple named accounts; # use this single official-endpoint account for the headless agent or env-managed secrets. # A standard key exposes key usage/limits; a Management API key can also expose account credits. OPENROUTER_API_KEY= # Minimax Token Plan API key. Optional — the widget has a GUI account setting; # use this for the headless agent, hubless scripts, or environment-managed secrets. # This is not the regular pay-as-you-go API key — the two are not interchangeable. MINIMAX_CODING_API_KEY= # GitHub Copilot OAuth token. Optional — the widget can sign in with GitHub; # use this for the headless agent, hubless scripts, or environment-managed secrets. # GITHUB_COPILOT_TOKEN is also accepted for compatibility. COPILOT_API_TOKEN= # GLM Coding Plan API key from Z.ai Open Platform. Optional — the widget has a GUI account setting. # Z_AI_API_KEY, GLM_API_KEY, and ZHIPU_API_KEY are also accepted for compatibility. # TOKEN_MONITOR_ZAI_API_REGION may be "global" (api.z.ai) or "bigmodel-cn" (open.bigmodel.cn). ZAI_API_KEY= TOKEN_MONITOR_ZAI_API_REGION=global # GLM Team Plan (BigModel CN only). ZAI_TEAM_API_KEY or BIGMODEL_TEAM_API_KEY # supplies the team API key separately from the personal GLM provider. The # Organization ID and Project ID are found in the bigmodel.cn page localStorage # (Bigmodel-Organization / Bigmodel-Project). Optional — the widget has a GUI account setting. ZAI_TEAM_API_KEY= ZAI_TEAM_ORGANIZATION_ID= ZAI_TEAM_PROJECT_ID= # With no explicit credentials, an installed, logged-in arkcli can report the # personal Agent Plan using its existing SSO/STS session (no credential export). # Set to 0 to disable this fallback. Enable volcengine in LIMIT_PROVIDERS as usual. TOKEN_MONITOR_VOLCENGINE_ARKCLI=1 # Optional executable path; no shell arguments. Defaults to arkcli on PATH. TOKEN_MONITOR_ARKCLI_COMMAND= # Volcengine Ark credentials. Optional — the widget has a GUI account setting. # Paste an Ark API key (ark-...), or an access key ID (AKLT...) plus secret. # An access key reports both the Coding Plan and the Agent Plan; an Ark API key # can only report the Coding Plan. VOLCENGINE_ACCESS_KEY_ID= VOLCENGINE_SECRET_ACCESS_KEY= VOLCENGINE_REGION=cn-beijing # Only needed when the Agent Plan sits on a DIFFERENT Volcengine account than # the Coding Plan. Left empty, the Agent Plan reuses the keys above. VOLCENGINE_AGENT_ACCESS_KEY_ID= VOLCENGINE_AGENT_SECRET_ACCESS_KEY= VOLCENGINE_AGENT_REGION= # Qoder dashboard cookie for big-model credits. Optional — the widget has a GUI account setting. # TOKEN_MONITOR_QODER_SITE may be "global" or "cn". QODER_COOKIE= TOKEN_MONITOR_QODER_SITE=global # Devin web quota session. Optional — the widget has a GUI account setting. # Copy Authorization and x-cog-org-id from a successful billing/quota/usage request. DEVIN_BEARER_TOKEN= DEVIN_ORGANIZATION= # Qoder CN local usage database path override. Optional — auto-detected per platform. # macOS: ~/Library/Application Support/QoderCN/SharedClientCache/cache/db/local.db # Windows: %APPDATA%/QoderCN/SharedClientCache/cache/db/local.db # Linux: ~/.config/QoderCN/SharedClientCache/cache/db/local.db TOKEN_MONITOR_QODER_CN_DB_PATH= # Current Qoder CN builds store JSONL transcripts under a projects directory. # Optional — TOKEN_MONITOR_QODER_CN_PROJECTS_PATH takes precedence over Qoder's # own QODERCN_CONFIG_DIR/projects and the default ~/.qoder-cn/projects. TOKEN_MONITOR_QODER_CN_PROJECTS_PATH= # Trae CN access token for Trae CN / SOLO credits. Optional — the widget has a # manual GUI account setting. Copy Cloud-IDE-Token from Local Storage for # https://www.trae.cn; the raw value and Cloud-IDE-JWT prefix are accepted. # Device ID is optional. TRAE_ACCESS_TOKEN= TRAE_DEVICE_ID= # Alibaba Cloud Token Plan console Cookie. Optional — the widget has a GUI # account setting. Copy it from the quota request on the Token Plan page: # GetSubscriptionSummary for Team, /tokenplan/personal/api/v2/usage for # Personal/Solo (that one is served by a different host than the dashboard). # ALIBABA_TOKEN_PLAN_VARIANT selects the console and plan and must match the # cookie: cn, intl, cn-personal or intl-personal. Defaults to cn. ALIBABA_TOKEN_PLAN_COOKIE= ALIBABA_TOKEN_PLAN_VARIANT= # Zed dashboard billing Cookie for headless installs. In the desktop widget, # paste the Cookie request header through Settings -> Limits -> Zed instead. TOKEN_MONITOR_ZED_COOKIE= # Command Code Cookie request header for 5-hour, weekly, and monthly credit limits. # Optional — the widget has a GUI account setting. COMMANDCODE_COOKIE= # WorkBuddy headless/advanced fallback only. Desktop widget users should sign in # inside the WorkBuddy app; no token or .env setup is needed in Token Monitor. # This fallback never reads WorkBuddy's private credential files or process # arguments. Enterprise accounts also need the enterprise ID. Billing requests # always use the official https://copilot.tencent.com endpoint. TOKEN_MONITOR_WORKBUDDY_ACCESS_TOKEN= TOKEN_MONITOR_WORKBUDDY_USER_ID= TOKEN_MONITOR_WORKBUDDY_ENTERPRISE_ID= TOKEN_MONITOR_WORKBUDDY_DOMAIN= TOKEN_MONITOR_WORKBUDDY_DEPARTMENT_INFO= TOKEN_MONITOR_WORKBUDDY_LOCALE= # Ollama Cloud Cookie request header for session/weekly usage. Optional — the widget has a GUI account setting. OLLAMA_COOKIE= # Kimi Code API key. Primary limits source; optional because the widget has a GUI account setting. KIMI_CODE_API_KEY= # Optional Kimi Web access token. Fills quota windows the Code API does not return, usually Weekly. KIMI_AUTH_TOKEN= # Third-party API accounts. Account mode supports New API-compatible /api/user/self endpoints. # Set Base URL + access token; New API deployments also require the user ID, # while compatible One API forks can omit it. Optional New API token mode: # set Base URL + API key to query only that key's independently configured quota. # Account mode wins when both credential sets are present. The widget GUI supports # multiple named profiles and adapters. A trailing /v1 is normalized automatically. TOKEN_MONITOR_NEWAPI_BASE_URL= TOKEN_MONITOR_NEWAPI_ACCESS_TOKEN= TOKEN_MONITOR_NEWAPI_USER_ID= TOKEN_MONITOR_NEWAPI_API_KEY= # TypeSafe Console Cookie header; paste from the authenticated Billing request. # TOKEN_MONITOR_TYPESAFE_COOKIE=