Supported Models

April 16, 2026 ยท View on GitHub

This document lists all models supported by token-count.nvim, organized by company and accuracy method.

Token Counting Accuracy Legend

Supported Models

This document lists all models supported by token-count.nvim and how accurately we can count their tokens.

Accuracy Types

  • โœ… Exact Local Counting - Uses official tokenizers, works offline, 100% accurate
  • ๐ŸŒ Exact API Counting - Uses official APIs, requires internet + API keys, 100% accurate
  • ๐Ÿ“Š Smart Estimates - Uses tokencost library, ~95% accurate estimates

Note: Large files (>512KB) shown in file explorers get estimates marked with * for performance.


OpenAI

๐ŸŽฏ Official Tokenizer (tiktoken - local, no API required)

All OpenAI models use tiktoken directly for exact token counts with no API calls required.

ModelNice NameContext WindowMax OutputEncoding
gpt-4GPT-48,1924,096cl100k_base
gpt-4-32kGPT-4 32K32,7684,096cl100k_base
gpt-4-turboGPT-4 Turbo128,0004,096cl100k_base
gpt-3.5-turboGPT-3.5 Turbo16,3854,096cl100k_base
gpt-4oGPT-4o128,00016,384o200k_base
gpt-4o-miniGPT-4o Mini128,00016,384o200k_base
chatgpt-4o-latestChatGPT-4o Latest128,0004,096o200k_base
o1-previewOpenAI o1 Preview128,00032,768o200k_base
o1-miniOpenAI o1 Mini128,00065,536o200k_base
o3OpenAI o3200,000100,000o200k_base
o4-miniOpenAI o4 Mini200,000100,000o200k_base
gpt-4.1GPT-4.11,047,57632,768o200k_base
gpt-4.1-miniGPT-4.1 Mini1,047,57632,768o200k_base
gpt-4.1-nanoGPT-4.1 Nano1,047,57632,768o200k_base
gpt-5GPT-5400,000128,000o200k_base
gpt-5-miniGPT-5 Mini400,000128,000o200k_base
gpt-5-nanoGPT-5 Nano400,000128,000o200k_base

OpenAI

โœ… Exact Local Counting (tiktoken)

All OpenAI models use tiktoken directly for exact token counts with no API calls required.

ModelNice NameContext WindowMax Output
gpt-4GPT-48,1924,096
gpt-4-32kGPT-4 32K32,7684,096
gpt-4-turboGPT-4 Turbo128,0004,096
gpt-3.5-turboGPT-3.5 Turbo16,3854,096
gpt-4oGPT-4o128,00016,384
gpt-4o-miniGPT-4o Mini128,00016,384
chatgpt-4o-latestChatGPT-4o Latest128,0004,096
o1-previewOpenAI o1 Preview128,00032,768
o1-miniOpenAI o1 Mini128,00065,536
o3OpenAI o3200,000100,000
o4-miniOpenAI o4 Mini200,000100,000
gpt-4.1GPT-4.11,047,57632,768
gpt-4.1-miniGPT-4.1 Mini1,047,57632,768
gpt-4.1-nanoGPT-4.1 Nano1,047,57632,768
gpt-5GPT-5400,000128,000
gpt-5-miniGPT-5 Mini400,000128,000
gpt-5-nanoGPT-5 Nano400,000128,000

DeepSeek

๐Ÿ› ๏ธ Dedicated Tokenizer (deepseek_tokenizer - local, exact counts)

DeepSeek models that use the official DeepSeek tokenizer for accurate counts.

ModelNice NameContext WindowMax OutputMethod
deepseek-chatDeepSeek Chat128,0004,096deepseek_tokenizer
deepseek-coderDeepSeek Coder128,0004,096deepseek_tokenizer

๐Ÿ“Š Approximation (tokencost estimates)

DeepSeek models using tokencost for estimation.

ModelNice NameContext WindowMax OutputMethod
deepseek-r1DeepSeek R165,5368,192tokencost
deepseek-v3DeepSeek V365,5368,192tokencost

DeepSeek

โœ… Exact Local Counting (official tokenizer)

ModelNice NameContext WindowMax Output
deepseek-chatDeepSeek Chat128,0004,096
deepseek-coderDeepSeek Coder128,0004,096

๐Ÿ“Š Smart Estimates (tokencost)

ModelNice NameContext WindowMax Output
deepseek-r1DeepSeek R165,5368,192
deepseek-v3DeepSeek V365,5368,192

Anthropic

๐Ÿ”‘ Official API (requires ANTHROPIC_API_KEY + enable_official_anthropic_counter)

When configured with API access, these models use Anthropic's official token counting API.

๐Ÿ“Š Approximation (tokencost estimates - default)

