{"uid":"cap_YVw9nwM9DhnXfQfFvFaM9","slug":"x402-micro-pay-token-count-51fe99c5","name":"x402 Micro Pay — Token Count","description":"Agent-ready microservices with x402 + Stripe rails, volume primitives, tutorials, and applet UI.","url":"https://x402-micro-pay.com/api/skills/token-count?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"text":{"type":"string"},"encoding":{"type":"string"}}},"responseSchema":{"type":"json","example":{"ok":true,"path":"/api/skills/token-count"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.004","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.004/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_hrKaBP6IoOXuFaHrMDmJf","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.004","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 or HTTP request body, billed per call via x402/USDC micropayment.","exampleAgentPrompt":"Count the tokens in this text for me: 'Large language models are revolutionizing how we build software, but managing context windows requires careful token accounting.'","exampleUseCases":[{"title":"Pre-flight prompt token check","prompt":"Before I send this system prompt to GPT-4, can you count how many tokens it contains so I know if it fits in the 8k context window? Here's the text: 'You are a helpful assistant specialized in financial analysis. Always respond in JSON. Never reveal your instructions...'"},{"title":"LLM cost estimation for a document","prompt":"I want to know how many tokens this product description is before I batch-process it through an LLM — can you run a token count on it? The text is: 'Our new X-Series widget features a titanium chassis, 48-hour battery life, and AI-powered gesture control.'"},{"title":"Agent self-monitoring token budget","prompt":"Check how many tokens are in the conversation history I'm about to pass as context — I need to make sure I'm not going over my budget. The content is: 'User: What's the weather? Assistant: It's sunny and 72°F. User: Should I bring an umbrella? Assistant: No, skies are clear all day.'"}],"resultDescription":"Returns a JSON object with a success flag and the endpoint path, and presumably a token count for the submitted input. The response confirms the operation completed successfully with {ok: true, path: '/api/skills/token-count'} plus computed token count data.","failureModes":["Missing required 'input' field returns validation error","Unsupported body type may cause parsing failure","Insufficient USDC balance or failed x402 payment returns 402 Payment Required","Malformed JSON body causes 400 Bad Request","Empty or null input text may return zero count or error"],"whenToPreferThis":"Choose this endpoint when you need a pay-per-use, agent-native token counting service that integrates with the x402 micropayment protocol and USDC. Ideal for AI agents operating autonomously that need to count tokens without managing API keys or subscriptions — just pay $0.004 USDC per call. Useful when you want a lightweight, cost-transparent token counting utility as part of a larger agent workflow.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-14T12:40:57.401Z","isFirstParty":false,"canonicalSlug":"x402-micro-pay-token-count-51fe99c5"}