Token Counter & Text Stats API: Tokens, Language, Readability
Pricing
$1.00 / 1,000 text analyses
Token Counter & Text Stats API: Tokens, Language, Readability
Count LLM tokens (exact OpenAI tiktoken, Claude/Gemini estimates), estimate cost, detect language, readability scores, words, sentences and reading time, and truncate text to a token budget.
Pricing
$1.00 / 1,000 text analyses
Rating
0.0
(0)
Developer
Tudor Lane
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
8 days ago
Last modified
Categories
Security
Limited permissionsShare
Use when: an AI agent or pipeline needs to know, before calling a model, how many tokens a text is (exact for OpenAI, estimated for Claude and Gemini), whether it fits a token budget (and cut it to fit), roughly what it will cost, what language it is in, or how readable it is.
Try this input
{"requests": [{"text": "The quick brown fox jumps over the lazy dog. Agents love cheap tools."}, {"text": "Le renard brun rapide saute par-dessus le chien paresseux."}, {"text": "Summarise this long support ticket before sending it to the model, please.", "max_tokens": 5, "truncate": true}]}
Sample output (real run, 30 Oct 2026, trimmed)
{"words": 13, "sentences": 2, "language": "en", "tokens": {"o200k_base (GPT-4o/4.1/5)": 15, "cl100k_base (GPT-4/3.5)": 15, "claude_estimate": 16, "gemini_estimate": 17},"flesch_reading_ease": 96.1, "flesch_kincaid_grade": 1.5, "reading_time_seconds": 3.3, "est_input_cost_usd": {"gpt-4o": 0.000037, "gpt-4o-mini": 0.000002}, "error": null}{"words": 10, "language": "fr", "tokens": {"o200k_base (GPT-4o/4.1/5)": 14, "cl100k_base (GPT-4/3.5)": 18, "claude_estimate": 20, "gemini_estimate": 14}, "reading_time_seconds": 2.5, "error": null}{"words": 12, "language": "en", "tokens": {"o200k_base (GPT-4o/4.1/5)": 16}, "fits_max_tokens": false, "truncated_text": "Summarise this long", "error": null}
Each item needs text, with optional max_tokens (adds fits_max_tokens, checked against o200k_base) and truncate: true (adds truncated_text, cut to max_tokens o200k tokens). Every row also has chars, chars_no_spaces, paragraphs, lines, language_candidates (top 3 with probabilities) and est_input_cost_usd for gpt-4o, gpt-4o-mini, claude-sonnet (est.) and gemini-flash (est.). Up to 5000 items per run (text up to 2M characters each); no API key needed.
Pricing: pay per event, $0.001 per text analysed. Rows with errors (e.g. empty text) are not charged.
Limits & failure modes
- Claude and Gemini token counts are estimates (cl100k × 1.1 and characters ÷ 4), not their official tokenizers.
- Cost estimates are input-only, use fixed list prices for a few models, and may be out of date.
- Readability scores (Flesch) are English only; other languages get reading time only.
- Language detection (langdetect, 55 languages) is unreliable on very short text.
- Sentence counting is punctuation-based, so lists and headings without full stops count as one sentence.
- Open-source libraries: tiktoken (MIT), langdetect (Apache 2.0).
Last tested: 30 Oct 2026.
Use from AI agents (MCP)
- Apify MCP server: add
https://mcp.apify.com/?tools=tudorlane/text-toolkitto Claude, Cursor, ChatGPT, VS Code or any MCP client. - REST:
POST https://api.apify.com/v2/acts/tudorlane~text-toolkit/run-sync-get-dataset-items?token=YOUR_TOKENwith the input JSON.