{"uid":"cap_QUDgTBmQyTgsmDzyK2Ux-","slug":"strale-token-count-6a69d6ae","name":"Strale Token Count","description":"The trust layer for AI agents — 250+ independently tested data capabilities across 27 countries. Execute capabilities via REST, MCP, A2A, or x402 micropayments. Every call returns an audit record with cryptographic chain hashing.","url":"https://api.strale.io/x402/v2/token-count","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET","HEAD","DELETE"],"type":"string"},"queryParams":{"type":"object","required":["text"],"properties":{"text":{"type":"string"},"model":{"type":"string","description":"gpt-4o, claude-3-haiku, etc."}}}},"additionalProperties":false}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.0216","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.0216/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0216","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0216","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_TVdWDZEddiY5x6nHQUgqV","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.0216","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Count the number of tokens in a text string for a specified LLM model (e.g. gpt-4o, claude-3-haiku)","exampleAgentPrompt":"How many tokens is the following text when tokenized for gpt-4o: 'The quick brown fox jumps over the lazy dog. This is a sample sentence to test tokenization.'","exampleUseCases":[{"title":"Pre-flight prompt token budget check","prompt":"Before I send this system prompt to gpt-4o, can you count how many tokens it uses? Here's the text: 'You are a helpful assistant specialized in customer support for a SaaS company. Always respond in a friendly, concise manner and escalate billing issues to the finance team.'"},{"title":"Fit document into Claude context window","prompt":"I need to know if this article fits within claude-3-haiku's context window — can you count its tokens? The text is: 'Artificial intelligence is transforming industries worldwide, from healthcare diagnostics to autonomous vehicles and financial risk modeling.'"},{"title":"LLM cost estimation before batch job","prompt":"I'm about to process thousands of records and need to estimate costs — can you count the tokens in this template text for gpt-4o: 'Summarize the following customer feedback and classify it as positive, negative, or neutral: {feedback}'"}],"resultDescription":"Returns the token count for the provided text string as tokenized by the specified LLM model, along with a cryptographically hashed audit record for provenance and traceability.","failureModes":["Missing required 'text' query parameter returns a 400 error","Unsupported or misspelled model name may return an error or fall back to a default tokenizer","Empty text string may return zero tokens or a validation error","Payment failure via x402 protocol results in 402 response before processing begins","Rate limiting or quota exhaustion returns a 429 error"],"whenToPreferThis":"Use this endpoint when you need accurate, model-specific token counts before sending prompts to an LLM — particularly for cost estimation, context window validation, or prompt engineering workflows. It is preferable over client-side tokenization libraries when you need audit-trail records of token counts (e.g. for billing reconciliation or compliance), or when you want a neutral third-party count without depending on each provider's own SDK.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T18:48:27.463Z","isFirstParty":false}