← 返回
未分类

Token Cost Time

Estimate LLM task token usage, cost, and duration using rule-based classification and optional local profile data without external dependencies.
使用基于规则的分类和可选的本地配置文件数据,无需外部依赖,估算 LLM 任务的 Token使用量、成本和耗时。
highnoonoffice
未分类 clawhub v0.1.3 1 版本 100000 Key: 无需
★ 0
Stars
📥 307
下载
💾 0
安装
1
版本
#latest

概述

token-cost-time

token-cost-time is a lightweight, dependency-free estimator for LLM task token usage, cost, and duration.

It uses rule-based task classification plus baseline priors and optional local profile data.

Features

  • Rule-based task classification (no LLM calls)
  • Cost + duration estimation by model
  • Confidence ramp from cold-start to learned profile data
  • Quality confidence adjusted by retry behavior
  • Local execution recording for continuous calibration

Install / Run

From this module directory:

npm test

node cli/index.js calibrate --objective "summarize this document" --model claude-haiku-3

node cli/index.js compare --objective "implement a React component" --models claude-haiku-3,claude-sonnet-4,gpt-4o

node cli/index.js record --model claude-haiku-3 --task-class summarization --input-tokens 1340 --output-tokens 290 --duration-ms 4100 --cost 0.00071

API

  • calibrate(objective, model, profilePath = null)
  • record(executionData, profilePath = null)
  • compare(objective, models, profilePath = null, sortBy = 'cost')

Library usage example:

import { calibrate } from './src/calibrate.js';

const result = calibrate('summarize this architecture memo', 'claude-haiku-3');

// result.taskClass => 'summarization'

// result.estimate.costUsd => estimated dollar cost

// result.confidence => 0.2 cold start, rises to 0.95 with 50+ recorded runs

If profilePath is omitted, profile defaults to:

  • ~/.token-cost-time/profile.json

Execution log defaults to:

  • ~/.token-cost-time/execution-log.jsonl

Task Classes

  • summarization
  • code_generation
  • code_audit
  • reasoning
  • creative
  • extraction
  • conversation (fallback)

Notes

  • ESM modules throughout.
  • Node built-ins only.
  • File paths are resolved with os.homedir() for cross-platform compatibility.

版本历史

共 1 个版本

  • v0.1.3 当前
    2026-05-20 05:27 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Ghost Publishing Pro

highnoonoffice
无头Ghost发布。通过AI工作流撰写、审核并自动化整个Ghost运营——17个工作流,覆盖文章发布、批量导入等功能。
★ 0 📥 960

Brain Map Visualizer

highnoonoffice
可视化注意力在代理项目间的移动轨迹。每次会话都会留下痕迹,随时间这些痕迹形成地图——并非关于代理被告知的内容。
★ 0 📥 753

Second Brain Visualizer

highnoonoffice
读取你的原始想法流(语音笔记、碎片、半句),在你不知不觉中揭示反复循环的模式。随意丢弃任何内容。寻找 t...
★ 0 📥 536