# tiktoken-node

> tiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding) tokeniser for use with OpenAI's models.

Latest version **0.0.7** (published 2024-02-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install tiktoken-node
pnpm add tiktoken-node
yarn add tiktoken-node
bun add tiktoken-node
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; large bundle; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2024-02-05 |
| First published | 2023-03-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 14 |
| Dependencies | 0 |
| Unpacked size | 31.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 109 |
| Maintainers | ceifa |

## Links

- npm: https://www.npmjs.com/package/tiktoken-node
- Repository: https://github.com/ceifa/tiktoken-node
- Homepage: https://github.com/ceifa/tiktoken-node#readme
- Issues: https://github.com/ceifa/tiktoken-node/issues
- npm.io page: https://npm.io/package/tiktoken-node

## Recent versions

- 0.0.7 (latest) — 2024-02-05
- 0.0.6 — 2023-04-13
- 0.0.5 — 2023-03-21
- 0.0.4 — 2023-03-17
- 0.0.3 — 2023-03-17
- 0.0.2 — 2023-03-16
- 0.0.1 — 2023-03-16

## README

# ⏳ tiktoken-node

tiktoken is a fast [BPE](https://en.wikipedia.org/wiki/Byte_pair_encoding) tokeniser for use with
OpenAI's models.

```js
const tiktoken = require('tiktoken-node')
let enc = tiktoken.getEncoding("gpt2")
console.assert(enc.decode(enc.encode("hello world")) == "hello world")

// To get the tokeniser corresponding to a specific model in the OpenAI API:
enc = tiktoken.encodingForModel("text-davinci-003")
```

The open source version of `tiktoken-node` can be installed from npm:
```
npm install tiktoken-node
```

---
_Source: https://npm.io/package/tiktoken-node · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
