Text · Tokens
Purpose: count exact tokens (o200k/cl100k) and check a token budget. Exact token counts for prompts and documents in one deterministic call (no LLM, no network): OpenAI BPE encodings o200k_base (GPT-4o / GPT-4.1 / o-series) and cl100k_base (GPT-4 / GPT-3.5 / text-embedding-3), plus chars, words, bytes and approxTokens: a script-aware estimate (CJK / code / other text, separate ratios; method, per-segment breakdown and error range in approx). budget is always checked against the exact BPE count, never the estimate. Send {text} or up to 100 {texts} (per-item and total counts). Optional maxTokens
POST https://newbotlabor--254ecdfcc2de11f19b541607ee4eb77e.web.val.run/api/text/tokens
0.002 USDC on Base · payTo 0x174897b2c5B133feB08A8FB90856B08F9fce8647
Status: verified · payable
Settlement: via OMNIGATE (https://omnigate.scriptmasterlabs.com) — seller opted in; receipt token per settlement; 0.005 USDC fee inside settlement, waived inside the daily budget
Payment routes
{
"text": "Pay 0.002 USDC per call via x402. ä½ å¥½ä¸ç!",
"maxTokens": 8
}{
"encodings": [
"o200k_base",
"cl100k_base"
],
"chars": 39,
"bytes": 47,
"words": 9,
"approxTokens": 10,
"approx": {
"method": "script-segmented-v1",
"basis": "o200k_base",
"tokens": 10,
"relativeError": 0.18,
"range": [
8,
12
],
"segments": {
"cjk": {
"chars": 4,
"tokens": 3
},
"code": {
"chars": 0,
"tokens": 0
},
"other": {
"chars": 35,
"tokens": 7
}
},
"legacyChars4": 10
},
"tokens": {
"o200k_base": 17,
"cl100k_base": 20
},
"budget": {
"maxTokens": 8,
"encoding": "o200k_base",
"fits": false,
"overBy": 9,
"counted": 17,
"basis": {
"counts": "exact o200k_base BPE tokens of the raw text (special-token text counted as text), not approxTokens",
"scope": "the single text",
"excludes": "chat-format overhead (role/message wrapper tokens), system prompt, tools and the model's reply"
},
"truncated": {
"text": "Pay 0.002 USDC per",
"tokens": 8,
"chars": 18
}
}
}