Discover and explore top open-source AI tools and projects—updated daily.
xn1cklasAI application toolkit for context, cost, and budget management
Top 99.1% on SourcePulse
Summary
TokenLens provides typed model metadata and utilities for AI applications to manage context windows, estimate costs, and optimize token usage. It targets developers building AI-powered applications, offering crucial insights for efficient and cost-effective operation, particularly with large language models.
How It Works
The library offers a canonical model registry with alias resolution and trusted metadata. It provides a strong TypeScript interface for model identification and safe helper functions. TokenLens normalizes usage across different providers and SDKs, enabling consistent context budgeting (remaining tokens, percentage used, next-turn budget) and compaction strategies (when to compact, how many tokens to remove). It also includes cost estimation based on source-linked pricing where available.
Quick Start & Requirements
npm i tokenlens (or pnpm add tokenlens, yarn add tokenlens).fetchModels without custom fetch), TypeScript.pnpm -C packages/tokenlens sync:modelsHighlighted Details
Maintenance & Community
models.dev dataset for model information (https://github.com/sst/models.dev).Licensing & Compatibility
Limitations & Caveats
getContext, getTokenCosts, getUsage).models.dev pricing; authoritative numbers require runtime API responses.provider-default, combined, input-only) offer flexibility but require careful selection.1 week ago
Inactive
groq
transitive-bullshit