{"uid":"cap_R1iK7epslqPt6BDdTq5r0","slug":"vextorium-token-counter-344dfb3f","name":"Vextorium Token Counter","description":"Count the tokens of a text with OpenAI tokenizers (o200k for GPT-4o/4.1/5, cl100k for GPT-4/3.5) plus estimates for Claude, Llama and Gemini, with characters per token. Budget LLM calls and split contexts.","url":"https://api.vextorium.com/contar-tokens-pago?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"required":["texto"],"properties":{"texto":{"type":"string"},"modelo":{"enum":["o200k_base","cl100k_base"],"type":"string"}}},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":["object","null"],"properties":{"nota":{"type":["string","null"]},"tokens":{"type":["number","null"]},"palabras":{"type":["number","null"]},"caracteres":{"type":["number","null"]},"codificacion":{"type":["string","null"]},"estimaciones":{"type":["object","null"],"properties":{"claude_aprox":{"type":["number","null"]},"gemini_aprox":{"type":["number","null"]},"llama3_aprox":{"type":["number","null"]}}},"caracteres_por_token":{"type":["number","null"]},"tokens_otra_codificacion":{"type":["object","null"],"properties":{"cl100k_base":{"type":["number","null"]}}}}}}}}},"responseSchema":{"type":"json","example":{"nota":"Recuento exacto para las codificaciones de OpenAI; el resto son estimaciones (cada modelo tokeniza distinto).","tokens":53,"palabras":40,"caracteres":282,"codificacion":"o200k_base","estimaciones":{"claude_aprox":58,"gemini_aprox":50,"llama3_aprox":54},"caracteres_por_token":5.32,"tokens_otra_codificacion":{"cl100k_base":56}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.003","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"registry","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.003/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_Quzqu2MYKmkW_bicCb_c2","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.003","costPer":"request","priority":0,"asset":null,"unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Counts tokens in text using OpenAI tokenizers (o200k_base for GPT-4o/4.1/5, cl100k_base for GPT-4/3.5) and provides approximate token counts for Claude, Llama 3, and Gemini, plus characters-per-token ratio.","exampleAgentPrompt":"How many tokens is this text using the o200k_base tokenizer (GPT-4o), and give me estimates for Claude, Gemini, and Llama 3 too: 'The quick brown fox jumps over the lazy dog. This is a sample sentence to test tokenization across different language models.'","exampleUseCases":[{"title":"LLM cost budgeting before API call","prompt":"Before I send this 5000-word article to GPT-4o, can you count exactly how many tokens it uses with o200k_base and estimate what it would cost me in tokens?"},{"title":"Context window fit check","prompt":"I need to know if this system prompt plus user message will fit in GPT-4's 128k context window — count the tokens using cl100k_base and tell me how much room is left."},{"title":"Cross-model token comparison","prompt":"Count the tokens in my text 'Artificial intelligence is transforming industries worldwide by automating complex tasks and enabling new capabilities.' using o200k_base and give me the approximate token counts for Claude, Gemini, and Llama 3 as well."}],"resultDescription":"Returns exact token count for the requested OpenAI tokenizer, approximate token counts for Claude, Gemini, and Llama 3, word count, character count, characters-per-token ratio, and the token count for the alternate OpenAI encoding (cl100k_base), along with a note clarifying that non-OpenAI counts are estimates.","failureModes":["Missing 'texto' field in body returns a validation error","Invalid 'modelo' enum value returns a schema error","Empty string input may return zero counts","Network timeout for very large text inputs","Payment failure if USDC balance is insufficient for x402 micropayment"],"whenToPreferThis":"Choose this endpoint when you need precise OpenAI token counts (o200k or cl100k) combined with cross-model estimates for Claude, Gemini, and Llama 3 in a single call. Ideal for LLM cost budgeting, context window management, and multi-model planning without setting up tiktoken locally. Prefer this over building your own tokenizer when running in an agent or serverless environment without Python dependencies.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-11T00:49:21.407Z","isFirstParty":false,"canonicalSlug":"vextorium-token-counter-344dfb3f"}