MCPcopy Create free account
hub / github.com/simstudioai/sim / formatTokenCount

Function formatTokenCount

apps/sim/app/(landing)/models/utils.ts:155–169  ·  view source on GitHub ↗
(value?: number | null)

Source from the content-addressed store, hash-verified

153}
154
155export function formatTokenCount(value?: number | null): string {
156 if (value == null) {
157 return 'Unknown'
158 }
159
160 if (value >= 1000000) {
161 return `${trimTrailingZeros((value / 1000000).toFixed(2))}M`
162 }
163
164 if (value >= 1000) {
165 return `${trimTrailingZeros((value / 1000).toFixed(0))}k`
166 }
167
168 return value.toLocaleString('en-US')
169}
170
171export function formatFileSize(bytes?: number | null): string {
172 if (bytes == null) {

Callers 12

ModelRowFunction · 0.90
ContextWindowChartFunction · 0.90
ImageFunction · 0.90
ProviderModelsPageFunction · 0.90
ImageFunction · 0.90
ModelPageFunction · 0.90
ImageFunction · 0.90
buildCapabilityTagsFunction · 0.70
buildModelSummaryFunction · 0.70
buildProviderFaqsFunction · 0.70
buildModelFaqsFunction · 0.70

Calls 1

trimTrailingZerosFunction · 0.85

Tested by

no test coverage detected