Skip to content

pHouse-Productions/GPT-3-Token-Counter

 
 

Repository files navigation

GPT-3 Token Count

A TypeScript package for counting the number of tokens in a given text using the GPT-3 language model.

It's not perfect but it's a pretty close estimate.

Installation

You can install the gpt-3-token-count package via npm:

npm install gpt-3-token-count

Usage

import { count } from "gpt-3-token-count";

const text = "This is a sample text.";
const tokenCount = count(text);

console.log(`Token count: ${tokenCount}`);

The count function accepts a string as input and returns the number of tokens present in the text.

About

Token counter for GPT3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%