---
title: "gpt-tokenizer 4.0.2 Breaking Changes on npm | Since.dev"
description: "What each gpt-tokenizer release removed, renamed or changed: 17 breaking changes in 3 versions on npm, each with its source."
canonical_url: https://since.dev/packages/npm/gpt-tokenizer
last_updated: 2026-12-04
---

# gpt-tokenizer breaking changes

gpt-tokenizer 4.0.2 (October 15, 2026) is its newest release with breaking changes. The first: Encoding and splitting of U+0085 and U+FEFF now match tiktoken in gpt-tokenizer 4.0.2. Every breaking API change we have recorded in gpt-tokenizer on npm: 17 breaking changes in 3 versions. Below, its 3 versions with breaking changes, newest first, removals and renames first, each with its source.

Updated December 4, 2026

Latest version `4.1.2`, released November 10, 2026. [Source repository](https://github.com/niieani/gpt-tokenizer)

Packages on npm run on Node.js. [Node.js end of life dates](https://since.dev/calendar/nodejs.md).

- From [3.0.0](#v-3-0-0) to [4.0.2](#v-4-0-2): 12 breaking changes in 2 versions.

## gpt-tokenizer 4.0.2 breaking changes

gpt-tokenizer 4.0.2, released October 15, 2026: 1 breaking change.

- **Behavior changed**  

Text containing U+0085 or U+FEFF is now split and encoded the same way tiktoken does, so token output for those characters may differ from earlier versions. [github.com](https://github.com/niieani/gpt-tokenizer/releases/tag/4.0.2)

## gpt-tokenizer 4.0.0 breaking changes

gpt-tokenizer 4.0.0, released August 16, 2026: 11 breaking changes.

- **Removed**  

Browser users loading the package from unpkg as a global script or UMD bundle must switch to ES module imports. [github.com](https://github.com/niieani/gpt-tokenizer/releases/tag/4.0.0)
- **Behavior changed**  

Browser code that relied on the old non-module builds must now load the package as an ES module. [github.com](https://github.com/niieani/gpt-tokenizer/commit/158658082a35a7b73163c0dd60a4e1b170c04740)
- **Signature changed** `cjs:encodeChat`  

Was const encodeChat: (chat: readonly import("../functionCalling.js").ChatMessage\[\], model?: "chatgpt-4o-latest" | "codex-mini-latest" | "computer-use-preview" | "computer-use-preview-2025-03-11" | "gpt-3.5" | "gpt-3.5-0301" |... [npmjs.com](https://www.npmjs.com/package/gpt-tokenizer/v/4.0.0)
- **Signature changed** `cjs:encodeChatGenerator`  

Was const encodeChatGenerator: (chat: Iterable\<import("../functionCalling.js").ChatMessage>, model?: "chatgpt-4o-latest" | "codex-mini-latest" | "computer-use-preview" | "computer-use-preview-2025-03-11" | "gpt-3.5" | "gpt-3.5-0301" |... [npmjs.com](https://www.npmjs.com/package/gpt-tokenizer/v/4.0.0)
- **Signature changed** `countTokens`  

Was const countTokens: (input: string | Iterable\<import("../functionCalling.js").ChatMessage>, encodeOptions?: import("../GptEncoding.js").EncodeOptions) => number; now const countTokens: (input: string | Iterable\<ChatMessage>... [npmjs.com](https://www.npmjs.com/package/gpt-tokenizer/v/4.0.0)
- **Signature changed** `encode`  

Was const encode: (lineToEncode: string, encodeOptions?: import("../GptEncoding.js").EncodeOptions) => number\[\]; now const encode: (lineToEncode: string, encodeOptions?: EncodeOptions) => number\[\]. [npmjs.com](https://www.npmjs.com/package/gpt-tokenizer/v/4.0.0)
- **Signature changed** `encodeChat`  

Was const encodeChat: (chat: readonly import("../functionCalling.js").ChatMessage\[\], model?: "chatgpt-4o-latest" | "codex-mini-latest" | "computer-use-preview" | "computer-use-preview-2025-03-11" | "gpt-3.5" | "gpt-3.5-0301" |... [npmjs.com](https://www.npmjs.com/package/gpt-tokenizer/v/4.0.0)
- **Signature changed** `encodeChatGenerator`  

Was const encodeChatGenerator: (chat: Iterable\<import("../functionCalling.js").ChatMessage>, model?: "chatgpt-4o-latest" | "codex-mini-latest" | "computer-use-preview" | "computer-use-preview-2025-03-11" | "gpt-3.5" | "gpt-3.5-0301" |... [npmjs.com](https://www.npmjs.com/package/gpt-tokenizer/v/4.0.0)
- **Signature changed** `encodeGenerator`  

Was const encodeGenerator: (lineToEncode: string, encodeOptions?: import("../GptEncoding.js").EncodeOptions) => Generator\<number\[\], number, undefined>; now const encodeGenerator: (lineToEncode: string, encodeOptions?: EncodeOptions) =>... [npmjs.com](https://www.npmjs.com/package/gpt-tokenizer/v/4.0.0)
- **Signature changed** `estimateCost`  

Was const estimateCost: (tokenCount: number, modelSpec?: import("../modelTypes.js").ModelSpec | undefined) => import("../modelTypes.js").PriceData; now const estimateCost: (tokenCount: number, modelSpec?: ModelSpec | undefined) =>... [npmjs.com](https://www.npmjs.com/package/gpt-tokenizer/v/4.0.0)

And 1 more in this version. [Sign up to see every change](https://app.since.dev/login?mode=signup&src=package-page)

## gpt-tokenizer 3.0.0 breaking changes

gpt-tokenizer 3.0.0, released June 7, 2025: 5 breaking changes.

- **Default changed**  

The default encoding is now o200k_base, which most modern models use. Code relying on the previous default must now pass the encoding explicitly to keep its old token counts. [github.com](https://github.com/niieani/gpt-tokenizer/commit/1d1d76d86bd22d89b89ebba09f5f7b4eed04c4eb)
- **Default changed**  

The default encoding is now o200k_base, which most modern models use. Code relying on the previous default must now pass the encoding explicitly to keep its old token counts. [github.com](https://github.com/niieani/gpt-tokenizer/releases/tag/3.0.0)
- **Signature changed** `encodeChat`  

Was const encodeChat: (chat: readonly import("../GptEncoding.js").ChatMessage\[\], model?: "gpt-4o" | "gpt-3.5-turbo" | "gpt-3.5-turbo-instruct" | "babbage-002" | "davinci-002" | "text-embedding-3-small" | "o1" | "o1-2024-12-17" |... [npmjs.com](https://www.npmjs.com/package/gpt-tokenizer/v/3.0.0)
- **Signature changed** `encodeChatGenerator`  

Was const encodeChatGenerator: (chat: Iterable\<import("../GptEncoding.js").ChatMessage>, model?: "gpt-4o" | "gpt-3.5-turbo" | "gpt-3.5-turbo-instruct" | "babbage-002" | "davinci-002" | "text-embedding-3-small" | "o1" | "o1-2024-12-17" |... [npmjs.com](https://www.npmjs.com/package/gpt-tokenizer/v/3.0.0)
- **Signature changed** `estimateCost`  

Was const estimateCost: (tokenCount: number, modelName?: "gpt-4o" | "gpt-3.5-turbo" | "gpt-3.5-turbo-instruct" | "babbage-002" | "davinci-002" | "text-embedding-3-small" | "o1" | "o1-2024-12-17" | "o1-preview" | "o1-preview-2024-09-12" |... [npmjs.com](https://www.npmjs.com/package/gpt-tokenizer/v/3.0.0)

## Check your code

These are the changes. To see which of them reach your code, [scan a public repository](https://since.dev/scan.md), or have your coding agent call `check_code` with your manifest or lockfile over [MCP](https://since.dev/docs.md#mcp). [The API](https://since.dev/docs.md#api) reads every change in every version. A fix pull request opens for the changes that reach a connected repository. Nothing merges or deploys.

## Put your code on continuous maintenance.

Scan a public repository now, or give your agent one line.

[Scan a repository](https://since.dev/scan.md). Any public GitHub repository. No sign-in.

### Tell your agent what changed since it was trained.

`claude mcp add --transport http since https://api.since.dev/mcp`

[Get an API key](https://app.since.dev/login?mode=signup)

Codex, Cursor and any MCP client use https://api.since.dev/mcp.

---

Every page on this site as Markdown: https://since.dev/sitemap.md. For agents: https://since.dev/llms.txt.
