AI Tokenizer — AI skill for Claude Code
A faster than tiktoken tokenizer with first-class support for Vercel's AI SDK.
How to install AI Tokenizer
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open coder/ai-tokenizer and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What AI Tokenizer does
A faster than tiktoken tokenizer with first-class support for Vercel's AI SDK.
Alternatives in AI
- Cumora — Where agent teams gather 3.2k ★
- Anthropic SDK TypeScript — Access to Anthropic's safety-first language model APIs in TypeScript 2.1k ★
- Observal — Observal is an AI agent registry with first in class observabilty and eval framework 679 ★
README
ai-tokenizer
[](https://github.com/coder/ai-tokenizer/actions/workflows/ci.yml) [](https://www.npmjs.com/package/ai-tokenizer) [](https://www.npmjs.com/package/ai-tokenizer)
A faster than tiktoken tokenizer with first-class support for Vercel's AI SDK.
- Supports the AI SDK tool and message schema
- No WASM; highly portable; 5-7x faster than tiktoken WASM
- >=97% accuracy for top models (GPT-5, Claude Sonnet, Gemini):
| Model | ~500 tokens | ~5k tokens | ~50k tokens |
|---|---|---|---|
| openai/gpt-5 | 99.16% | 99.43% | 99.47% |
| anthropic/claude-opus-4.5 | 98.48% | 98.56% | 99.79% |
| google/gemini-3-pro-preview | 98.70% | 98.77% | 98.91% |
[Try it on the website:](https://coder.github.io/ai-tokenizer/)
[](https://coder.github.io/ai-tokenizer/)
Usage
Install:
bun install ai-tokenizer
Estimate tokens with the AI SDK:
import Tokenizer, { models } from "ai-tokenizer";
import { count } from "ai-tokenizer/sdk";
import * as encoding from "ai-tokenizer/encoding";
// Find the respective model.
const model = models["openai/gpt-5"];
const tokenizer = new Tokenizer(encoding[model.encoding]);
const result = count({
tokenizer,
model,
// Every message is counted separately
messages,
// Tool descriptions and input schemas are counted
tools,
})
// {
// total: 150,
// messages: [
// {
// total: 120,
// content: [
// { type: "text", total: 100 },
// { type: "tool-call", total: 20, input: 15 }
// ]
// }
// ],
// tools: {
// total: 30,
// definitions: {
Related Skills
Agent Hotline
Give any AI agent a real phone number, in both directions — inbound voice approval, outbound pre-authorized no
AI SDK Provider Claude Code
GitHub Repo stars Vercel AI SDK community provider for Claude Code SDK Vercel AI SDK integration
AI SDK Computer Use
Computer-using agent built with Next.js and the AI SDK by Vercel.
General Purpose Agent Quickstart
Build Your Own OpenClaw from Scratch with Composio, Vercel AI SDK, Telegram, and Supermemory
Community Agent Template
Open source AI-powered Slack community management bot with a built-in Next.js admin panel. Uses Chat SDK, AI S
Express Issue Triage Agent Template
An Express and AI SDK agent that triages new GitHub issues on Vercel, applying labels and a maintainer reply.
Related Agents
AI Architect
Specializes in architecting AI-powered applications on Vercel — choosing between AI SDK patterns, configuring
AI SDK Expert
Expert in Vercel AI SDK v5 handling streaming, model integration, tool calling, hooks, state management, edge
Vercel AI SDK Expert
Use for Vercel AI SDK v5 implementation work: chat interfaces, tool calling, streaming, agentic loop control,