{"uid":"cap_yWoMWOrPn0WWJAxapQKl9","slug":"x402node-token-counter-63d9208c","name":"x402node Token Counter","description":"Exact BPE token count for GPT-4o, GPT-4 and GPT-3.5 plus Claude and Llama estimates, for budgeting LLM context and cost before an API call. token count, tokenizer, count tokens, context length, llm cost estimate, tiktoken","url":"https://api.x402node.dev/ai/token-count","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"text":{"type":"string","description":"Text to tokenize (required, max 200KB)"},"model":{"type":"string","description":"Model: gpt-4o (default), gpt-4, gpt-3.5"}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","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.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_bPNkiRTJqOIsebTSixn1q","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","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 GPT-4o/GPT-4/GPT-3.5 and estimates for Claude and Llama, for LLM context budgeting and cost estimation before making an API call.","exampleAgentPrompt":"How many tokens would this system prompt use for GPT-4o: 'You are a helpful assistant. Always respond concisely and cite your sources when making factual claims.' — and give me the Claude estimate too so I can plan my API budget.","exampleUseCases":null,"resultDescription":"Returns exact BPE token counts for GPT-4o, GPT-4, and GPT-3.5 models, plus heuristic estimates for Claude and Llama models, allowing the caller to budget context window usage and estimate API costs before making an LLM call.","failureModes":["Empty or missing text body returns a 400 validation error","Unsupported model name may fall back to heuristic estimate or error","Very long inputs may time out or exceed payload limits","Malformed JSON request body returns a parse error"],"whenToPreferThis":"Use this endpoint when you need to pre-flight check whether a prompt or document will fit within an LLM's context window, or when you want to estimate API costs across multiple model families (OpenAI, Anthropic, Meta) before committing to a call. Prefer this over building your own tiktoken integration when working in environments without native library support.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T19:03:04.166Z","isFirstParty":false}