Download packages/core/src/util/token.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 160 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/core/src/util/token.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/core/src/util/token.ts
-
curl -L -o token.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/core/src/util/token.ts
160 Bytes
| export * as Token from "./token" | |
| const CHARS_PER_TOKEN = 4 | |
| export const estimate = (input: string) => Math.max(0, Math.round(input.length / CHARS_PER_TOKEN)) | |