curl --request POST \
--url https://api.iotools.cloud/v1/tool/llm-token-count-estimator \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inputText": "Hello, world!",
"model": "gpt-4o",
"outputTokens": "500"
}
'{
"tool": "llm-token-count-estimator",
"tool_version": "1.0.1",
"outputs": {
"stats": [
{
"metric": "Est. tokens",
"value": "4"
},
{
"metric": "Words",
"value": "2"
},
{
"metric": "Characters",
"value": "13"
},
{
"metric": "Characters (no spaces)",
"value": "12"
},
{
"metric": "Tokens / word",
"value": "2.00"
},
{
"metric": "Chars / token",
"value": "3.25"
}
],
"contextHtml": "<div style=\"background:#f8f9fa;border-radius:8px;padding:16px\"><div style=\"display:flex;justify-content:space-between;font-size:0.85rem;margin-bottom:8px\"><span><strong>GPT-4o</strong> context window</span><span><strong style=\"color:#464aff\"><0.01%</strong> · 4 / 128,000 tokens</span></div><div style=\"height:14px;background:#e9ecef;border-radius:7px;overflow:hidden\"><div style=\"height:100%;background:#464aff;width:0.003%;border-radius:7px\"></div></div><div style=\"margin-top:8px;font-size:0.78rem;color:#6c757d\">Remaining: 127,996 tokens</div></div>",
"costTable": [
{
"model": "→ GPT-4o",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "<$0.01",
"total": "<$0.01"
},
{
"model": "GPT-4o mini",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "<$0.01",
"total": "<$0.01"
},
{
"model": "GPT-4 Turbo",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "$0.0150",
"total": "$0.0150"
},
{
"model": "GPT-4",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "$0.0300",
"total": "$0.0301"
},
{
"model": "GPT-3.5 Turbo",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "<$0.01",
"total": "<$0.01"
},
{
"model": "o1",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "$0.0300",
"total": "$0.0301"
},
{
"model": "o1-mini",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "<$0.01",
"total": "<$0.01"
},
{
"model": "Claude 3.5 Sonnet",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "<$0.01",
"total": "<$0.01"
},
{
"model": "Claude 3 Opus",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "$0.0375",
"total": "$0.0376"
},
{
"model": "Claude 3 Haiku",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "<$0.01",
"total": "<$0.01"
},
{
"model": "Gemini 1.5 Pro",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "<$0.01",
"total": "<$0.01"
},
{
"model": "Gemini 1.5 Flash",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "<$0.01",
"total": "<$0.01"
}
],
"vizHtml": "<div style=\"font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:0.88rem;line-height:1.8;white-space:pre-wrap;word-break:break-word\"><span style=\"background:rgba(70,74,255,0.18);border-radius:3px;padding:1px 0\">Hell</span><span style=\"background:rgba(139,92,246,0.18);border-radius:3px;padding:1px 0\">o</span><span style=\"background:rgba(14,165,233,0.18);border-radius:3px;padding:1px 0\">,</span><span style=\"background:rgba(16,185,129,0.18);border-radius:3px;padding:1px 0\"> worl</span><span style=\"background:rgba(245,158,11,0.18);border-radius:3px;padding:1px 0\">d</span><span style=\"background:rgba(236,72,153,0.18);border-radius:3px;padding:1px 0\">!</span></div><div style=\"font-size:0.78rem;color:#6c757d;margin-top:8px\">Colors alternate per token. Counts are heuristic estimates, not exact tiktoken output.</div>"
},
"credits_used": 3,
"credits_remaining": null
}Utilities
LLM Token Count Estimator
Estimate how many tokens your text will use across GPT-4o, Claude, Gemini and more, with a context-window gauge and side-by-side API cost estimates. Approximate (chars-per-token heuristic), not an exact tokenizer.
POST
/
v1
/
tool
/
llm-token-count-estimator
curl --request POST \
--url https://api.iotools.cloud/v1/tool/llm-token-count-estimator \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"inputText": "Hello, world!",
"model": "gpt-4o",
"outputTokens": "500"
}
'{
"tool": "llm-token-count-estimator",
"tool_version": "1.0.1",
"outputs": {
"stats": [
{
"metric": "Est. tokens",
"value": "4"
},
{
"metric": "Words",
"value": "2"
},
{
"metric": "Characters",
"value": "13"
},
{
"metric": "Characters (no spaces)",
"value": "12"
},
{
"metric": "Tokens / word",
"value": "2.00"
},
{
"metric": "Chars / token",
"value": "3.25"
}
],
"contextHtml": "<div style=\"background:#f8f9fa;border-radius:8px;padding:16px\"><div style=\"display:flex;justify-content:space-between;font-size:0.85rem;margin-bottom:8px\"><span><strong>GPT-4o</strong> context window</span><span><strong style=\"color:#464aff\"><0.01%</strong> · 4 / 128,000 tokens</span></div><div style=\"height:14px;background:#e9ecef;border-radius:7px;overflow:hidden\"><div style=\"height:100%;background:#464aff;width:0.003%;border-radius:7px\"></div></div><div style=\"margin-top:8px;font-size:0.78rem;color:#6c757d\">Remaining: 127,996 tokens</div></div>",
"costTable": [
{
"model": "→ GPT-4o",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "<$0.01",
"total": "<$0.01"
},
{
"model": "GPT-4o mini",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "<$0.01",
"total": "<$0.01"
},
{
"model": "GPT-4 Turbo",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "$0.0150",
"total": "$0.0150"
},
{
"model": "GPT-4",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "$0.0300",
"total": "$0.0301"
},
{
"model": "GPT-3.5 Turbo",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "<$0.01",
"total": "<$0.01"
},
{
"model": "o1",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "$0.0300",
"total": "$0.0301"
},
{
"model": "o1-mini",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "<$0.01",
"total": "<$0.01"
},
{
"model": "Claude 3.5 Sonnet",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "<$0.01",
"total": "<$0.01"
},
{
"model": "Claude 3 Opus",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "$0.0375",
"total": "$0.0376"
},
{
"model": "Claude 3 Haiku",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "<$0.01",
"total": "<$0.01"
},
{
"model": "Gemini 1.5 Pro",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "<$0.01",
"total": "<$0.01"
},
{
"model": "Gemini 1.5 Flash",
"input-tokens": "4",
"input-cost": "<$0.01",
"output-cost": "<$0.01",
"total": "<$0.01"
}
],
"vizHtml": "<div style=\"font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:0.88rem;line-height:1.8;white-space:pre-wrap;word-break:break-word\"><span style=\"background:rgba(70,74,255,0.18);border-radius:3px;padding:1px 0\">Hell</span><span style=\"background:rgba(139,92,246,0.18);border-radius:3px;padding:1px 0\">o</span><span style=\"background:rgba(14,165,233,0.18);border-radius:3px;padding:1px 0\">,</span><span style=\"background:rgba(16,185,129,0.18);border-radius:3px;padding:1px 0\"> worl</span><span style=\"background:rgba(245,158,11,0.18);border-radius:3px;padding:1px 0\">d</span><span style=\"background:rgba(236,72,153,0.18);border-radius:3px;padding:1px 0\">!</span></div><div style=\"font-size:0.78rem;color:#6c757d;margin-top:8px\">Colors alternate per token. Counts are heuristic estimates, not exact tiktoken output.</div>"
},
"credits_used": 3,
"credits_remaining": null
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
Tool output
Show child attributes
Show child attributes
The tool's slug, echoing the {slug} in the request path.
Output-contract version for this tool.
Credits this call consumed, after any settlement refund. 0 when metering is disabled.
Credits left in the current monthly allowance, or null when metering is disabled.
Correlation id, also sent as x-request-id.
Was this page helpful?
⌘I