MCPcopy Create free account
hub / github.com/openai/plugins / estimateTokenCount

Function estimateTokenCount

plugins/plugin-eval/src/lib/tokens.js:1–6  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

1export function estimateTokenCount(text) {
2 if (!text) {
3 return 0;
4 }
5 return Math.ceil(text.length / 4);
6}
7
8export function sumTokenCounts(items) {
9 return items.reduce((total, item) => total + item.tokens, 0);

Callers 4

computeSkillBudgetFunction · 0.90
computePluginBudgetFunction · 0.90
computeBudgetProfileFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected