Skip to content

shirishpothi/tokencounter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Token Counter

Need to count your tokens for cost-estimations? No problem, we've got you covered.

Token Counter is a simple web app that lets you instantly count the number of tokens used by a text input, powered by Google Gemini models. It’s useful for developers and teams estimating prompt sizes or API costs when working with LLMs.


Features

  • Paste or type any text to get the token count.
  • Powered by Gemini API models for accurate tokenization.
  • Minimal, responsive interface.
  • Dark/light theme toggle.

How to Run Locally

Prerequisites:

  • Node.js (latest LTS recommended)
  • A Google Gemini API key

Steps

  1. Install dependencies:

    npm install
  2. Set up API key:
    Create a file named .env.local in the root directory and add your Gemini API key:

    GEMINI_API_KEY=your-gemini-api-key-here
    
  3. Start the app:

    npm run dev
  4. Open in your browser:
    Visit http://localhost:5173 (or as shown in your terminal).


Usage

  • Enter your text in the textarea and click “Count Tokens”.
  • The app will show the token count below.
  • If your API key is missing or invalid, you’ll see an error message and the button will be disabled.

License

This project is licensed under the Apache License 2.0.

Warning

It is illegal to exploit any vulnerabilities in this program. Use this software at your own risk. The authors and contributors are not responsible for any damages or legal consequences resulting from misuse or exploitation of this program.


Star History Chart

About

Need to count your tokens for cost-estimations? No problem, we've got you covered.

Resources

License

Stars

Watchers

Forks

Contributors