{
  "id": "task_libraries:tokenizer/javascript",
  "path": "/exapedia/javascript-tokenizer-libraries",
  "template": {
    "id": "task_libraries",
    "version": 4
  },
  "title": "JavaScript tokenizer libraries",
  "answer": [
    {
      "t": "text",
      "text": "JavaScript tokenizer libraries split text into the tokens a language model reads and map each token to an integer ID. A byte-pair encoder merges frequent character sequences into tokens from the vocabulary of one model family. These libraries let apps and AI agents count tokens before a model call."
    }
  ],
  "breadcrumb": [
    {
      "label": "Tools"
    },
    {
      "label": "JavaScript tokenizer libraries"
    }
  ],
  "sections": [
    {
      "id": "libraries_popularity",
      "anchor": "popularity",
      "heading": "Popularity",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Monthly downloads",
            "Stars",
            "Last release",
            "License"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#js-tiktoken",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F124"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F125"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F133"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F128"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F126"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#transformers-js",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F142"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F143"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F149"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F146"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F144"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#huggingface-tokenizers",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F158"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F159"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F167"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F162"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F160"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#gpt-tokenizer",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F176"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F177"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F183"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F180"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F178"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#tiktoken",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F192"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F193"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F199"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F196"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F194"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#anthropic-ai-tokenizer",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F208"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F209"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F217"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F212"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F210"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#gpt-encoder",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F222"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F223"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F229"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F226"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F224"
                }
              ]
            ]
          ],
          "variant": "pop",
          "caption": [
            {
              "t": "text",
              "text": "Downloads: "
            },
            {
              "t": "text",
              "text": "npm"
            },
            {
              "t": "text",
              "text": ", last thirty days. Stars and releases: GitHub. Amber: no release in over a year."
            }
          ]
        }
      ],
      "note": [
        {
          "t": "link",
          "href": "#js-tiktoken",
          "label": [
            {
              "t": "text",
              "text": "js-tiktoken"
            }
          ]
        },
        {
          "t": "text",
          "text": " has the most monthly downloads in this comparison, at "
        },
        {
          "t": "fact",
          "fact": "F125"
        },
        {
          "t": "text",
          "text": "."
        }
      ]
    },
    {
      "id": "libraries_capabilities",
      "anchor": "capabilities",
      "heading": "Capabilities",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Chat message formatting",
            "Hugging Face configs"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#js-tiktoken",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F124"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F134"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F135"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#transformers-js",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F142"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F150"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F151"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#huggingface-tokenizers",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F158"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F168"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F169"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#gpt-tokenizer",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F176"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F184"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F185"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#tiktoken",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F192"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F200"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F201"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#anthropic-ai-tokenizer",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F208"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F218"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F219"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#gpt-encoder",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F222"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F230"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F231"
                }
              ]
            ]
          ],
          "variant": "cap"
        }
      ]
    },
    {
      "id": "libraries_entries",
      "anchor": "libraries",
      "heading": "Libraries",
      "blocks": [
        {
          "b": "entry",
          "anchor": "js-tiktoken",
          "name": [
            {
              "t": "fact",
              "fact": "F124"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/dqbd/tiktoken"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/js-tiktoken"
            },
            {
              "label": "Docs",
              "href": "https://raw.githubusercontent.com/dqbd/tiktoken/main/js/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F131"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F125"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F133"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F127"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F126"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://raw.githubusercontent.com/dqbd/tiktoken/main/js/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F124"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F140"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F141"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/langchain-ai/langchainjs",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F140"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "javascript",
              "code": "export async function getEncoding(encoding: TiktokenEncoding) {\n  if (!(encoding in cache)) {\n    cache[encoding] = caller\n      .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)\n      .then((res) => res.json())\n      .then((data) => new Tiktoken(data))\n      .catch((e) => {\n        delete cache[encoding];\n        throw e;\n      });\n  }\n\n  return await cache[encoding];\n}\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/langchain-ai/langchainjs/blob/7309848b94f1c9940197e3ebfc9a63bf508b3f15/libs/langchain-core/src/utils/tiktoken.ts#L13",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F139"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=js-tiktoken%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F124"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "javascript",
              "code": "import { getEncoding } from \"js-tiktoken\";\nconst tokenizer = getEncoding(\"o200k_base\");\nconsole.log(tokenizer.encode(\"Hello world\"));\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://raw.githubusercontent.com/dqbd/tiktoken/main/js/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F129"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "transformers-js",
          "name": [
            {
              "t": "fact",
              "fact": "F142"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/huggingface/transformers.js"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/@huggingface/transformers"
            },
            {
              "label": "Docs",
              "href": "https://huggingface.co/docs/transformers.js/api/tokenizers"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F12"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F143"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F149"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F145"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F144"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://huggingface.co/docs/transformers.js/api/tokenizers",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F142"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F13"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F14"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F15"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F16"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F17"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F18"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F19"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F20"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F156"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F157"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/can1357/oh-my-pi",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F156"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "typescript",
              "code": "export function renderTextChatTemplate(\n\ttokenizer: TextGenerationPipeline[\"tokenizer\"],\n\tmessages: readonly { role: string; content: string }[],\n\toptions: TextChatTemplateOptions,\n): string {\n\tconst source: unknown = tokenizer.get_chat_template();\n\tconst chatTemplate = typeof source === \"string\" ? source.replace(GENERATION_STATEMENT, \"\") : undefined;\n\tconst templateOptions: {\n\t\tchat_template?: string;\n\t\tadd_generation_prompt: boolean;\n\t\ttokenize: false;\n\t\tenable_thinking: boolean;\n\t} = {\n\t\t...(chatTemplate === undefined ? {} : { chat_template: chatTemplate }),\n\t\tadd_generation_prompt: options.addGenerationPrompt,\n\t\ttokenize: false,\n\t\tenable_thinking: options.enableThinking,\n\t};\n\treturn tokenizer.apply_chat_template([...messages], templateOptions);\n}\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/can1357/oh-my-pi/blob/1bdbf6d242d99ca62bdf2feeff4519ff992f647d/packages/coding-agent/src/tiny/completion-prompt.ts#L14",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F155"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=JavaScript%20applications%20using%20%40huggingface/transformers%20to%20count%20model%20tokens%2C%20inspect%20encoded%20text%20or%20format%20model%20chat%20prompts&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F142"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "typescript",
              "code": "import { AutoTokenizer } from \"@huggingface/transformers\";\nconst tokenizer = await AutoTokenizer.from_pretrained(\"Xenova/bert-base-uncased\");\nconst { input_ids } = await tokenizer(\"Hello world\");\nconsole.log(input_ids);\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://huggingface.co/docs/transformers.js/api/tokenizers",
                  "label": [
                    {
                      "t": "text",
                      "text": "tokenizers.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F147"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "huggingface-tokenizers",
          "name": [
            {
              "t": "fact",
              "fact": "F158"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/huggingface/tokenizers.js"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/@huggingface/tokenizers"
            },
            {
              "label": "Docs",
              "href": "https://app.unpkg.com/@huggingface/tokenizers@0.2.0/files/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F165"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F159"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F167"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F161"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F160"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://app.unpkg.com/@huggingface/tokenizers@0.2.0/files/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F158"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F174"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F175"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/samanhappy/mcphub",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F174"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "javascript",
              "code": "const tokenizeAndTruncate = (tokenizer: HFTokenizer): string => {\n    const encoded = tokenizer.encode(text);\n    const rawIds: ArrayLike<number | bigint> = encoded.ids;\n    const ids = Array.from(rawIds as ArrayLike<number>).map(Number);\n    if (ids.length <= maxTokens) {\n      return text;\n    }\n    const truncatedIds = ids.slice(0, maxTokens);\n    return tokenizer.decode(truncatedIds, { skip_special_tokens: true });\n  };\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/samanhappy/mcphub/blob/874b72a65c688069bf0d096b01efd448073de9f7/src/utils/tokenTruncation.ts#L301",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F173"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=%40huggingface/tokenizers%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F158"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "javascript",
              "code": "import { Tokenizer } from \"@huggingface/tokenizers\";\nconst base = \"https://huggingface.co/HuggingFaceTB/SmolLM3-3B/resolve/main\";\nconst json = await fetch(`${base}/tokenizer.json`).then(response => response.json());\nconst config = await fetch(`${base}/tokenizer_config.json`).then(response => response.json());\nconst tokenizer = new Tokenizer(json, config);\nconsole.log(tokenizer.encode(\"Hello world\").ids);\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://app.unpkg.com/@huggingface/tokenizers@0.2.0/files/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F163"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "gpt-tokenizer",
          "name": [
            {
              "t": "fact",
              "fact": "F176"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/niieani/gpt-tokenizer"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/gpt-tokenizer"
            },
            {
              "label": "Docs",
              "href": "https://raw.githubusercontent.com/niieani/gpt-tokenizer/main/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F38"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F177"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F183"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F179"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F178"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://raw.githubusercontent.com/niieani/gpt-tokenizer/main/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F176"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F39"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F40"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F41"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F42"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F43"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F44"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F45"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F46"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F190"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F191"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/continuedev/continue",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F190"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "typescript",
              "code": "function countToolCallFunctionTokens(\n  toolCallFunction: { name?: string; arguments?: string } | undefined,\n): number {\n  if (!toolCallFunction) {\n    return 0;\n  }\n\n  let tokenCount = 0;\n  tokenCount += encode(toolCallFunction.name ?? \"\").length + 10; // Function name and structure overhead\n  tokenCount += encode(toolCallFunction.arguments ?? \"\").length; // Arguments\n  return tokenCount;\n}\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/extensions/cli/src/util/tokenizer.ts#L67",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F189"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=JavaScript%20applications%20using%20gpt-tokenizer%20to%20count%20model%20tokens%2C%20inspect%20encoded%20text%20or%20format%20model%20chat%20prompts&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F176"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "typescript",
              "code": "import { encode, decode } from \"gpt-tokenizer\";\nconst ids = encode(\"Hello world\");\nconsole.log(ids, decode(ids));\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://raw.githubusercontent.com/niieani/gpt-tokenizer/main/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F181"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "tiktoken",
          "name": [
            {
              "t": "fact",
              "fact": "F192"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/dqbd/tiktoken"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/tiktoken"
            },
            {
              "label": "Docs",
              "href": "https://raw.githubusercontent.com/dqbd/tiktoken/main/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F63"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F193"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F199"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F195"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F194"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://raw.githubusercontent.com/dqbd/tiktoken/main/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F192"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F64"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F65"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F66"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F67"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F68"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F69"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F70"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F71"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F206"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F207"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/enricoros/big-AGI",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F206"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "typescript",
              "code": "export function textTokensForEncodingId(text: string, encodingId: string, debugFrom: string): Array<UITokenChunk> | null {\n  // The library shall have been preloaded - if not, attempt to start its loading and return null to indicate we're not ready to count\n  if (!get_encoding) {\n    if (!informTheUser) {\n      console.warn('textTokensForEncodingId: Tiktoken library is not yet loaded, loading now...');\n      informTheUser = true;\n    }\n    void preloadTiktokenLibrary().catch(() => {}); // preload without waiting; swallow rejection (already logged, falls back to approximate counting) to avoid an unhandled-rejection report\n    return null;\n  }\n\n  if (!(encodingId in tokenizerCache)) {\n    try {\n      tokenizerCache[encodingId] = get_encoding(encodingId as TiktokenEncoding);\n    } catch (e) {\n      console.error(`textTokensForEncodingId: Error initializing tokenizer \"${encodingId}\": ${e}`);\n      return null;\n    }\n  }\n\n  try {\n    const tokens = tokenizerCache[encodingId]?.encode(text, 'all', []) || new Uint32Array();\n    if (DEBUG_TOKEN_COUNT)\n      console.log(`textTokensForEncodingId: ${debugFrom}, ${encodingId}, \"${text.slice(0, 10)}\": ${tokens.length}`);\n\n    // for every token create an object {t:token, b: bytes}\n    const tokenDetails: UITokenChunk[] = [];\n    for (let i = 0; i < tokens.length; i++) {\n      const bytesForToken = tokenizerCache[encodingId].decode_single_token_bytes(tokens[i]);\n      const stringForToken = String.fromCharCode(...bytesForToken);\n      tokenDetails.push({\n        token: tokens[i],\n        chunk: stringForToken,\n        bytes: bytesForToken.join(', '),\n      });\n    }\n    return tokenDetails;\n  } catch (e) {\n    console.error(`textTokensForEncodingId: Error tokenizing \"${text.slice(0, 10)}...\" with tokenizer '${encodingId}': ${e}`);\n    return null;\n  }\n}\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/enricoros/big-AGI/blob/f157841f5c644e42a55f548a1ebf401488c45565/src/common/tokens/tokens.text.ts#L107",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F205"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=JavaScript%20applications%20using%20tiktoken%20to%20count%20model%20tokens%2C%20inspect%20encoded%20text%20or%20format%20model%20chat%20prompts&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F192"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "typescript",
              "code": "import { get_encoding } from \"tiktoken\";\nconst tokenizer = get_encoding(\"o200k_base\");\nconsole.log(tokenizer.encode(\"Hello world\"));\ntokenizer.free();\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://raw.githubusercontent.com/dqbd/tiktoken/main/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F197"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "anthropic-ai-tokenizer",
          "name": [
            {
              "t": "fact",
              "fact": "F208"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/anthropics/anthropic-tokenizer-typescript"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/@anthropic-ai/tokenizer"
            },
            {
              "label": "Docs",
              "href": "https://raw.githubusercontent.com/anthropics/anthropic-tokenizer-typescript/main/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F215"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F209"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F217"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F211"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F210"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://raw.githubusercontent.com/anthropics/anthropic-tokenizer-typescript/main/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F208"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "javascript",
              "code": "import { countTokens } from \"@anthropic-ai/tokenizer\";\nconsole.log(countTokens(\"Hello world\"));\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://raw.githubusercontent.com/anthropics/anthropic-tokenizer-typescript/main/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=%40anthropic-ai/tokenizer%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "Find projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F208"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F213"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "gpt-encoder",
          "name": [
            {
              "t": "fact",
              "fact": "F222"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/latitudegames/GPT-3-Encoder"
            },
            {
              "label": "npm",
              "href": "https://www.npmjs.com/package/gpt-3-encoder"
            },
            {
              "label": "Docs",
              "href": "https://raw.githubusercontent.com/AIDungeon/GPT-3-Encoder/master/README.md"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F86"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F223"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F229"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F225"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F224"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://raw.githubusercontent.com/AIDungeon/GPT-3-Encoder/master/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F222"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F87"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F88"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F89"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F90"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F91"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F92"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F236"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F237"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/mckaywrigley/paul-graham-gpt",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F236"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "typescript",
              "code": "const chunkEssay = async (essay: PGEssay) => {\n  const { title, url, date, thanks, content, ...chunklessSection } = essay;\n\n  let essayTextChunks = [];\n\n  if (encode(content).length > CHUNK_SIZE) {\n    const split = content.split(\". \");\n    let chunkText = \"\";\n\n    for (let i = 0; i < split.length; i++) {\n      const sentence = split[i];\n      const sentenceTokenLength = encode(sentence);\n      const chunkTextTokenLength = encode(chunkText).length;\n\n      if (chunkTextTokenLength + sentenceTokenLength.length > CHUNK_SIZE) {\n        essayTextChunks.push(chunkText);\n        chunkText = \"\";\n      }\n\n      if (sentence[sentence.length - 1].match(/[a-z0-9]/i)) {\n        chunkText += sentence + \". \";\n      } else {\n        chunkText += sentence + \" \";\n      }\n    }\n\n    essayTextChunks.push(chunkText.trim());\n  } else {\n    essayTextChunks.push(content.trim());\n  }\n\n  const essayChunks = essayTextChunks.map((text) => {\n    const trimmedText = text.trim();\n\n    const chunk: PGChunk = {\n      essay_title: title,\n      essay_url: url,\n      essay_date: date,\n      essay_thanks: thanks,\n      content: trimmedText,\n      content_length: trimmedText.length,\n      content_tokens: encode(trimmedText).length,\n      embedding: []\n    };\n\n    return chunk;\n  });\n\n  if (essayChunks.length > 1) {\n    for (let i = 0; i < essayChunks.length; i++) {\n      const chunk = essayChunks[i];\n      const prevChunk = essayChunks[i - 1];\n\n      if (chunk.content_tokens < 100 && prevChunk) {\n        prevChunk.content += \" \" + chunk.content;\n        prevChunk.content_length += chunk.content_length;\n        prevChunk.content_tokens += chunk.content_tokens;\n        essayChunks.splice(i, 1);\n        i--;\n      }\n    }\n  }\n\n  const chunkedSection: PGEssay = {\n    ...essay,\n    chunks: essayChunks\n  };\n\n  return chunkedSection;\n};\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/mckaywrigley/paul-graham-gpt/blob/795be559a058e578c92e8260242d4d3847a4e238/scripts/scrape.ts#L110",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F235"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=JavaScript%20applications%20using%20gpt-3-encoder%20to%20count%20model%20tokens%2C%20inspect%20encoded%20text%20or%20format%20model%20chat%20prompts&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F222"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "typescript",
              "code": "const { encode, decode } = require(\"gpt-3-encoder\");\nconst ids = encode(\"Hello world\");\nconsole.log(ids, decode(ids));\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://raw.githubusercontent.com/AIDungeon/GPT-3-Encoder/master/README.md",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F227"
            }
          ]
        }
      ]
    }
  ],
  "questions": [
    {
      "q": "Which JavaScript tokenizer library should I use?",
      "a": [
        {
          "t": "link",
          "href": "#js-tiktoken",
          "label": [
            {
              "t": "text",
              "text": "js-tiktoken"
            }
          ]
        },
        {
          "t": "text",
          "text": " and "
        },
        {
          "t": "link",
          "href": "#gpt-tokenizer",
          "label": [
            {
              "t": "text",
              "text": "gpt-tokenizer"
            }
          ]
        },
        {
          "t": "text",
          "text": " suit counting tokens for OpenAI models in pure JavaScript. "
        },
        {
          "t": "link",
          "href": "#transformers-js",
          "label": [
            {
              "t": "text",
              "text": "Transformers.js"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits open models that publish their own tokenizer on Hugging Face. "
        },
        {
          "t": "link",
          "href": "#tiktoken",
          "label": [
            {
              "t": "text",
              "text": "tiktoken"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits Node.js code that can load WASM bindings."
        }
      ]
    },
    {
      "q": "How do I count tokens in JavaScript?",
      "a": [
        {
          "t": "text",
          "text": "Encode the text with the tokenizer for the target model and take the length of the result. "
        },
        {
          "t": "link",
          "href": "#js-tiktoken",
          "label": [
            {
              "t": "text",
              "text": "js-tiktoken"
            }
          ]
        },
        {
          "t": "text",
          "text": " and "
        },
        {
          "t": "link",
          "href": "#gpt-tokenizer",
          "label": [
            {
              "t": "text",
              "text": "gpt-tokenizer"
            }
          ]
        },
        {
          "t": "text",
          "text": " do this for OpenAI encodings."
        }
      ]
    },
    {
      "q": "What is tiktoken?",
      "a": [
        {
          "t": "link",
          "href": "#tiktoken",
          "label": [
            {
              "t": "text",
              "text": "tiktoken"
            }
          ]
        },
        {
          "t": "text",
          "text": " is the byte-pair tokenizer for OpenAI models. Its npm package provides WASM bindings, and "
        },
        {
          "t": "link",
          "href": "#js-tiktoken",
          "label": [
            {
              "t": "text",
              "text": "js-tiktoken"
            }
          ]
        },
        {
          "t": "text",
          "text": " is a pure JavaScript port."
        }
      ]
    },
    {
      "q": "What is byte pair encoding?",
      "a": [
        {
          "t": "text",
          "text": "Byte pair encoding builds a vocabulary by repeatedly merging the most frequent pair of adjacent symbols. A tokenizer applies those merges to split new text into tokens."
        }
      ]
    },
    {
      "q": "How do I count Claude tokens?",
      "a": [
        {
          "t": "text",
          "text": "The Claude API's token counting endpoint counts tokens for current models. "
        },
        {
          "t": "link",
          "href": "#anthropic-ai-tokenizer",
          "label": [
            {
              "t": "text",
              "text": "@anthropic-ai/tokenizer"
            }
          ]
        },
        {
          "t": "text",
          "text": " tokenizes text locally but matches only older Claude models."
        }
      ]
    }
  ],
  "facts": {
    "F1": {
      "label": "Library name, @huggingface/transformers",
      "display": "Transformers.js",
      "asOf": "2026-11-17"
    },
    "F2": {
      "label": "Monthly downloads, @huggingface/transformers",
      "display": "18.7M",
      "asOf": "2026-11-15"
    },
    "F3": {
      "label": "License, @huggingface/transformers",
      "display": "Apache-2.0",
      "asOf": "2026-11-17"
    },
    "F4": {
      "label": "Package release, @huggingface/transformers",
      "display": "4.3.2",
      "asOf": "2026-11-17"
    },
    "F5": {
      "label": "Undated package release, @huggingface/transformers",
      "display": "v4.3.2",
      "asOf": "2026-11-17"
    },
    "F6": {
      "label": "Repository stars, @huggingface/transformers",
      "display": "16.4K",
      "asOf": "2026-11-17"
    },
    "F7": {
      "label": "Decodes tokens, @huggingface/transformers",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F8": {
      "label": "Selects model tokenizer, @huggingface/transformers",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F9": {
      "label": "Formats chat messages, @huggingface/transformers",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F10": {
      "label": "Special token control, @huggingface/transformers",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F11": {
      "label": "Install, @huggingface/transformers",
      "display": "npm install @huggingface/transformers",
      "asOf": "2026-11-17"
    },
    "F12": {
      "label": "What it does, @huggingface/transformers",
      "display": "Loads pretrained model tokenizers and formats model-specific chat prompts.",
      "asOf": "2026-11-17"
    },
    "F13": {
      "label": "strengths lead, @huggingface/transformers",
      "display": "Loads tokenizers by model ID",
      "asOf": "2026-11-17"
    },
    "F14": {
      "label": "strengths, @huggingface/transformers",
      "display": "AutoTokenizer selects an implementation from tokenizer_config.json.",
      "asOf": "2026-11-17"
    },
    "F15": {
      "label": "strengths lead, @huggingface/transformers",
      "display": "Applies model-specific chat templates",
      "asOf": "2026-11-17"
    },
    "F16": {
      "label": "strengths, @huggingface/transformers",
      "display": "Render roles and control tokens in the model’s prompt format.",
      "asOf": "2026-11-17"
    },
    "F17": {
      "label": "limitations lead, @huggingface/transformers",
      "display": "Tool formatting depends on templates",
      "asOf": "2026-11-17"
    },
    "F18": {
      "label": "limitations, @huggingface/transformers",
      "display": "Tools have no effect when templates lack function-calling support.",
      "asOf": "2026-11-17"
    },
    "F19": {
      "label": "limitations lead, @huggingface/transformers",
      "display": "Requires pretrained tokenizer files",
      "asOf": "2026-11-17"
    },
    "F20": {
      "label": "limitations, @huggingface/transformers",
      "display": "Loading fails when required tokenizer files are missing.",
      "asOf": "2026-11-17"
    },
    "F21": {
      "label": "Quickstart, @huggingface/transformers",
      "display": "import { AutoTokenizer } from \"@huggingface/transformers\";\n\nconst tokenizer = await AutoTokenizer.from_pretrained(\"Xenova/mistral-tokenizer-v1\");\n\nconst chat = [\n  { \"role\": \"user\", \"content\": \"Hello, how are you?\" },\n  { \"role\": \"assistant\", \"content\": \"I'm doing great. How can I help you today?\" },\n  { \"role\": \"user\", \"content\": \"I'd like to show off how chat templating works!\" },\n]\n\nconst text = tokenizer.apply_chat_template(chat, { tokenize: false });\n// \"<s>[INST] Hello, how are you? [/INST]I'm doing great. How can I help you today?</s> [INST] I'd like to show off how chat templating works! [/INST]\"\n\nconst input_ids = tokenizer.apply_chat_template(chat, { tokenize: true, return_tensor: false });\n// [1, 733, 16289, 28793, 22557, 28725, 910, 460, 368, 28804, 733, 28748, 16289, 28793, 28737, 28742, 28719, 2548, 1598, 28723, 1602, 541, 315, 1316, 368, 3154, 28804, 2, 28705, 733, 16289, 28793, 315, 28742, 28715, 737, 298, 1347, 805, 910, 10706, 5752, 1077, 3791, 28808, 733, 28748, 16289, 28793]\n",
      "asOf": "2026-11-17"
    },
    "F22": {
      "label": "Project function, @huggingface/transformers",
      "display": "export function renderTextChatTemplate(\n\ttokenizer: TextGenerationPipeline[\"tokenizer\"],\n\tmessages: readonly { role: string; content: string }[],\n\toptions: TextChatTemplateOptions,\n): string {\n\tconst source: unknown = tokenizer.get_chat_template();\n\tconst chatTemplate = typeof source === \"string\" ? source.replace(GENERATION_STATEMENT, \"\") : undefined;\n\tconst templateOptions: {\n\t\tchat_template?: string;\n\t\tadd_generation_prompt: boolean;\n\t\ttokenize: false;\n\t\tenable_thinking: boolean;\n\t} = {\n\t\t...(chatTemplate === undefined ? {} : { chat_template: chatTemplate }),\n\t\tadd_generation_prompt: options.addGenerationPrompt,\n\t\ttokenize: false,\n\t\tenable_thinking: options.enableThinking,\n\t};\n\treturn tokenizer.apply_chat_template([...messages], templateOptions);\n}\n",
      "asOf": "2026-11-17"
    },
    "F23": {
      "label": "Project function reference, @huggingface/transformers",
      "display": "completion-prompt.ts · renderTextChatTemplate()",
      "asOf": "2026-11-17"
    },
    "F24": {
      "label": "Project repository, @huggingface/transformers",
      "display": "can1357/oh-my-pi",
      "asOf": "2026-11-17"
    },
    "F25": {
      "label": "Project stars, can1357/oh-my-pi",
      "display": "39.2K",
      "asOf": "2026-11-17"
    },
    "F26": {
      "label": "Project push date, can1357/oh-my-pi",
      "display": "Nov 2026",
      "asOf": "2026-11-17"
    },
    "F27": {
      "label": "Library name, gpt-tokenizer",
      "display": "gpt-tokenizer",
      "asOf": "2026-11-17"
    },
    "F28": {
      "label": "Monthly downloads, gpt-tokenizer",
      "display": "10.4M",
      "asOf": "2026-11-15"
    },
    "F29": {
      "label": "License, gpt-tokenizer",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F30": {
      "label": "Package release, gpt-tokenizer",
      "display": "4.1.2",
      "asOf": "2026-11-17"
    },
    "F31": {
      "label": "Undated package release, gpt-tokenizer",
      "display": "v4.1.2",
      "asOf": "2026-11-17"
    },
    "F32": {
      "label": "Repository stars, gpt-tokenizer",
      "display": "862",
      "asOf": "2026-11-17"
    },
    "F33": {
      "label": "Decodes tokens, gpt-tokenizer",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F34": {
      "label": "Selects model tokenizer, gpt-tokenizer",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F35": {
      "label": "Formats chat messages, gpt-tokenizer",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F36": {
      "label": "Special token control, gpt-tokenizer",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F37": {
      "label": "Install, gpt-tokenizer",
      "display": "npm install gpt-tokenizer",
      "asOf": "2026-11-17"
    },
    "F38": {
      "label": "What it does, gpt-tokenizer",
      "display": "Encodes and decodes model text with a pure-JavaScript byte-pair tokenizer.",
      "asOf": "2026-11-17"
    },
    "F39": {
      "label": "strengths lead, gpt-tokenizer",
      "display": "Checks budgets before full encoding",
      "asOf": "2026-11-17"
    },
    "F40": {
      "label": "strengths, gpt-tokenizer",
      "display": "Check text or chat limits without encoding the entire input.",
      "asOf": "2026-11-17"
    },
    "F41": {
      "label": "strengths lead, gpt-tokenizer",
      "display": "Updates counts after text edits",
      "asOf": "2026-11-17"
    },
    "F42": {
      "label": "strengths, gpt-tokenizer",
      "display": "Track appended text and edits with an incremental counter.",
      "asOf": "2026-11-17"
    },
    "F43": {
      "label": "limitations lead, gpt-tokenizer",
      "display": "Reserved tokens require explicit permission",
      "asOf": "2026-11-17"
    },
    "F44": {
      "label": "limitations, gpt-tokenizer",
      "display": "Configure allowedSpecial when reserved token strings should be accepted.",
      "asOf": "2026-11-17"
    },
    "F45": {
      "label": "limitations lead, gpt-tokenizer",
      "display": "Incremental edits can rescan text",
      "asOf": "2026-11-17"
    },
    "F46": {
      "label": "limitations, gpt-tokenizer",
      "display": "Long words or whitespace runs can require rescanning a large region.",
      "asOf": "2026-11-17"
    },
    "F47": {
      "label": "Quickstart, gpt-tokenizer",
      "display": "import {\n  countChatCompletionTokens,\n  type ChatCompletionRequest,\n} from 'gpt-tokenizer/model/gpt-4o'\n\nconst request: ChatCompletionRequest = {\n  messages: [\n    { role: 'system', content: 'You are a helpful assistant.' },\n    { role: 'user', content: 'Find the weather for San Francisco.' },\n  ],\n  functions: [\n    {\n      name: 'get_weather',\n      description: 'Look up the weather for a city.',\n      parameters: {\n        type: 'object',\n        required: ['city'],\n        properties: {\n          city: { type: 'string' },\n          unit: { type: 'string', enum: ['celsius', 'fahrenheit'] },\n        },\n      },\n    },\n  ],\n}\n\nconst promptTokenEstimate = countChatCompletionTokens(request)\n",
      "asOf": "2026-11-17"
    },
    "F48": {
      "label": "Project function, gpt-tokenizer",
      "display": "function countToolCallFunctionTokens(\n  toolCallFunction: { name?: string; arguments?: string } | undefined,\n): number {\n  if (!toolCallFunction) {\n    return 0;\n  }\n\n  let tokenCount = 0;\n  tokenCount += encode(toolCallFunction.name ?? \"\").length + 10; // Function name and structure overhead\n  tokenCount += encode(toolCallFunction.arguments ?? \"\").length; // Arguments\n  return tokenCount;\n}\n",
      "asOf": "2026-11-17"
    },
    "F49": {
      "label": "Project function reference, gpt-tokenizer",
      "display": "tokenizer.ts · countToolCallFunctionTokens()",
      "asOf": "2026-11-17"
    },
    "F50": {
      "label": "Project repository, gpt-tokenizer",
      "display": "continuedev/continue",
      "asOf": "2026-11-17"
    },
    "F51": {
      "label": "Project stars, continuedev/continue",
      "display": "36.5K",
      "asOf": "2026-11-17"
    },
    "F52": {
      "label": "Project push date, continuedev/continue",
      "display": "Nov 2026",
      "asOf": "2026-11-16"
    },
    "F53": {
      "label": "Library name, tiktoken",
      "display": "tiktoken",
      "asOf": "2026-11-17"
    },
    "F54": {
      "label": "Monthly downloads, tiktoken",
      "display": "8.4M",
      "asOf": "2026-11-15"
    },
    "F55": {
      "label": "License, tiktoken",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F56": {
      "label": "Package release, tiktoken",
      "display": "1.0.22",
      "asOf": "2026-11-17"
    },
    "F57": {
      "label": "Undated package release, tiktoken",
      "display": "v1.0.22",
      "asOf": "2026-11-17"
    },
    "F58": {
      "label": "Repository stars, tiktoken",
      "display": "1.1K",
      "asOf": "2026-11-17"
    },
    "F59": {
      "label": "Decodes tokens, tiktoken",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F60": {
      "label": "Selects model tokenizer, tiktoken",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F61": {
      "label": "Special token control, tiktoken",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F62": {
      "label": "Install, tiktoken",
      "display": "npm install tiktoken",
      "asOf": "2026-11-17"
    },
    "F63": {
      "label": "What it does, tiktoken",
      "display": "Provides JavaScript and WASM bindings to OpenAI-model byte-pair tokenizers.",
      "asOf": "2026-11-17"
    },
    "F64": {
      "label": "strengths lead, tiktoken",
      "display": "Maps models to their encodings",
      "asOf": "2026-11-17"
    },
    "F65": {
      "label": "strengths, tiktoken",
      "display": "Resolve a model tokenizer with encoding_for_model.",
      "asOf": "2026-11-17"
    },
    "F66": {
      "label": "strengths lead, tiktoken",
      "display": "Loads individual encoding tables",
      "asOf": "2026-11-17"
    },
    "F67": {
      "label": "strengths, tiktoken",
      "display": "Use tiktoken/lite to avoid loading every encoder at once.",
      "asOf": "2026-11-17"
    },
    "F68": {
      "label": "limitations lead, tiktoken",
      "display": "Encoders need explicit cleanup",
      "asOf": "2026-11-17"
    },
    "F69": {
      "label": "limitations, tiktoken",
      "display": "Call free() when an encoder is no longer needed.",
      "asOf": "2026-11-17"
    },
    "F70": {
      "label": "limitations lead, tiktoken",
      "display": "Vite requires extra build plugins",
      "asOf": "2026-11-17"
    },
    "F71": {
      "label": "limitations, tiktoken",
      "display": "Add WASM and top-level-await plugins when bundling with Vite.",
      "asOf": "2026-11-17"
    },
    "F72": {
      "label": "Quickstart, tiktoken",
      "display": "const { Tiktoken } = require(\"tiktoken/lite\");\nconst cl100k_base = require(\"tiktoken/encoders/cl100k_base.json\");\n\nconst encoding = new Tiktoken(\n  cl100k_base.bpe_ranks,\n  cl100k_base.special_tokens,\n  cl100k_base.pat_str\n);\nconst tokens = encoding.encode(\"hello world\");\nencoding.free();\n",
      "asOf": "2026-11-17"
    },
    "F73": {
      "label": "Project function, tiktoken",
      "display": "export function textTokensForLLM(text: string, llm: DLLM, debugFrom: string): number | null {\n  // The library shall have been preloaded - if not, attempt to start its loading and return null to indicate we're not ready to count\n  if (!encoding_for_model || !get_encoding) {\n    if (!informTheUser) {\n      console.warn('textTokensForLLM: Tiktoken library is not yet loaded, loading now...');\n      informTheUser = true;\n    }\n    void preloadTiktokenLibrary().catch(() => {}); // preload without waiting; swallow rejection (already logged, falls back to approximate counting) to avoid an unhandled-rejection report\n    return null;\n  }\n\n  // Validate input\n  const llmParameters = getAllModelParameterValues(llm.initialParameters, llm.userParameters);\n  const openaiModel = llmParameters.llmRef;\n  if (!openaiModel) {\n    console.warn(`textTokensForLLM: LLM ${llm?.id} has no LLM reference id`);\n    return null;\n  }\n\n  if (!(openaiModel in tokenEncoders)) {\n    try {\n      tokenEncoders[openaiModel] = encoding_for_model(openaiModel as TiktokenModel);\n    } catch (e) {\n      // Fallback to a known tokenizer if the model is not found\n      if (!(fallbackEncodingId in tokenizerCache))\n        tokenizerCache[fallbackEncodingId] = get_encoding(fallbackEncodingId);\n      tokenEncoders[openaiModel] = tokenizerCache[fallbackEncodingId];\n    }\n  }\n\n  // Note: the try/catch shouldn't be necessary, but there could be corner cases where the tiktoken library throws\n  // https://github.com/enricoros/big-agi/issues/182\n  let count = 0;\n  try {\n    count = tokenEncoders[openaiModel]?.encode(text, 'all', [])?.length || 0;\n  } catch (e) {\n    console.warn(`textTokensForLLM: Error tokenizing \"${text.slice(0, 10)}...\" with model '${openaiModel}': ${e}`);\n  }\n  if (DEBUG_TOKEN_COUNT)\n    console.log(`textTokensForLLM: ${debugFrom}, ${llm?.id}, \"${text.slice(0, 10)}\": ${count}`);\n  return count;\n}\n",
      "asOf": "2026-11-17"
    },
    "F74": {
      "label": "Project function reference, tiktoken",
      "display": "tokens.text.ts · textTokensForLLM()",
      "asOf": "2026-11-17"
    },
    "F75": {
      "label": "Project repository, tiktoken",
      "display": "enricoros/big-AGI",
      "asOf": "2026-11-17"
    },
    "F76": {
      "label": "Project stars, enricoros/big-AGI",
      "display": "7.2K",
      "asOf": "2026-11-17"
    },
    "F77": {
      "label": "Project push date, enricoros/big-AGI",
      "display": "Nov 2026",
      "asOf": "2026-11-14"
    },
    "F78": {
      "label": "Library name, gpt-3-encoder",
      "display": "GPT-3-Encoder",
      "asOf": "2026-11-17"
    },
    "F79": {
      "label": "Monthly downloads, gpt-3-encoder",
      "display": "635.5K",
      "asOf": "2026-11-15"
    },
    "F80": {
      "label": "License, gpt-3-encoder",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F81": {
      "label": "Package release, gpt-3-encoder",
      "display": "1.1.4",
      "asOf": "2026-11-17"
    },
    "F82": {
      "label": "Undated package release, gpt-3-encoder",
      "display": "v1.1.4",
      "asOf": "2026-11-17"
    },
    "F83": {
      "label": "Repository stars, gpt-3-encoder",
      "display": "722",
      "asOf": "2026-11-17"
    },
    "F84": {
      "label": "Decodes tokens, gpt-3-encoder",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F85": {
      "label": "Install, gpt-3-encoder",
      "display": "npm install gpt-3-encoder",
      "asOf": "2026-11-17"
    },
    "F86": {
      "label": "What it does, gpt-3-encoder",
      "display": "Implements the original GPT-2/GPT-3 text encoder and decoder in JavaScript.",
      "asOf": "2026-11-17"
    },
    "F87": {
      "label": "strengths lead, gpt-3-encoder",
      "display": "Fits legacy GPT-2/3 workflows",
      "asOf": "2026-11-17"
    },
    "F88": {
      "label": "strengths, gpt-3-encoder",
      "display": "Encode text and decode token IDs for those model families.",
      "asOf": "2026-11-17"
    },
    "F89": {
      "label": "strengths lead, gpt-3-encoder",
      "display": "Exposes individual decoded token pieces",
      "asOf": "2026-11-17"
    },
    "F90": {
      "label": "strengths, gpt-3-encoder",
      "display": "Decode token IDs separately when inspecting a sequence.",
      "asOf": "2026-11-17"
    },
    "F91": {
      "label": "limitations lead, gpt-3-encoder",
      "display": "Targets legacy GPT-2/3 encodings",
      "asOf": "2026-11-17"
    },
    "F92": {
      "label": "limitations, gpt-3-encoder",
      "display": "Match the model tokenizer before relying on context-budget estimates.",
      "asOf": "2026-11-17"
    },
    "F93": {
      "label": "Quickstart, gpt-3-encoder",
      "display": "const {encode, decode} = require('gpt-3-encoder')\n\nconst str = 'This is an example sentence to try encoding out on!'\nconst encoded = encode(str)\nconsole.log('Encoded this string looks like: ', encoded)\n\nconsole.log('We can look at each token and what it represents')\nfor(let token of encoded){\n  console.log({token, string: decode([token])})\n}\n\nconst decoded = decode(encoded)\nconsole.log('We can decode it back into:\\n', decoded)\n\n",
      "asOf": "2026-11-17"
    },
    "F94": {
      "label": "Project function, gpt-3-encoder",
      "display": "const chunkEssay = async (essay: PGEssay) => {\n  const { title, url, date, thanks, content, ...chunklessSection } = essay;\n\n  let essayTextChunks = [];\n\n  if (encode(content).length > CHUNK_SIZE) {\n    const split = content.split(\". \");\n    let chunkText = \"\";\n\n    for (let i = 0; i < split.length; i++) {\n      const sentence = split[i];\n      const sentenceTokenLength = encode(sentence);\n      const chunkTextTokenLength = encode(chunkText).length;\n\n      if (chunkTextTokenLength + sentenceTokenLength.length > CHUNK_SIZE) {\n        essayTextChunks.push(chunkText);\n        chunkText = \"\";\n      }\n\n      if (sentence[sentence.length - 1].match(/[a-z0-9]/i)) {\n        chunkText += sentence + \". \";\n      } else {\n        chunkText += sentence + \" \";\n      }\n    }\n\n    essayTextChunks.push(chunkText.trim());\n  } else {\n    essayTextChunks.push(content.trim());\n  }\n\n  const essayChunks = essayTextChunks.map((text) => {\n    const trimmedText = text.trim();\n\n    const chunk: PGChunk = {\n      essay_title: title,\n      essay_url: url,\n      essay_date: date,\n      essay_thanks: thanks,\n      content: trimmedText,\n      content_length: trimmedText.length,\n      content_tokens: encode(trimmedText).length,\n      embedding: []\n    };\n\n    return chunk;\n  });\n\n  if (essayChunks.length > 1) {\n    for (let i = 0; i < essayChunks.length; i++) {\n      const chunk = essayChunks[i];\n      const prevChunk = essayChunks[i - 1];\n\n      if (chunk.content_tokens < 100 && prevChunk) {\n        prevChunk.content += \" \" + chunk.content;\n        prevChunk.content_length += chunk.content_length;\n        prevChunk.content_tokens += chunk.content_tokens;\n        essayChunks.splice(i, 1);\n        i--;\n      }\n    }\n  }\n\n  const chunkedSection: PGEssay = {\n    ...essay,\n    chunks: essayChunks\n  };\n\n  return chunkedSection;\n};\n",
      "asOf": "2026-11-17"
    },
    "F95": {
      "label": "Project function reference, gpt-3-encoder",
      "display": "scrape.ts · chunkEssay()",
      "asOf": "2026-11-17"
    },
    "F96": {
      "label": "Project repository, gpt-3-encoder",
      "display": "mckaywrigley/paul-graham-gpt",
      "asOf": "2026-11-17"
    },
    "F97": {
      "label": "Project stars, mckaywrigley/paul-graham-gpt",
      "display": "2.7K",
      "asOf": "2026-11-17"
    },
    "F98": {
      "label": "Project push date, mckaywrigley/paul-graham-gpt",
      "display": "Jul 2023",
      "asOf": "2023-07-28"
    },
    "F99": {
      "label": "Developer need",
      "display": "Checking a text or chat budget",
      "asOf": "2026-11-17"
    },
    "F100": {
      "label": "Why choose gpt-tokenizer",
      "display": "token-limit checks without fully encoding input",
      "asOf": "2026-11-17"
    },
    "F101": {
      "label": "Developer need in introduction",
      "display": "checking a text or chat budget",
      "asOf": "2026-11-17"
    },
    "F102": {
      "label": "Developer need",
      "display": "Loading a specific encoding table",
      "asOf": "2026-11-17"
    },
    "F103": {
      "label": "Why choose tiktoken",
      "display": "the lightweight single-encoding workflow",
      "asOf": "2026-11-17"
    },
    "F104": {
      "label": "Developer need in introduction",
      "display": "loading a specific encoding table",
      "asOf": "2026-11-17"
    },
    "F105": {
      "label": "When to consider gpt-tokenizer",
      "display": "a direct text/chat budget check is the priority",
      "asOf": "2026-11-17"
    },
    "F106": {
      "label": "Developer need",
      "display": "Formatting a pretrained model’s chat",
      "asOf": "2026-11-17"
    },
    "F107": {
      "label": "Why choose @huggingface/transformers",
      "display": "model-specific chat templates",
      "asOf": "2026-11-17"
    },
    "F108": {
      "label": "Developer need in introduction",
      "display": "formatting a pretrained model’s chat",
      "asOf": "2026-11-17"
    },
    "F109": {
      "label": "When to consider gpt-tokenizer",
      "display": "a direct GPT text/chat budget check is sufficient",
      "asOf": "2026-11-17"
    },
    "F110": {
      "label": "Page introduction",
      "display": "JavaScript tokenizer libraries let text-processing developers split and encode text into tokens.",
      "asOf": "2026-11-17"
    },
    "F111": {
      "label": "FAQ: What does a model tokenizer produce?",
      "display": "gpt-tokenizer turns text into a sequence of integer token IDs and decodes IDs back into text.",
      "asOf": "2026-11-17"
    },
    "F112": {
      "label": "FAQ: Can token counts for separate text chunks simply be added?",
      "display": "Appending can change the tokens at the join, so separate chunk counts cannot simply be added.",
      "asOf": "2026-11-17"
    },
    "F113": {
      "label": "FAQ: Which package checks whether a prompt fits a token budget?",
      "display": "gpt-tokenizer provides isWithinTokenLimit for text or chat without encoding the entire input.",
      "asOf": "2026-11-17"
    },
    "F114": {
      "label": "FAQ: Does tokenizing a message’s text account for chat formatting?",
      "display": "gpt-tokenizer has an explicit encodeChat helper for chat messages.",
      "asOf": "2026-11-17"
    },
    "F115": {
      "label": "FAQ: Does tokenizing a message’s text account for chat formatting?",
      "display": "Transformers.js applies the tokenizer’s chat template to determine model control tokens and formatting.",
      "asOf": "2026-11-17"
    },
    "F116": {
      "label": "FAQ: Which encoding does the default gpt-tokenizer import use?",
      "display": "Its current README identifies o200k_base as the default encoding.",
      "asOf": "2026-11-17"
    },
    "F117": {
      "label": "FAQ: How can tiktoken load a tokenizer for a particular model?",
      "display": "Use encoding_for_model for the matching model tokenizer; get_encoding selects a named encoding.",
      "asOf": "2026-11-17"
    },
    "F118": {
      "label": "FAQ: Does every tiktoken import load all encoder tables?",
      "display": "The lightweight tiktoken/lite workflow lets constrained environments load a chosen encoding table.",
      "asOf": "2026-11-17"
    },
    "F119": {
      "label": "FAQ: How should WASM encoder memory be released?",
      "display": "The tiktoken README explicitly calls free when the encoder is no longer used.",
      "asOf": "2026-11-17"
    },
    "F120": {
      "label": "FAQ: Why can reserved token strings make encoding fail?",
      "display": "gpt-tokenizer disallows special tokens by default; its encoding options control allowed and disallowed sets.",
      "asOf": "2026-11-17"
    },
    "F121": {
      "label": "FAQ: Can an incremental counter update in constant time?",
      "display": "gpt-tokenizer warns that long words/whitespace and middle edits can trigger additional work; updates are not guaranteed constant time.",
      "asOf": "2026-11-17"
    },
    "F122": {
      "label": "FAQ: Does adding tool definitions always change a Transformers.js chat template?",
      "display": "Tool arguments have no effect when the chosen template does not support function calling.",
      "asOf": "2026-11-17"
    },
    "F123": {
      "label": "FAQ: What does AutoTokenizer need to load a model tokenizer?",
      "display": "It selects the class from tokenizer configuration and requires the tokenizer files to exist at the supplied model or local path.",
      "asOf": "2026-11-17"
    },
    "F124": {
      "label": "Library name, js-tiktoken",
      "display": "js-tiktoken",
      "asOf": "2026-11-20"
    },
    "F125": {
      "label": "Monthly downloads, js-tiktoken",
      "display": "49.4M",
      "asOf": "2026-11-20"
    },
    "F126": {
      "label": "License, js-tiktoken",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F127": {
      "label": "Package release, js-tiktoken",
      "display": "1.0.21",
      "asOf": "2026-11-20"
    },
    "F128": {
      "label": "Package release date, js-tiktoken",
      "display": "Aug 2025",
      "asOf": "2026-11-20"
    },
    "F129": {
      "label": "Install, js-tiktoken",
      "display": "npm install js-tiktoken@1.0.21",
      "asOf": "2026-11-20"
    },
    "F130": {
      "label": "Quickstart, js-tiktoken",
      "display": "import { getEncoding } from \"js-tiktoken\";\nconst tokenizer = getEncoding(\"o200k_base\");\nconsole.log(tokenizer.encode(\"Hello world\"));\n",
      "asOf": "2026-11-20"
    },
    "F131": {
      "label": "Official description, js-tiktoken",
      "display": "Provides a JavaScript port of the tiktoken tokenizer for OpenAI models.",
      "asOf": "2026-11-20"
    },
    "F132": {
      "label": "Quickstart source file, js-tiktoken",
      "display": "js/README.md",
      "asOf": "2026-11-20"
    },
    "F133": {
      "label": "Repository stars, js-tiktoken",
      "display": "1.1K",
      "asOf": "2026-11-20"
    },
    "F134": {
      "label": "Chat message formatting, js-tiktoken",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F135": {
      "label": "Hugging Face configs, js-tiktoken",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F136": {
      "label": "Model, encoding, and runtime role, js-tiktoken",
      "display": "Pure JavaScript OpenAI BPE port: full rank tables or Lite per-encoding loading, with no WASM lifecycle. Distinct runtime choice from the same repository’s tiktoken WASM interface; their counters are not independent unique adoption.",
      "asOf": "2026-11-20"
    },
    "F137": {
      "label": "First-call prerequisites, js-tiktoken",
      "display": "Supported ESM Node.js or browser bundler host. Full entry includes encoding rank data; Lite can load only a chosen table. This is the pure JavaScript interface and has no WASM free method. The selected encoding must match the actual target model.",
      "asOf": "2026-11-20"
    },
    "F138": {
      "label": "Project function, js-tiktoken",
      "display": "export async function getEncoding(encoding: TiktokenEncoding) {\n  if (!(encoding in cache)) {\n    cache[encoding] = caller\n      .fetch(`https://tiktoken.pages.dev/js/${encoding}.json`)\n      .then((res) => res.json())\n      .then((data) => new Tiktoken(data))\n      .catch((e) => {\n        delete cache[encoding];\n        throw e;\n      });\n  }\n\n  return await cache[encoding];\n}\n",
      "asOf": "2026-11-20"
    },
    "F139": {
      "label": "Project source file, js-tiktoken",
      "display": "libs/langchain-core/src/utils/tiktoken.ts",
      "asOf": "2026-11-20"
    },
    "F140": {
      "label": "Project full_name, js-tiktoken",
      "display": "langchain-ai/langchainjs",
      "asOf": "2026-11-20"
    },
    "F141": {
      "label": "Project stargazers_count, js-tiktoken",
      "display": "18.4K",
      "asOf": "2026-11-20"
    },
    "F142": {
      "label": "Library name, @huggingface/transformers",
      "display": "Transformers.js",
      "asOf": "2026-11-20"
    },
    "F143": {
      "label": "Monthly downloads, @huggingface/transformers",
      "display": "19.1M",
      "asOf": "2026-11-20"
    },
    "F144": {
      "label": "License, @huggingface/transformers",
      "display": "Apache-2.0",
      "asOf": "2026-11-20"
    },
    "F145": {
      "label": "Package release, @huggingface/transformers",
      "display": "4.3.2",
      "asOf": "2026-11-20"
    },
    "F146": {
      "label": "Package release date, @huggingface/transformers",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F147": {
      "label": "Install, @huggingface/transformers",
      "display": "npm install @huggingface/transformers@4.3.2",
      "asOf": "2026-11-20"
    },
    "F148": {
      "label": "Quickstart, @huggingface/transformers",
      "display": "import { AutoTokenizer } from \"@huggingface/transformers\";\nconst tokenizer = await AutoTokenizer.from_pretrained(\"Xenova/bert-base-uncased\");\nconst { input_ids } = await tokenizer(\"Hello world\");\nconsole.log(input_ids);\n",
      "asOf": "2026-11-20"
    },
    "F149": {
      "label": "Repository stars, @huggingface/transformers",
      "display": "16.4K",
      "asOf": "2026-11-20"
    },
    "F150": {
      "label": "Chat message formatting, @huggingface/transformers",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F151": {
      "label": "Hugging Face configs, @huggingface/transformers",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F152": {
      "label": "Model, encoding, and runtime role, @huggingface/transformers",
      "display": "Pretrained tokenizer/config loading and model-specific chat-template rendering inside the larger Transformers.js package. Its whole-package downloads include inference uses and overlap its raw tokenizer dependency; not tokenizer-specific market share.",
      "asOf": "2026-11-20"
    },
    "F153": {
      "label": "First-call prerequisites, @huggingface/transformers",
      "display": "Supported Node.js ESM or configured browser bundler with access to the public model tokenizer/config files, or an already configured local/cache path. This calls the tokenizer, not a model inference pipeline; BERT is an encoding example and not a chat-template-capable model. Use an actual chat model/config for the separate project chat-rendering example.",
      "asOf": "2026-11-20"
    },
    "F154": {
      "label": "Project function, @huggingface/transformers",
      "display": "export function renderTextChatTemplate(\n\ttokenizer: TextGenerationPipeline[\"tokenizer\"],\n\tmessages: readonly { role: string; content: string }[],\n\toptions: TextChatTemplateOptions,\n): string {\n\tconst source: unknown = tokenizer.get_chat_template();\n\tconst chatTemplate = typeof source === \"string\" ? source.replace(GENERATION_STATEMENT, \"\") : undefined;\n\tconst templateOptions: {\n\t\tchat_template?: string;\n\t\tadd_generation_prompt: boolean;\n\t\ttokenize: false;\n\t\tenable_thinking: boolean;\n\t} = {\n\t\t...(chatTemplate === undefined ? {} : { chat_template: chatTemplate }),\n\t\tadd_generation_prompt: options.addGenerationPrompt,\n\t\ttokenize: false,\n\t\tenable_thinking: options.enableThinking,\n\t};\n\treturn tokenizer.apply_chat_template([...messages], templateOptions);\n}\n",
      "asOf": "2026-11-20"
    },
    "F155": {
      "label": "Project source file, @huggingface/transformers",
      "display": "packages/coding-agent/src/tiny/completion-prompt.ts",
      "asOf": "2026-11-20"
    },
    "F156": {
      "label": "Project full_name, @huggingface/transformers",
      "display": "can1357/oh-my-pi",
      "asOf": "2026-11-20"
    },
    "F157": {
      "label": "Project stargazers_count, @huggingface/transformers",
      "display": "39.2K",
      "asOf": "2026-11-20"
    },
    "F158": {
      "label": "Library name, @huggingface/tokenizers",
      "display": "Tokenizers.js",
      "asOf": "2026-11-20"
    },
    "F159": {
      "label": "Monthly downloads, @huggingface/tokenizers",
      "display": "15.4M",
      "asOf": "2026-11-20"
    },
    "F160": {
      "label": "License, @huggingface/tokenizers",
      "display": "Apache-2.0",
      "asOf": "2026-11-20"
    },
    "F161": {
      "label": "Package release, @huggingface/tokenizers",
      "display": "0.2.0",
      "asOf": "2026-11-20"
    },
    "F162": {
      "label": "Package release date, @huggingface/tokenizers",
      "display": "Sep 2026",
      "asOf": "2026-11-20"
    },
    "F163": {
      "label": "Install, @huggingface/tokenizers",
      "display": "npm install @huggingface/tokenizers@0.2.0",
      "asOf": "2026-11-20"
    },
    "F164": {
      "label": "Quickstart, @huggingface/tokenizers",
      "display": "import { Tokenizer } from \"@huggingface/tokenizers\";\nconst base = \"https://huggingface.co/HuggingFaceTB/SmolLM3-3B/resolve/main\";\nconst json = await fetch(`${base}/tokenizer.json`).then(response => response.json());\nconst config = await fetch(`${base}/tokenizer_config.json`).then(response => response.json());\nconst tokenizer = new Tokenizer(json, config);\nconsole.log(tokenizer.encode(\"Hello world\").ids);\n",
      "asOf": "2026-11-20"
    },
    "F165": {
      "label": "Official description, @huggingface/tokenizers",
      "display": "Implements common model tokenizers in pure JavaScript and TypeScript.",
      "asOf": "2026-11-20"
    },
    "F166": {
      "label": "Quickstart source file, @huggingface/tokenizers",
      "display": "README.md",
      "asOf": "2026-11-20"
    },
    "F167": {
      "label": "Repository stars, @huggingface/tokenizers",
      "display": "62",
      "asOf": "2026-11-20"
    },
    "F168": {
      "label": "Chat message formatting, @huggingface/tokenizers",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F169": {
      "label": "Hugging Face configs, @huggingface/tokenizers",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F170": {
      "label": "Model, encoding, and runtime role, @huggingface/tokenizers",
      "display": "Standalone pure JS tokenizer engine consumes parsed Hugging Face tokenizer.json and tokenizer_config.json and returns IDs/tokens/attention mask. It avoids the larger pretrained/inference facade but requires file loading and has published regex/component compatibility limits.",
      "asOf": "2026-11-20"
    },
    "F171": {
      "label": "First-call prerequisites, @huggingface/tokenizers",
      "display": "ESM browser or Node host with global fetch and access to the two public model JSON files. Both required objects are actually loaded here; no hidden tokenizer.json fixture. Pure JavaScript model-file tokenization, with published regex compatibility limits; do not infer perfect parity for every Rust/Oniguruma pattern.",
      "asOf": "2026-11-20"
    },
    "F172": {
      "label": "Project function, @huggingface/tokenizers",
      "display": "const tokenizeAndTruncate = (tokenizer: HFTokenizer): string => {\n    const encoded = tokenizer.encode(text);\n    const rawIds: ArrayLike<number | bigint> = encoded.ids;\n    const ids = Array.from(rawIds as ArrayLike<number>).map(Number);\n    if (ids.length <= maxTokens) {\n      return text;\n    }\n    const truncatedIds = ids.slice(0, maxTokens);\n    return tokenizer.decode(truncatedIds, { skip_special_tokens: true });\n  };\n",
      "asOf": "2026-11-20"
    },
    "F173": {
      "label": "Project source file, @huggingface/tokenizers",
      "display": "src/utils/tokenTruncation.ts",
      "asOf": "2026-11-20"
    },
    "F174": {
      "label": "Project full_name, @huggingface/tokenizers",
      "display": "samanhappy/mcphub",
      "asOf": "2026-11-20"
    },
    "F175": {
      "label": "Project stargazers_count, @huggingface/tokenizers",
      "display": "2.7K",
      "asOf": "2026-11-20"
    },
    "F176": {
      "label": "Library name, gpt-tokenizer",
      "display": "gpt-tokenizer",
      "asOf": "2026-11-20"
    },
    "F177": {
      "label": "Monthly downloads, gpt-tokenizer",
      "display": "10.6M",
      "asOf": "2026-11-20"
    },
    "F178": {
      "label": "License, gpt-tokenizer",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F179": {
      "label": "Package release, gpt-tokenizer",
      "display": "4.1.2",
      "asOf": "2026-11-20"
    },
    "F180": {
      "label": "Package release date, gpt-tokenizer",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F181": {
      "label": "Install, gpt-tokenizer",
      "display": "npm install gpt-tokenizer@4.1.2",
      "asOf": "2026-11-20"
    },
    "F182": {
      "label": "Quickstart, gpt-tokenizer",
      "display": "import { encode, decode } from \"gpt-tokenizer\";\nconst ids = encode(\"Hello world\");\nconsole.log(ids, decode(ids));\n",
      "asOf": "2026-11-20"
    },
    "F183": {
      "label": "Repository stars, gpt-tokenizer",
      "display": "862",
      "asOf": "2026-11-20"
    },
    "F184": {
      "label": "Chat message formatting, gpt-tokenizer",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F185": {
      "label": "Hugging Face configs, gpt-tokenizer",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F186": {
      "label": "Model, encoding, and runtime role, gpt-tokenizer",
      "display": "Pure JavaScript OpenAI encodings with native encodeChat and token-limit APIs plus direct model/encoding subpaths. Default current entry uses o200k_base; text counts and application overhead are distinct from a provider’s total chat/tool usage.",
      "asOf": "2026-11-20"
    },
    "F187": {
      "label": "First-call prerequisites, gpt-tokenizer",
      "display": "Supported ESM Node.js or browser bundler host. Default package uses the documented o200k_base encoding; use an explicit encoding/model subpath when the model differs. This is a text round trip, not a claim that all provider chat/tool framing or billing is included.",
      "asOf": "2026-11-20"
    },
    "F188": {
      "label": "Project function, gpt-tokenizer",
      "display": "function countToolCallFunctionTokens(\n  toolCallFunction: { name?: string; arguments?: string } | undefined,\n): number {\n  if (!toolCallFunction) {\n    return 0;\n  }\n\n  let tokenCount = 0;\n  tokenCount += encode(toolCallFunction.name ?? \"\").length + 10; // Function name and structure overhead\n  tokenCount += encode(toolCallFunction.arguments ?? \"\").length; // Arguments\n  return tokenCount;\n}\n",
      "asOf": "2026-11-20"
    },
    "F189": {
      "label": "Project source file, gpt-tokenizer",
      "display": "extensions/cli/src/util/tokenizer.ts",
      "asOf": "2026-11-20"
    },
    "F190": {
      "label": "Project full_name, gpt-tokenizer",
      "display": "continuedev/continue",
      "asOf": "2026-11-20"
    },
    "F191": {
      "label": "Project stargazers_count, gpt-tokenizer",
      "display": "36.5K",
      "asOf": "2026-11-20"
    },
    "F192": {
      "label": "Library name, tiktoken",
      "display": "tiktoken",
      "asOf": "2026-11-20"
    },
    "F193": {
      "label": "Monthly downloads, tiktoken",
      "display": "8.7M",
      "asOf": "2026-11-20"
    },
    "F194": {
      "label": "License, tiktoken",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F195": {
      "label": "Package release, tiktoken",
      "display": "1.0.22",
      "asOf": "2026-11-20"
    },
    "F196": {
      "label": "Package release date, tiktoken",
      "display": "Aug 2025",
      "asOf": "2026-11-20"
    },
    "F197": {
      "label": "Install, tiktoken",
      "display": "npm install tiktoken@1.0.22",
      "asOf": "2026-11-20"
    },
    "F198": {
      "label": "Quickstart, tiktoken",
      "display": "import { get_encoding } from \"tiktoken\";\nconst tokenizer = get_encoding(\"o200k_base\");\nconsole.log(tokenizer.encode(\"Hello world\"));\ntokenizer.free();\n",
      "asOf": "2026-11-20"
    },
    "F199": {
      "label": "Repository stars, tiktoken",
      "display": "1.1K",
      "asOf": "2026-11-20"
    },
    "F200": {
      "label": "Chat message formatting, tiktoken",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F201": {
      "label": "Hugging Face configs, tiktoken",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F202": {
      "label": "Model, encoding, and runtime role, tiktoken",
      "display": "WASM/native-memory OpenAI BPE bindings with table/model selection and explicit encoder free. Per-token byte inspection is available; browser/edge WASM loading and correct special-token policy remain runtime/input choices.",
      "asOf": "2026-11-20"
    },
    "F203": {
      "label": "First-call prerequisites, tiktoken",
      "display": "Supported Node.js ESM/bundler host with this package WASM initialization/assets configured. Encodes text with one selected table and frees the native/WASM encoder afterward. Browser and edge builds need their documented WASM loading setup, unlike the pure JS port.",
      "asOf": "2026-11-20"
    },
    "F204": {
      "label": "Project function, tiktoken",
      "display": "export function textTokensForEncodingId(text: string, encodingId: string, debugFrom: string): Array<UITokenChunk> | null {\n  // The library shall have been preloaded - if not, attempt to start its loading and return null to indicate we're not ready to count\n  if (!get_encoding) {\n    if (!informTheUser) {\n      console.warn('textTokensForEncodingId: Tiktoken library is not yet loaded, loading now...');\n      informTheUser = true;\n    }\n    void preloadTiktokenLibrary().catch(() => {}); // preload without waiting; swallow rejection (already logged, falls back to approximate counting) to avoid an unhandled-rejection report\n    return null;\n  }\n\n  if (!(encodingId in tokenizerCache)) {\n    try {\n      tokenizerCache[encodingId] = get_encoding(encodingId as TiktokenEncoding);\n    } catch (e) {\n      console.error(`textTokensForEncodingId: Error initializing tokenizer \"${encodingId}\": ${e}`);\n      return null;\n    }\n  }\n\n  try {\n    const tokens = tokenizerCache[encodingId]?.encode(text, 'all', []) || new Uint32Array();\n    if (DEBUG_TOKEN_COUNT)\n      console.log(`textTokensForEncodingId: ${debugFrom}, ${encodingId}, \"${text.slice(0, 10)}\": ${tokens.length}`);\n\n    // for every token create an object {t:token, b: bytes}\n    const tokenDetails: UITokenChunk[] = [];\n    for (let i = 0; i < tokens.length; i++) {\n      const bytesForToken = tokenizerCache[encodingId].decode_single_token_bytes(tokens[i]);\n      const stringForToken = String.fromCharCode(...bytesForToken);\n      tokenDetails.push({\n        token: tokens[i],\n        chunk: stringForToken,\n        bytes: bytesForToken.join(', '),\n      });\n    }\n    return tokenDetails;\n  } catch (e) {\n    console.error(`textTokensForEncodingId: Error tokenizing \"${text.slice(0, 10)}...\" with tokenizer '${encodingId}': ${e}`);\n    return null;\n  }\n}\n",
      "asOf": "2026-11-20"
    },
    "F205": {
      "label": "Project source file, tiktoken",
      "display": "src/common/tokens/tokens.text.ts",
      "asOf": "2026-11-20"
    },
    "F206": {
      "label": "Project full_name, tiktoken",
      "display": "enricoros/big-AGI",
      "asOf": "2026-11-20"
    },
    "F207": {
      "label": "Project stargazers_count, tiktoken",
      "display": "7.2K",
      "asOf": "2026-11-20"
    },
    "F208": {
      "label": "Library name, @anthropic-ai/tokenizer",
      "display": "@anthropic-ai/tokenizer",
      "asOf": "2026-11-20"
    },
    "F209": {
      "label": "Monthly downloads, @anthropic-ai/tokenizer",
      "display": "1.4M",
      "asOf": "2026-11-20"
    },
    "F210": {
      "label": "License, @anthropic-ai/tokenizer",
      "display": "Apache-2.0",
      "asOf": "2026-11-20"
    },
    "F211": {
      "label": "Package release, @anthropic-ai/tokenizer",
      "display": "0.0.4",
      "asOf": "2026-11-20"
    },
    "F212": {
      "label": "Package release date, @anthropic-ai/tokenizer",
      "display": "Jul 2023",
      "asOf": "2026-11-20"
    },
    "F213": {
      "label": "Install, @anthropic-ai/tokenizer",
      "display": "npm install @anthropic-ai/tokenizer@0.0.4",
      "asOf": "2026-11-20"
    },
    "F214": {
      "label": "Quickstart, @anthropic-ai/tokenizer",
      "display": "import { countTokens } from \"@anthropic-ai/tokenizer\";\nconsole.log(countTokens(\"Hello world\"));\n",
      "asOf": "2026-11-20"
    },
    "F215": {
      "label": "Official description, @anthropic-ai/tokenizer",
      "display": "Tokenizes text for Claude models.",
      "asOf": "2026-11-20"
    },
    "F216": {
      "label": "Quickstart source file, @anthropic-ai/tokenizer",
      "display": "README.md; index.ts",
      "asOf": "2026-11-20"
    },
    "F217": {
      "label": "Repository stars, @anthropic-ai/tokenizer",
      "display": "108",
      "asOf": "2026-11-20"
    },
    "F218": {
      "label": "Chat message formatting, @anthropic-ai/tokenizer",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F219": {
      "label": "Hugging Face configs, @anthropic-ai/tokenizer",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F220": {
      "label": "Model, encoding, and runtime role, @anthropic-ai/tokenizer",
      "display": "Older-Anthropic tokenizer/counter. Own README says Claude3 and later are only a very rough approximation, recommends response usage, and warns its beta internals/interfaces may change without a major version bump. Not an exact modern-Claude budget default.",
      "asOf": "2026-11-20"
    },
    "F221": {
      "label": "First-call prerequisites, @anthropic-ai/tokenizer",
      "display": "Supported Node.js ESM host with the package/tiktoken WASM requirements. Publisher explicitly says older Anthropic models only: Claude3 and later counts are merely a very rough approximation. This first call does not establish exact current-Claude prompt/billing counts. countTokens frees its temporary native tokenizer internally.",
      "asOf": "2026-11-20"
    },
    "F222": {
      "label": "Library name, gpt-3-encoder",
      "display": "GPT-3-Encoder",
      "asOf": "2026-11-20"
    },
    "F223": {
      "label": "Monthly downloads, gpt-3-encoder",
      "display": "640.1K",
      "asOf": "2026-11-20"
    },
    "F224": {
      "label": "License, gpt-3-encoder",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F225": {
      "label": "Package release, gpt-3-encoder",
      "display": "1.1.4",
      "asOf": "2026-11-20"
    },
    "F226": {
      "label": "Package release date, gpt-3-encoder",
      "display": "Jan 2023",
      "asOf": "2026-11-20"
    },
    "F227": {
      "label": "Install, gpt-3-encoder",
      "display": "npm install gpt-3-encoder@1.1.4",
      "asOf": "2026-11-20"
    },
    "F228": {
      "label": "Quickstart, gpt-3-encoder",
      "display": "const { encode, decode } = require(\"gpt-3-encoder\");\nconst ids = encode(\"Hello world\");\nconsole.log(ids, decode(ids));\n",
      "asOf": "2026-11-20"
    },
    "F229": {
      "label": "Repository stars, gpt-3-encoder",
      "display": "722",
      "asOf": "2026-11-20"
    },
    "F230": {
      "label": "Chat message formatting, gpt-3-encoder",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F231": {
      "label": "Hugging Face configs, gpt-3-encoder",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F232": {
      "label": "Model, encoding, and runtime role, gpt-3-encoder",
      "display": "Fixed GPT2/GPT3-era JavaScript encoder/decoder, useful for that historical vocabulary. No direct modern model/encoding resolver, Hugging Face config loader, or model-aware chat serializer is exposed by its complete public encode/decode entry.",
      "asOf": "2026-11-20"
    },
    "F233": {
      "label": "First-call prerequisites, gpt-3-encoder",
      "display": "Node.js CommonJS host meeting the publisher Node12+ requirement. Fixed GPT2/GPT3-era BPE vocabulary; not a model resolver for cl100k_base, o200k_base, modern OpenAI chats, or arbitrary Hugging Face tokenizer JSON.",
      "asOf": "2026-11-20"
    },
    "F234": {
      "label": "Project function, gpt-3-encoder",
      "display": "const chunkEssay = async (essay: PGEssay) => {\n  const { title, url, date, thanks, content, ...chunklessSection } = essay;\n\n  let essayTextChunks = [];\n\n  if (encode(content).length > CHUNK_SIZE) {\n    const split = content.split(\". \");\n    let chunkText = \"\";\n\n    for (let i = 0; i < split.length; i++) {\n      const sentence = split[i];\n      const sentenceTokenLength = encode(sentence);\n      const chunkTextTokenLength = encode(chunkText).length;\n\n      if (chunkTextTokenLength + sentenceTokenLength.length > CHUNK_SIZE) {\n        essayTextChunks.push(chunkText);\n        chunkText = \"\";\n      }\n\n      if (sentence[sentence.length - 1].match(/[a-z0-9]/i)) {\n        chunkText += sentence + \". \";\n      } else {\n        chunkText += sentence + \" \";\n      }\n    }\n\n    essayTextChunks.push(chunkText.trim());\n  } else {\n    essayTextChunks.push(content.trim());\n  }\n\n  const essayChunks = essayTextChunks.map((text) => {\n    const trimmedText = text.trim();\n\n    const chunk: PGChunk = {\n      essay_title: title,\n      essay_url: url,\n      essay_date: date,\n      essay_thanks: thanks,\n      content: trimmedText,\n      content_length: trimmedText.length,\n      content_tokens: encode(trimmedText).length,\n      embedding: []\n    };\n\n    return chunk;\n  });\n\n  if (essayChunks.length > 1) {\n    for (let i = 0; i < essayChunks.length; i++) {\n      const chunk = essayChunks[i];\n      const prevChunk = essayChunks[i - 1];\n\n      if (chunk.content_tokens < 100 && prevChunk) {\n        prevChunk.content += \" \" + chunk.content;\n        prevChunk.content_length += chunk.content_length;\n        prevChunk.content_tokens += chunk.content_tokens;\n        essayChunks.splice(i, 1);\n        i--;\n      }\n    }\n  }\n\n  const chunkedSection: PGEssay = {\n    ...essay,\n    chunks: essayChunks\n  };\n\n  return chunkedSection;\n};\n",
      "asOf": "2026-11-20"
    },
    "F235": {
      "label": "Project source file, gpt-3-encoder",
      "display": "scripts/scrape.ts",
      "asOf": "2026-11-20"
    },
    "F236": {
      "label": "Project full_name, gpt-3-encoder",
      "display": "mckaywrigley/paul-graham-gpt",
      "asOf": "2026-11-20"
    },
    "F237": {
      "label": "Project stargazers_count, gpt-3-encoder",
      "display": "2.7K",
      "asOf": "2026-11-20"
    }
  },
  "dataCheckedAt": "2026-11-20",
  "agent": {
    "exaCall": {
      "endpoint": "/search",
      "body": {
        "query": "Best JavaScript tokenizer libraries tiktoken gpt-tokenizer GPT-3-Encoder Transformers.js code examples",
        "numResults": 5
      },
      "docsUrl": "https://exa.ai/docs/reference/search"
    },
    "calls": []
  }
}
