惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
Stack Overflow Blog
Stack Overflow Blog
D
DataBreaches.Net
罗磊的独立博客
博客园 - 司徒正美
Last Week in AI
Last Week in AI
The Cloudflare Blog
大猫的无限游戏
大猫的无限游戏
Microsoft Azure Blog
Microsoft Azure Blog
B
Blog RSS Feed
The GitHub Blog
The GitHub Blog
宝玉的分享
宝玉的分享
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
小众软件
小众软件
Jina AI
Jina AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hugging Face - Blog
Hugging Face - Blog
B
Blog
博客园 - 【当耐特】
V
V2EX
Apple Machine Learning Research
Apple Machine Learning Research
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
酷 壳 – CoolShell
酷 壳 – CoolShell

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
I Built an AI Token Calculator Because Long Prompts Need ...
Zley · 2026-05-07 · via DEV Community

Zley

I keep running into the same small problem when working with LLMs: a prompt looks fine in a text editor, but I still need to know whether it is going to fit inside the model context window before I send it.

That is why I added a new tool to Tools Online: AI Token Calculator.

It is a browser-based token and context estimator for common AI models. You can paste a prompt, code snippet, document section, or chat draft, pick the provider/model you care about, and see the token count plus context usage immediately.

What it supports

The first version focuses on the models I most often need to plan for:

  • OpenAI / GPT models
  • Claude
  • Gemini
  • Qwen
  • GLM
  • Kimi

For OpenAI models, the tool uses compatible local BPE tokenizers. For the other providers, it shows the result as a local estimate because their exact billing tokenizers are either proprietary or exposed through authenticated APIs.

That distinction is intentional. I did not want the UI to pretend every number has the same precision. If the result is exact, it is marked as exact. If it is an estimate for planning, it is marked as an estimate.

No API key, no upload

The part I cared about most was privacy. Prompt drafts often contain product ideas, customer text, logs, or internal notes. I did not want a token calculator that sends that text to another server just to produce a rough number.

So the calculator runs in the browser and does not require an API key. You paste text, choose the model, and get a quick read on whether the prompt is small, close to the limit, or already too large.

Where AI helped during development

AI was useful in the boring but important parts of the build. I used it to map out edge cases, compare how different providers expose token counting, shape the first version of the copy, and check whether the UI explained exact counting versus estimation clearly enough.

The final product still needed manual decisions: keep the tool simple, avoid implying exact billing numbers for proprietary tokenizers, support multiple languages, and make the context window usage obvious at a glance.

When I use it

This has already been useful before sending long prompts to production models, trimming documents for chat, checking code snippets, and estimating whether a multi-message prompt should be split.

If you work with GPT, Claude, Gemini, Qwen, GLM, or Kimi and want a quick local check before sending a prompt, you can try the AI Token Calculator here.