{"uid":"cap_qfLRiLTVRlnkNYQfpDSPn","slug":"busker-token-counter-70728fad","name":"Busker Token Counter","description":"Exact BPE token counts for OpenAI-family encodings (o200k_base for GPT-4o/4.1/5, cl100k_base for GPT-4/3.5/embeddings), single text or batches, with optional truncation to a token budget. Up to 512 KB per call.","url":"https://workbot1.oddsys.org/tokens?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"text":{"type":"string","description":"Text to count."},"texts":{"type":"array","items":{"type":"string"},"maxItems":100,"description":"Batch of texts."},"encoding":{"enum":["o200k_base","cl100k_base"],"type":"string","description":"BPE encoding (default o200k_base)."},"truncate":{"type":"integer","description":"Token budget — when exceeded the response includes the text cut to this many tokens."}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","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.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_qyzF-dOeJ5C1aG4-ZFltf","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Returns exact BPE token counts for OpenAI-family encodings (o200k_base or cl100k_base) for a single text or batch of up to 100 texts, with optional truncation to a token budget.","exampleAgentPrompt":"How many o200k_base tokens is this text: 'The quick brown fox jumps over the lazy dog'? Also truncate it to 5 tokens if it exceeds that budget.","exampleUseCases":[{"title":"Prompt fits-in-context check","prompt":"Before I send this system prompt to GPT-4o, can you tell me exactly how many o200k_base tokens it uses? Here's the text: 'You are a helpful assistant. Always respond concisely and cite your sources.'"},{"title":"Batch token audit for fine-tuning dataset","prompt":"I have 20 training examples I'm preparing for fine-tuning. Can you count the cl100k_base tokens for each of them so I can filter out any that exceed 4096 tokens?"},{"title":"Smart truncation for embeddings pipeline","prompt":"I need to embed this document but the embeddings model has a 8191 token limit — can you count the cl100k_base tokens and truncate it to 8000 tokens if it's over the limit?"}],"resultDescription":"Returns exact integer token count(s) for each input text under the specified BPE encoding, plus truncated text (and its token count) if a truncate budget was supplied and exceeded. For batch requests, results are returned per item.","failureModes":["Input exceeds 512 KB per call — request rejected","Batch exceeds 100 items — validation error","Invalid or missing encoding value defaults to o200k_base but may return error if malformed","Empty text input may return 0 tokens or an error depending on implementation","Payment failure (x402) blocks the call before processing"],"whenToPreferThis":"Use this endpoint when you need guaranteed-accurate BPE token counts matching OpenAI's actual tokenizer — not an approximation — especially for prompt budget management, context window checks, or preprocessing pipelines before calling OpenAI APIs. Prefer this over heuristic character-count estimates or client-side approximations when exact token accounting matters (e.g., fine-tuning, embeddings, cost estimation).","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-11T12:39:43.846Z","isFirstParty":false,"canonicalSlug":"busker-token-counter-70728fad"}