@nanocollective/nanocoder
Version:
A local-first CLI coding agent that brings the power of agentic coding tools like Claude Code and Gemini CLI to local models or controlled APIs like OpenRouter
13 lines • 482 B
JavaScript
import { CHARS_PER_TOKEN_ESTIMATE } from '../constants.js';
/**
* Calculate estimated token count from text content.
* Uses a simple approximation: characters / 4
* This is a quick estimate used for UI display purposes.
*
* @param content - The text content to estimate tokens for
* @returns Estimated token count
*/
export const calculateTokens = (content) => {
return Math.ceil(content.length / CHARS_PER_TOKEN_ESTIMATE);
};
//# sourceMappingURL=token-calculator.js.map