{"inline_business":{"token-counter":{"target_model":"Target AI Model","price_input":"Input Price (Prompt):","price_output":"Output Price (Completion):","total_tokens":"Estimated Tokens","characters":"Characters","words":"Words","lines":"Lines","est_prompt_cost":"Est. Prompt Cost","est_output_cost":"Est. Output Cost","context_usage":"Context Window Usage","input_text":"Text to Analyze","placeholder_text":"Paste your prompt, document, or code here...","copy_text":"Copy text","copied":"Copied!","depending_on_model":"depending on chosen model","sample_text":"Generative artificial intelligence is rapidly transforming software development. Modern language models (LLMs) such as GPT-4o, Gemini 2.0 Flash and Claude 3.5 Sonnet can understand and generate code, write summaries and automate complex tasks.\n\nfunction calculateTokenCount(text: string): number {\n // Approximate BPE tokenizer logic for Multilingual text & Code\n const words = text.trim().split(/\\s+/).length;\n const chars = text.length;\n return Math.ceil(chars / 4);\n}","tokens_per_word":"~{{value}} tokens/word","spaces_included":"spaces included","tokens_max":"tokens max","load_example":"Load an example","clear":"Clear","output_cost_same_length":"Same-length reply: {{value}}"}},"docs_business":{"tools":{"token_counter":{"content":{"title":"Estimating a text's tokens and the cost of an LLM API call","intro":"The tool estimates the token count without an official tokenizer: characters ÷ 3.9, plus 0.3 token per code symbol and 0.8 per non-ASCII character (accents, emojis), with at least one token per word. The prompt cost is tokens ÷ 1,000,000 × the model's input price. Expect roughly 1 token per 4 characters of plain English; other languages and code need more.","details":"
The English sample text (474 characters, 61 words, 36 symbols, no accented characters) gives 133 tokens, or $0.00002 with GPT-4o mini at $0.15 per million. An English text of 100,000 characters with 2,222 full stops gives 26,306 tokens: $0.066 of input with GPT-4o at $2.50 per million, and 20.6% of its 128,000-token window.
Sources and dates: OpenAI model pages (GPT-4o: $2.50 / $10, GPT-4o mini: $0.15 / $0.60 per million tokens); Anthropic \"Model deprecations\" page; Gemini API \"Gemini deprecations\" page and release notes (checked 14/10/2026).
"}},"token-counter":{"faqs":[{"question":"How many characters are in a token?","answer":"In plain English, about 4 characters, or roughly three quarters of a word; the tool uses 3.9 characters per token. Accents, code punctuation and emojis add tokens: the same sample text gives 152 tokens in French against 133 in English."},{"question":"How much does a 10,000-token prompt cost with GPT-4o?","answer":"Input: 10,000 ÷ 1,000,000 × $2.50 = $0.025. If the model replies with 1,000 tokens, add 1,000 ÷ 1,000,000 × $10 = $0.01 at the output price. The tool shows the prompt cost and the cost of a reply as long as the text entered."},{"question":"Is the token count shown exact?","answer":"No, it is a formula-based estimate without the models' real tokenizer. For an exact count, use OpenAI's tiktoken library or Anthropic's token-counting API endpoint; billing is based on the number the API returns in any case."},{"question":"What happens if my text exceeds the context window?","answer":"The API rejects the request or truncates the history, depending on the service. The tool's bar caps at 100% and is calculated as tokens ÷ the model's window, for example 128,000 tokens for GPT-4o. Remember to leave room for the answer."}]}}}}