Definition · AI basics
Token
A token is the unit of text a language model reads and writes. A tokenizer splits text into tokens drawn from a fixed vocabulary, and a token can be a whole word, part of a word, a single character or a byte. Context windows are sized in tokens, not words, and APIs such as Anthropic's charge per token.
Last reviewed
Key points
- A token is what a language model actually reads and writes. A tokenizer splits text into tokens before the model sees it.
- Tokens are often pieces of words. Common words become one token; rare words are built from several smaller ones, which is how a model handles words it never saw whole.
- Context windows are sized in tokens, and APIs such as Anthropic's bill by them. The same text can need very different counts depending on the tokenizer and the language.
- Tokenization can be attacked. HiddenLayer's 2025 TokenBreak altered words so that prompt-injection classifiers using two common tokenizer types missed attacks the target model still understood.
How it works
Before a language model sees any text, a tokenizer splits it into tokens from a fixed vocabulary. The model works on those tokens, not on the raw text.
Many tokenizers split rare words into pieces. Byte pair encoding (BPE), adapted for subword splitting by Sennrich and colleagues in 2015, starts from single characters and repeatedly merges the most frequent adjacent pair. Common words end up as one token; a rare word becomes several. Anthropic’s glossary states the trade-off: larger tokens are efficient, smaller ones let a model handle words it has never seen.
A context window is sized in tokens. Some APIs also price by them: Anthropic charges per million input tokens and per million output tokens.
Why it matters
Token counts decide what a request costs and whether it fits. MITRE ATLAS advises generative AI services to limit context and output tokens, one of its defences against cost harvesting. Counts also vary more than people expect. A 2023 Oxford study found the tokenizer used by ChatGPT and GPT-4 needed up to 15 times as many tokens for the same text in Shan as in English, and 3 times in Arabic. Anthropic says Claude 4.7 and later models produce about 30% more tokens than earlier ones for the same text, with the exact increase depending on the content.
The tokenizer is also an attack surface. In 2025 HiddenLayer’s TokenBreak changed words slightly, so that AI guardrails classifiers using BPE or WordPiece, a similar method, missed a prompt injection the target model still understood. Classifiers using a different method, Unigram, were not fooled in those tests. Separately, tokens that a model barely saw in training, called glitch tokens, can make it behave unpredictably; a 2024 Cohere study found them in every model it tested.
Questions and answers
How long is a token?
It depends on the tokenizer and the language. Anthropic's glossary puts a Claude token at about 3.5 English characters, varying by language. Other languages can need more tokens for the same text: a 2023 Oxford study found the tokenizer used by ChatGPT and GPT-4 needed about 1.6 times as many for Italian as for English, 3 times for Arabic and up to 15 times for Shan.
How do tokens affect what an AI API costs?
Commercial AI services charge per token or per character, a 2023 Oxford study notes. Anthropic, for example, prices each model per million input tokens and per million output tokens. A tokenizer change alters the count for the same text: Anthropic says Claude 4.7 and later models produce about 30% more tokens than earlier ones, depending on the content.
What is a glitch token?
A glitch token is a token in a tokenizer's vocabulary that the model barely saw in training, such as _SolidGoldMagikarp. Prompts containing one can make the model behave oddly. A 2024 Cohere study found such tokens in every model it tested.
Sources
- Glossary (Claude Platform Docs)Anthropic
- Neural Machine Translation of Rare Words with Subword UnitsRico Sennrich, Barry Haddow and Alexandra Birch, University of Edinburgh, 31 Aug 2015
- Pricing (Claude Platform Docs)Anthropic
- Token counting (Claude Platform Docs)Anthropic
- Language Model Tokenizers Introduce Unfairness Between LanguagesAleksandar Petrov, Emanuele La Malfa, Philip H.S. Torr and Adel Bibi, University of Oxford (NeurIPS 2023), 17 May 2023
- TokenBreak: Bypassing Text Classification Models Through Token ManipulationKasimir Schulz, Kenneth Yeung and Kieran Evans, HiddenLayer, 9 Jun 2025
- Fishing for Magikarp: Automatically Detecting Under-trained Tokens in Large Language ModelsSander Land and Max Bartolo, Cohere, 8 May 2024
- MITRE ATLAS, mitigation AML.M0036 (collection 2026.09)MITRE
Guides that use this term
Related topics
In the news
- Z.ai releases GLM-5.4, a model that uses 28 layers again
- Ant Group releases 2 open medical AI models for its Afu app
- AMD buys AI chip startup Taalas for about $2.9 billion
- Capgemini: 60% of large firms went above their AI budgets
- Sarvam releases an open 105B model at $0.15 for each million tokens
- Claude Code saves secrets from 63 organizations in public files
- Google releases Gemini 4 Neon at $3 for each million input tokens
- Nvidia team tells that large context windows are frequently overkill
- Anthropic releases Claude Fable 5.2 at a 20 percent lower price
- Nvidia is in talks to buy Inception for more than $500 million
- NariQ cuts a model to 2.5 bits and keeps its agent results
- A bad MCP helper on npm can start a data stealer on Windows
- Nvidia data centre sales increased 110 percent to $107.6 billion
- Google ships Gemini 4 Neon at $3 for 1 million input tokens
- Google puts AI model, token and tool rules into Envoy
- Workday buys Honeydew to give AI agents one meaning for each metric
- A Google price catalog shows Gemini 4 Neon at $3 for 1 million tokens
- The sampler controls if long AI output holds at high temperature
- OpenAI launches GPT-6.2 Astra at a 20% lower API price
- Microsoft releases 7 MAI models, with voice from $0.01 a minute
- Google Cloud says Gartner named it a Leader for AI platforms
- OVHcloud releases Olala mini, an open model made only in Europe
- A paper shows a reply time of 150 milliseconds for Jev
- Hugging Face sends AI model requests to OpenRouter
- Tencent puts Hy4 Flash on AI Gateway with 50% discount
- Alibaba puts its Qwen4-Max model on AI Gateway for coding agents
- OpenAI launches ChatGPT Wallet and AI agents pay with no card number
- CoReMem decreases the steps of a coding agent by 17%
- Phonedriver lets AI agents use phones with 6.9 times less token use
- Gemini 4 Hydrogen is open to five GitHub Copilot plans
- Google adds records of ai agent work to BigQuery and Looker
- OpenAI adds ChatGPT Wallet for its dots agents to buy for users
- Google Antigravity gives coding work to 2 Gemini 4 models in turn
- Edits to fewer than ten neurons can make an AI agent a sleeper
- Claude Fable 5.2 moves above Gemini 4 Carbon on a top AI index
- Edge0 releases an open 145B model that operates on a laptop
- Mastercard and partners book and pay for a live flight by AI agent
- Google launches Gemini 4 Hydrogen, a fast and low-cost coding model
- Microsoft releases MAI models to lower AI cost
- Amazon adds 3 open DeepSeek V4 models to SageMaker JumpStart
- Trust3 AI releases an AI agent kill switch with a trust score
- Phase names the former Cointelegraph chief CEO of its AI agent chain
- An MCP server used 42 times the tokens of a CLI on one task
- Google makes Gemini 4 Carbon open to all paying developers
- Hugging Face policy chief tells that attacks can close open AI
- boost.ai says its new Presis model has 2.5 times the speed
- A small scout model decreases routing cost by 9 to 33%
- Claude Fable 5.2 gave no image at max reasoning in a test
- Amazon SageMaker adds NVIDIA Nemotron 3.5 Super VL model
- Google MaxText adds training on inputs of 14 million tokens
- Anthropic releases Claude Fable 5.2 and Mythos 5.2 models
- Meta Muse Ember model costs 10 cents for a million input tokens
- Llama-modchip claims a 64GB PC can operate a 284B DeepSeek model
- Microsoft tells that its new Copilot harness adds 10.8 to 22.1 points
- Nous Research cuts Chinese bias in a Qwen model to 0.9 percent
- Bedrock adds Moonshot AI model Kimi K3.1 Pro and a fast variant
- AI agents gave a secret key to a swarm in 15% of tests
- Salesforce adds a model that gives an answer in 26 milliseconds
- Chinese models get 89% of US open-source model spending
- Open models are the best buy at only 3% of budgets, down from 41%
- Thinking Machines launches Inkling 2 Small with closed weights
- Baidu releases a 280 billion parameter base model for more training
- A coding model with 138 billion parameters operates on one Windows PC
- Ripple-65B tops US open models on agentic coding at a $32M cost
- Anthropic releases FlashProve to show which AI model gave an answer
- Linux makes 14 tokens a second on a 120B model on Nvidia RTX Spark
- Microsoft tells PC sellers to count PCs as AI spend
- OpenRouter shows a free model that reads 1M tokens at one time
- Anthropic Message Threads cut first token wait by 35 percent
- Mastercard and OpenAI sign an agreement that is more than Agent Pay
- A small test model caught a Transformers bug that stayed 2 months
- AWS adds Claude Haiku 5.5 to Kiro in its US government cloud
- Tencent tells of 90 billion tasks done by its WorkBuddy agent
- Byoky wallet keeps AI API keys out of web app settings pages
- A small text model aligns more with image AI than a 72B model
- OpenAI limits paid ChatGPT accounts for each card and device
- ChatGPT plans share one token budget from December
- BCA Research says agentic AI is forward of its results
- Ling 3.1 Flash 1019 is free on AI Gateway until 3 November
- Four AI firms back one token that stops AI crawlers
- Endor Labs puts security checks in Google Antigravity agents
- A China-linked group used AI agents on more than 200 organizations
- Mistral releases Large 4 open weights under a modified MIT license
- Google opens Android Studio to more than 40 external AI agents
- Google shows Gemini 4 Carbon and gives it first to cyber defenders
- Pillar finds an Unsloth vulnerability that runs attacker code
- AWS repairs a token bug in its MCP server
- Ant Group publishes Ling-3.1-flash-1019, a 574 GB open model
- Cadence and Nvidia release Maestro AI models for chip design
- Moonshot AI removes attack data from Kimi K3.1 Pro
- BabelArena tests AI agents on the same tasks in 23 languages
- Cassava adds Nvidia Nemotron open models to its AI system
- TokenGate cuts the first answer wait by 1.4 to 11.3 times
- Hugging Face chief says most companies will make AI models in 24 months
- Dell says 80% of AI tokens come from open models
- Declarative pipelines cut cluster time 34 times in an agent test
- Reflection releases Beam, an open model with 501 billion parameters
- MiniMax puts M3.1 Flash weights online with a $20 million limit
- AWS lets teams write their own model training loop in SageMaker
- Pichai reports that Gemini 4 Argon used 25 trillion tokens in 72 hours
- NVIDIA releases open Nemotron 3.5 models for agent document search
- Google releases vLLM and SGLang engines for its TPU chips
- A team of AI agents had a lower score than one agent in 12 of 13 tests
- Cohere makes Rerank 5 models that cut the text an LLM must read
- Evervault launches tokens that keep card data from AI agents
- Databricks tells that memory makes AI agents do 3 times more tasks
- Inception releases Mercury 3, a model with 1,068 tokens a second
- The best AI agent setup plans 78% of tasks offline and 40% online
- Forter launches tools to control AI agents on merchant sites
- Researchers decrease the cost of a check on AI answers
- Reflection releases Beam, an open model, free on Ollama for a time
- Open-weight models process 7 in 10 tokens on the Vercel AI Gateway
- OpenAI publishes a list of over 12 incidents by its AI models
- An OpenAI model used tokens from the wallet of a different person
- The Aoki malware gets credentials of AI tools for code
- Mistral releases Large 4 with 1.05 trillion parameters
- DP-MIND keeps data safe in AI queries of 1,000,000 tokens
- Anthropic operated a 26 billion parameter model on 15 TV boxes
- Claude can operate a maximum of 1,000 agents at the same time