UTILIX

LLM Token Counter & Context Packer

Utilix LLM Token Counter & Packer is a client-side BPE tokenization calculator and multi-file prompt formatter that estimates token usage and API costs across Google Gemini, OpenAI GPT-4o, and Anthropic Claude models.

How to Calculate LLM Prompt Tokens and API Costs for Gemini, GPT, and Claude?

Paste your prompt or drop multiple source code files into Utilix LLM Token Counter to view real-time sub-word token counts, context window saturation bars, and exact per-request USD pricing across Gemini, GPT-4o, and Claude Sonnet.

How to use LLM Token Counter & Context Packer

  1. Paste Prompt or Drop Code Files: Enter text or drop multiple code files to pack into a unified repository prompt.
  2. Compare Multi-Model Token Counts & Costs: Inspect live token estimates and input/output USD cost across Gemini, GPT, and Claude.
  3. Copy Packed XML or Markdown Context: Export your formatted <repository_context> XML or Markdown prompt block in 1 click.

Frequently asked questions

Why do Gemini, GPT-4o, and Claude report slightly different token counts for the same text?

Each model family uses a different vocabulary size (e.g., SentencePiece 256k vs OpenAI o200k_base vs cl100k_base), causing code symbols and whitespace to split differently.

What is the XML Context Packer feature?

Inspired by Repomix, it wraps multiple files in clean <repository_context> and <file path="..."> XML tags with an ASCII directory tree, which LLMs parse with higher accuracy.

Can I strip code comments to save tokens before sending to an LLM?

Yes, toggle "Strip Comments & Empty Lines" to reduce prompt token count by 15%–30%.

Is my proprietary source code sent to an AI server when counting tokens?

No. Token counting and XML packing run 100% locally in your browser.

Does this page also include optional live Gemini Search Grounding & High-Thinking testing?

Yes, you can optionally invoke our server-side Gemini Search Grounding or High-Thinking reasoning sandbox right from the AI panel.

Related tools

UTILIX home