Skip to content

ricodane/ai-token-counter

Repository files navigation

AI Token Counter & Cost Calculator by SpacePrompts

A browser extension by SpacePrompts that counts tokens and estimates costs for your AI prompts right from your browser.

Install

Chrome Web Store Microsoft Edge Firefox Add-ons

Features

  • Count tokens for GPT-5.4, Claude Sonnet 4.6, Gemini 3.1 Pro Preview, DeepSeek V3.2, Qwen 3.5, and Llama 4 Maverick
  • Estimated input cost per model
  • Character count
  • Real-time results as you type

Preview

Supported Models

Model Provider Input Price
GPT-5.4 OpenAI $2.50 / 1M tokens
Claude Sonnet 4.6 Anthropic $3.00 / 1M tokens
Gemini 3.1 Pro Preview Google $2.00 / 1M tokens (≤200K), $4.00 / 1M tokens (>200K)
DeepSeek V3.2 DeepSeek $0.28 / 1M tokens
Qwen 3.5 Alibaba $0.40 / 1M tokens
Llama 4 Maverick Meta $0.19 / 1M tokens

Development

Prerequisites

  • Node.js
  • pnpm

Setup

pnpm install

Copy the example env file and fill in your values:

cp .env.example .env.local

Run in dev mode

pnpm dev

Build

pnpm build

Environment Variables

Variable Description
WXT_MANIFEST_KEY Chrome extension manifest key (optional, for dev)
WXT_API_URL Tokenizer API endpoint
WXT_EXTENSION_KEY API key sent via X-Extension-Key header

API Rate Limit

The tokenizer API is rate limited to 60 requests per minute per IP address. Requests exceeding this limit will receive a 429 Too Many Requests response.

Acknowledgements

Token counting is powered by the following open source libraries:

Issues

Found a bug or have a suggestion? Open an issue.

License

MIT

About

Count tokens and estimate AI costs for any model. Supports ChatGPT, Claude, Gemini, and DeepSeek

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors