{"uid":"cap_HMLDnTX1YRqlQubYTZytS","slug":"pennyrail-token-count-fca1cc34","name":"PennyRail Token Count","description":"Machine-readable settlement service","url":"https://pennyrail.vercel.app/api/p/nano/text.token-count--token-count","method":"POST","headers":{},"bodySchema":{"type":"object","required":["input"],"properties":{"input":{"type":"object"}}},"responseSchema":{"type":"object","additionalProperties":true},"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_tyxNigT8nN6LhcqDzSuzp","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":"Counts the number of tokens in a given text input using a paid micro-settlement API endpoint","exampleAgentPrompt":"How many tokens is this text: 'The quick brown fox jumps over the lazy dog and then runs away into the forest'?","exampleUseCases":[{"title":"Pre-flight prompt token check","prompt":"Before I send this system prompt to GPT-4, can you tell me how many tokens it is? Here it is: 'You are a helpful customer support agent for Acme Corp. Always be polite, concise, and accurate...'"},{"title":"Context window budget planning","prompt":"I have a 128k context window and I want to know how many tokens my article uses up — can you count the tokens in this piece: 'Artificial intelligence has transformed the way we approach software development...'?"},{"title":"Batch content size estimation","prompt":"I'm about to process a bunch of user messages and need to know the token count for this one first: 'Please help me understand the differences between supervised and unsupervised machine learning approaches.'"}],"resultDescription":"Returns an object containing the token count and possibly related tokenization metrics for the provided text input, enabling downstream decisions about LLM context usage, cost estimation, or chunking strategies.","failureModes":["Missing or malformed 'input' object in request body returns a validation error","Payment not included or insufficient USDC balance causes a 402 Payment Required response","Empty text input may return zero or trigger an error","Unsupported input types or oversized payloads may result in 4xx errors","Network timeouts or Vercel cold-start latency on the first call"],"whenToPreferThis":"Choose this endpoint when you need a lightweight, pay-per-use token counting service without setting up a local tokenizer library. It is ideal for AI agents that need to dynamically estimate token usage at runtime, especially in serverless or constrained environments where installing tiktoken or similar libraries is impractical. The micro-payment model via x402/USDC means no subscription or API key management is needed.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T07:21:45.485Z","isFirstParty":false}