By default, all Anthropic models use tokencost for estimation.

ModelNice NameContext WindowMax OutputMethod
claude-3-haikuClaude 3 Haiku200,0004,096tokencost/official API
claude-3-sonnetClaude 3 Sonnet200,0004,096tokencost/official API
claude-3-opusClaude 3 Opus200,0004,096tokencost/official API
claude-3.5-sonnetClaude 3.5 Sonnet200,0008,192tokencost/official API
claude-3.5-haikuClaude 3.5 Haiku200,0008,192tokencost/official API
claude-4-sonnetClaude 4 Sonnet200,000200,000tokencost/official API
claude-4-opusClaude 4 Opus200,00032,000tokencost/official API
claude-4.5-sonnetClaude 4.5 Sonnet200,000200,000tokencost/official API
claude-4.6-opusClaude 4.6 Opus1,000,00032,000tokencost/official API
claude-4.6-sonnetClaude 4.6 Sonnet1,000,0001,000,000tokencost/official API
claude-4.7-opusClaude 4.7 Opus1,000,00032,000tokencost/official API
claude-4.7-sonnetClaude 4.7 Sonnet1,000,0001,000,000tokencost/official API

Configuration for official API:

require("token-count").setup({
  enable_official_anthropic_counter = true,
  -- Requires ANTHROPIC_API_KEY environment variable
})

Anthropic

๐Ÿ“Š Smart Estimates (default)

All Anthropic models use tokencost for estimation by default.

ModelNice NameContext WindowMax Output
claude-3-haikuClaude 3 Haiku200,0004,096
claude-3-sonnetClaude 3 Sonnet200,0004,096
claude-3-opusClaude 3 Opus200,0004,096
claude-3.5-sonnetClaude 3.5 Sonnet200,0008,192
claude-3.5-haikuClaude 3.5 Haiku200,0008,192
claude-4-sonnetClaude 4 Sonnet1,000,0001,000,000
claude-4-opusClaude 4 Opus200,00032,000
claude-4.5-sonnetClaude 4.5 Sonnet200,000200,000
claude-4.6-opusClaude 4.6 Opus1,000,00032,000
claude-4.6-sonnetClaude 4.6 Sonnet1,000,0001,000,000
claude-4.7-opusClaude 4.7 Opus1,000,00032,000
claude-4.7-sonnetClaude 4.7 Sonnet1,000,0001,000,000

๐ŸŒ Exact API Counting (optional)

For exact counts, set ANTHROPIC_API_KEY and enable in config:

require("token-count").setup({
  enable_official_anthropic_counter = true,
})

Note: API counting requires internet access and uses your API quota. Local estimates are usually sufficient.


Google

๐Ÿ”‘ Official API (requires GOOGLE_API_KEY + enable_official_gemini_counter)

When configured with API access, these models use Google's official token counting API.

๐Ÿ“Š Approximation (tokencost estimates - default)

By default, all Google models use tokencost for estimation.

ModelNice NameContext WindowMax OutputMethod
gemini-2.0-flashGemini 2.0 Flash1,048,5768,192tokencost/official API
gemini-1.5-proGemini 1.5 Pro2,097,1528,192tokencost/official API
gemini-1.5-flashGemini 1.5 Flash1,048,5768,192tokencost/official API
gemini-proGemini Pro32,7608,192tokencost/official API

Configuration for official API:

require("token-count").setup({
  enable_official_gemini_counter = true,
  -- Requires GOOGLE_API_KEY environment variable
})

Google

๐Ÿ“Š Smart Estimates (default)

All Google models use tokencost for estimation by default.

ModelNice NameContext WindowMax Output
gemini-2.0-flashGemini 2.0 Flash1,048,5768,192
gemini-1.5-proGemini 1.5 Pro2,097,1528,192
gemini-1.5-flashGemini 1.5 Flash1,048,5768,192
gemini-proGemini Pro32,7608,192

๐ŸŒ Exact API Counting (optional)

For exact counts, set GOOGLE_API_KEY and enable in config:

require("token-count").setup({
  enable_official_gemini_counter = true,
})

Note: API counting requires internet access and uses your API quota. Local estimates are usually sufficient.


Meta

๐Ÿ“Š Approximation (tokencost estimates)

All Meta Llama models use tokencost for estimation.

ModelNice NameContext WindowMax OutputMethod
llama-3.1-405bLlama 3.1 405B128,0004,096tokencost
llama-3.1-70bLlama 3.1 70B128,0002,048tokencost
llama-3.1-8bLlama 3.1 8B128,0002,048tokencost
llama-3.3-70bLlama 3.3 70B128,0004,096tokencost

xAI

