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.
- 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.
Prerequisites:
- Node.js (latest LTS recommended)
- A Google Gemini API key
-
Install dependencies:
npm install
-
Set up API key:
Create a file named.env.localin the root directory and add your Gemini API key:GEMINI_API_KEY=your-gemini-api-key-here -
Start the app:
npm run dev
-
Open in your browser:
Visit http://localhost:5173 (or as shown in your terminal).
- 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.
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.