Tok - 令牌估算器
亚微秒令牌估算工具,支持100+ AI模型。处理MB级提示,依赖最小化,使用平均公式实现跨模型兼容.
2025•AI创新•Published
关键特性
- ✓Multi-provider support: 'OpenAI, Anthropic, OpenRouter, Llama models'
- ✓Enterprise features: Per-million token pricing with separate prompt/completion rates
- ✓Lightweight design: Minimal dependencies for maximum performance
影响
- **Sub-microsecond performance** for instant token estimation
- **100+ model support** through averaging formula approach
- **MB-scale prompt handling** with minimal dependencies
- **20MB size reduction** by removing TIC token dependency
- **Developer Efficiency**: Instant cost visibility prevents budget overruns
- **Enterprise Ready**: Supports programmatic budget management
- **Global Adoption**: Used worldwide via npm registry
- **Performance Optimization**: Trade-off of precision for significant performance gains
技术栈
核心栈
TypeScriptJavaScriptNode.js
- TypeScript/JavaScript
- Node.js 18.0.0+
- Plugin-based provider system
- Averaging formula for token estimation
标签
AI令牌估算成本优化LLM成本亚微秒多供应商轻量级OpenAIAnthropicClaudeGPT-4开发者工具npm包