81trust / 100
Dev Token Estimator
by AgentTools in Onchain & crypto
x402 APIPassing, checked 1 h ago
Estimate how many tokens a text consumes for each major model family (GPT, Claude, Gemini, Llama, DeepSeek) using a character/word heuristic that is within ~10% of real BPE tokenizers — enough for context budgeting and cost math, with zero dependencies. Use this when an agent needs to approximate token counts per LLM family, ±10%.
GET https://agenttools-hub.vercel.app/api/v1/dev/token-estimator
Last 30 days
All checks passedSome failedAll failedNot checked
- Uptime
- 100%
- Response time
- 144 ms typical, 144 ms slowest 5%
- Last check
- 1 h ago
- Next check
- any minute now
How to call it
# See the payment challenge (nothing is charged)
curl -i -X GET "https://agenttools-hub.vercel.app/api/v1/dev/token-estimator?text=The+quick+brown+fox+jumps+over+the+lazy+dog.+Pack+my+box+with+five+dozen+liquor+jugs."import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client().register(
"eip155:8453",
new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);
// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fagenttools-hub.vercel.app%2Fapi%2Fv1%2Fdev%2Ftoken-estimator
const res = await pay("https://agenttools-hub.vercel.app/api/v1/dev/token-estimator?text=The+quick+brown+fox+jumps+over+the+lazy+dog.+Pack+my+box+with+five+dozen+liquor+jugs.");
console.log(await res.json());Example input
{
"text": "The quick brown fox jumps over the lazy dog. Pack my box with five dozen liquor jugs."
}Example output
{
"result": {
"answer": "23 tokens (GPT family)",
"answerLabel": "85 chars · ±10% estimate",
"details": [
{
"label": "Characters",
"value": "85"
},
{
"label": "Words",
"value": "17"
},
{
"label": "CJK characters",
"value": "0"
},
{
"label": "Method",
"value": "heuristic (chars/word mix, CJK-aware)"
}
],
"steps": [
"CJK characters count ≈ 1.1 tokens each",
"Other scripts ≈ 3.7 chars/token, blended with words × 1.32",
"Model multipliers applied: 1, 1.06, 1.12, 1.18, 1.1"
],
"table": {
"columns": [
"Model family",
"Est. tokens"
],
"rows": [
[
"gpt-4o / gpt-4.1 / gpt-5 (o200k)",
23
],
[
"claude (Opus / Sonnet / Haiku)",
25
],
[
"gemini 2.5 / 3",
26
],
[
"llama 4 / mistral",
28
],
[
"deepseek v3",
26
]
]
},
"value": 23
},
"tool": "token-estimator"
}Security scan
- No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.
Recent checks
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 1 h ago | Passed | 402 | 200 ms | $0.002 |
| 6 h ago | Passed | 402 | 144 ms | $0.002 |