惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
博客园 - 聂微东
J
Java Code Geeks
Engineering at Meta
Engineering at Meta
Jina AI
Jina AI
D
Docker
B
Blog
S
SegmentFault 最新的问题
宝玉的分享
宝玉的分享
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Y
Y Combinator Blog
N
Netflix TechBlog - Medium
月光博客
月光博客
F
Fortinet All Blogs
爱范儿
爱范儿
H
Help Net Security
腾讯CDC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
WordPress大学
WordPress大学
The Cloudflare Blog
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
U
Unit 42

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
GitHub - jher7/tokenyst
herrj · 2026-05-10 · via Hacker News: Show HN

Track token usage and API costs for your Claude Code sessions.

Tokenyst is a lightweight CLI tool that runs alongside Claude Code, automatically capturing token consumption and calculating spend against your budget. Perfect for indie developers, agents, and teams managing API costs.

Features

  • Automatic tracking — Runs silently after each Claude Code session, capturing tokens and costs
  • Budget management — Set per-task budgets and monitor spend in real-time
  • Cost calculation — Built-in pricing for all Claude models, including prompt cache multipliers
  • Local-first — All data stored in ~/.tokenyst/ on your machine (no cloud required)
  • Session summaries — See token usage and budget progress at a glance

Installation

npm install -g tokenyst
# or
pnpm add -g tokenyst

You'll need Node.js 18+ and Claude Code already installed.

Quick Start

1. Define a task and set a budget:

tkst -t "Issue-243" -b 5
# Create a budget of $5.00 for "Issue-243"  

All future session costs will be automatically allocated to your active task.

2. Initialize and start tracking:

tkst claude
# or
claude

This spawns Claude Code with budget tracking enabled. After each prompt, the prompt's cost is displayed along with the budget progress. After your session ends, a cost summary is displayed.

💡 Note: Running claude on its own will still enable budget tracking. However, the post-prompt and post-session summaries will not show.

3. Check your progress:

tkst -t
# ┌─────────┬────────────────────────────────┐
# │ Task    │ Issue-243                      │
# ├─────────┼────────────────────────────────┤
# │ Budget  │ $3.24 / $5.00 ▓▓▓▓▓▓▓▓░░░░ 65% │
# └─────────┴────────────────────────────────┘

Use tkst -l to see all tasks, their budgets, spend, and remaining balance.

Example Usage

Live budget updates:

tkst -t "Fix header buttons" -b 2
#  Created task "Fix header buttons" with budget $2.00

tkst claude
# [Claude Code prompt]
# ⎿  Stop says: +$0.861 (turn) | Budget: $0.86 / $2.00 (43%)

# [Claude Code prompt]
# ⎿  Stop says: +$0.344 (turn) | Budget: $1.21 / $2.00 (60%)

/exit
#  Budget Summary:
# ┌─────────┬────────────────────────────────┐
# │ Task    │ Fix header buttons             │
# ├─────────┼────────────────────────────────┤
# │ Budget  │ $1.21 / $2.00 ▓▓▓▓▓▓▓░░░░░ 60% │
# ├─────────┼────────────────────────────────┤
# │ Session │ $1.21                          │
# └─────────┴────────────────────────────────┘

Initializing Claude Code with tkst will provide post-prompt and post-session summaries.

Set / Update / Delete a task:

# Change tasks
tkst -t "Add unit tests"

# Update budget to $3.00
tkst -u "Add unit tests" -b 3

# Delete a task
tkst -d "Fix header buttons"

View / Update / Reset allocations:

tkst -a
# View allocations for the current task

tkst -a --all
# View allocations for all tasks

tkst -ra "Add landing page" "Issue-243"
# Re-allocate from one task to another

tkst -a "Add landing page" --delete
# Delete an allocation from a task

tkst -r "Add Landing page"
# Delete all allocations from a task

All commands

tkst task (-t) -n <name> -b <amount>
# ⎿ Create a task with a budget cap

tkst claude (-c)
# ⎿ Run Claude Code with budget tracking

tkst list (-l)
# ⎿ List all tasks

tkst delete (-d) <name> [--yes] [--all]
# ⎿ Delete a task and its history

tkst update (-u) <name> [-b <amount>] [-n <new_name>] [-a <add_amount>]
# ⎿ Change budget cap, rename, and/or manually add an allocation

tkst allocations (-a) [<task>] [--all] [--delete]
# ⎿ View or delete allocations

tkst reallocate (-ra) <from> <to>
# ⎿ Move an allocation between tasks

tkst reset (-r) <name> [--yes]
# ⎿ Wipe spending history for a task

tkst --enable
# ⎿ Re-enable tracking and stop hook

tkst --disable
# ⎿ Disable tracking and remove stop hook                        

How It Works

  1. You run tkst claude to start a Claude Code session
  2. Tokenyst spawns Claude with inherited stdio, letting you work normally
  3. When you exit Claude, Tokenyst automatically:
    • Finds your session transcript in ~/.claude/projects/
    • Parses token usage from the last assistant turn(s)
    • Calculates cost using the current Claude model pricing
    • Deducts the cost from your active task budget
    • Shows a summary with remaining balance
  4. All data is saved locally in ~/.tokenyst/config.json

Configuration

Your data lives here:

  • ~/.tokenyst/config.json — All tasks, budgets, and spend allocations
  • ~/.tokenyst/recorded-turns.json — Internal dedup tracking (you can ignore this)
  • ~/.tokenyst/hook.log — Debug logs from the Stop hook integration

Requirements

  • Node.js 18.0.0 or later
  • Claude Code (via claude command in your PATH)
  • pnpm, npm, or yarn (for installation)