Bỏ qua tới nội dung
TakoAPI
Quay lại kỹ năng

tokenguard

bởi g0head

AI & LLMs
1.6kLượt tải do clawskills.sh công bố
3Sao
0Lượt xem
0 lượt thíchĐăng nhập để thích kỹ năng này
—Chưa có đánh giá
Đánh giá của bạn

Tóm tắt

API cost guardian for AI agents.

Mô tả

Kỹ năng này làm gì

TokenGuard tracks API spending per session, enforces configurable dollar limits, and blocks actions when budgets are exceeded. It logs every cost with timestamps and provides pre-flight budget checks before expensive calls.

Unlike ad-hoc manual tracking, TokenGuard enforces limits programmatically via exit codes, so scripts and agents can gate expensive operations without any custom logic.

Khi nào nên dùng

  • Stopping a runaway agent loop before it burns $200 overnight
  • Setting a $10 daily cap during development of a new AI feature
  • Auditing which operations consumed the most API budget last week
  • Scripting a CI pipeline that skips expensive calls when over budget
  • Extending a session limit mid-task without losing the spending history

Quy trình ví dụ

ĐẦU VÀO

User asks: check if I can afford a $5 API call, then log the actual cost

AGENT
  1. 1

    Run tokenguard status to see current limit and remaining balance

  2. 2

    Run tokenguard check 5.00 to verify the estimated cost fits the budget

  3. 3

    Call the external API if exit code is 0

  4. 4

    Run tokenguard log 4.23 "Claude Sonnet - summarization" to record the actual cost

  5. 5

    Run tokenguard history to confirm the entry was saved

ĐẦU RA

Spending log updated: $4.23 recorded, remaining balance displayed

Cài đặt

clawhub install g0head/tokenguard

Chạy lệnh CLI, hoặc dán prompt vào Claude Code, Cursor, Codex hay coding agent bạn đang dùng.

Liên kết