Data & analysis

token-cost-time

Try it

Estimate LLM task token usage, cost, and duration using rule-based classification and optional local profile data without external dependencies.

What it does

Estimate LLM task token usage, cost, and duration using rule-based classification and optional local profile data without external dependencies.

The skill document

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.

Related skills

Use when the user explicitly asks to analyze token waste, costs, or API bills. Finds duplicate tool calls, context bloat, model mismatch, and heartbeat waste...

1 installs

Token Metrics (tokenmetrics.com). Use this skill for ANY Token Metrics request — searching and reading data. Whenever a task involves Token Metrics, use this skill instead of calling the API directly.

1 installs

Agent token usage optimizer. Input usage logs, transcript excerpts, model bills, or runtime traces; output token/cost breakdown, waste patterns, context comp...

49 installs

Choose TokenLab models and fallback chains using public pricing, task fit, latency expectations, and native endpoint needs before writing production routing...

智能模型路由与Token成本优化顾问 / Smart LLM Router & Token Cost Optimizer. 帮助用户为不同复杂度的AI任务选择最合适的模型层级(从极致性价比到旗舰级), 通过任务复杂度评估、模型分级推荐、安全强制升级规则,在保证质量的前提下节省70-90%的Token成本。 同时提...

Minimize pay-to-go xAI/API token spend. Use when user says token saver, save tokens, API budget, pay-to-go burn, or before long Grok/Claude/GPT calls. Prefer...

1 installs