๐Ÿ“Š Approximation (tokencost estimates)

All xAI Grok models use tokencost for estimation.

ModelNice NameContext WindowMax OutputMethod
grok-betaGrok Beta131,072131,072tokencost
grok-4Grok 4256,000256,000tokencost

Mistral AI

๐Ÿ“Š Approximation (tokencost estimates)

All Mistral models use tokencost for estimation.

ModelNice NameContext WindowMax OutputMethod
mistral-largeMistral Large128,000128,000tokencost
mistral-smallMistral Small32,0008,191tokencost
codestralCodestral32,0008,191tokencost

Perplexity AI

๐Ÿ“Š Approximation (tokencost estimates)

All Perplexity models use tokencost for estimation.

ModelNice NameContext WindowMax OutputMethod
perplexity-sonar-smallPerplexity Sonar Small127,072127,072tokencost
perplexity-sonar-largePerplexity Sonar Large127,072127,072tokencost

Cohere

๐Ÿ“Š Approximation (tokencost estimates)

All Cohere models use tokencost for estimation.

ModelNice NameContext WindowMax OutputMethod
command-r-plusCommand R+128,0004,096tokencost
command-rCommand R128,0004,096tokencost

Other Providers

๐Ÿ“Š Approximation (tokencost estimates)

ModelNice NameContext WindowMax OutputMethod
github-copilotGitHub Copilot8,1924,096tokencost
genericGeneric (GPT-4 compatible)8,1924,096tokencost

All Other Models

๐Ÿ“Š Smart Estimates

The following providers all use tokencost for smart estimation:

Meta Llama Models:

ModelNice NameContext WindowMax Output
llama-3.1-405bLlama 3.1 405B128,0004,096
llama-3.1-70bLlama 3.1 70B128,0002,048
llama-3.1-8bLlama 3.1 8B128,0002,048
llama-3.3-70bLlama 3.3 70B128,0004,096

xAI Grok Models:

ModelNice NameContext WindowMax Output
grok-betaGrok Beta131,072131,072
grok-4Grok 4256,000256,000

Mistral AI Models:

ModelNice NameContext WindowMax Output
mistral-largeMistral Large128,000128,000
mistral-smallMistral Small32,0008,191
codestralCodestral32,0008,191

Perplexity AI Models:

ModelNice NameContext WindowMax Output
perplexity-sonar-smallPerplexity Sonar Small127,072127,072
perplexity-sonar-largePerplexity Sonar Large127,072127,072

Cohere Models:

ModelNice NameContext WindowMax Output
command-r-plusCommand R+128,0004,096
command-rCommand R128,0004,096

Other:

ModelNice NameContext WindowMax Output
github-copilotGitHub Copilot8,1924,096
genericGeneric (GPT-4 compatible)8,1924,096

Model Naming System

Each model can be referenced using any of three naming conventions:

  1. Technical Name (recommended): gpt-4, claude-3.5-sonnet, llama-3.1-70b
  2. Nice Name (human-friendly): "GPT-4", "Claude 3.5 Sonnet", "Llama 3.1 70B"
  3. Tokencost Name (legacy): varies by model, used internally

The plugin automatically resolves any of these name types for configuration and selection.

GitHub Copilot Host Mode

If you access models through GitHub Copilot, all models are capped at a 128,000 token context window regardless of their native limit. Enable this in your config:

require("token-count").setup({
  model = "claude-4.6-opus",
  copilot_host = true, -- Caps effective context window at 128k
})

When copilot_host = true:

  • Models with a native context window โ‰ค128k are unaffected
  • Models with a native context window >128k (e.g. Claude 4.6 Opus at 1M, GPT-4.1 at ~1M) are capped to 128,000 tokens for all percentage calculations, warnings, and UI displays
  • The Telescope model picker preview will note when a model's context is being capped

Accuracy Summary

Quick Reference

Best Accuracy (Exact, Local):

  • OpenAI: All GPT models, o1 models, GPT-5 series
  • DeepSeek: deepseek-chat, deepseek-coder

Smart Estimates (~95% accurate):

  • Everything else: Claude, Gemini, Llama, Grok, Mistral, etc.

Optional Exact Counting:

  • Anthropic: Set ANTHROPIC_API_KEY + enable in config
  • Google: Set GOOGLE_API_KEY + enable in config

Model Selection

Use :TokenCountModel to browse and switch between models. The plugin supports multiple naming formats - you can refer to models by their technical name (gpt-4o), nice name (GPT-4o), or search by provider.

Performance Notes

  • Large files (>512KB) in file explorers get estimated counts marked with * to keep things fast
  • Active/visible files always get full accurate counts regardless of size
  • Background processing happens when you're not typing to avoid UI lag