{"uid":"cap_VMv_onyemawwM9kqiZqBU","slug":"text-statistics-api-65600bd7","name":"Text Statistics API","description":"Decision-grade security/due-diligence outcome reports ($20-$100) plus deterministic paid utilities ($0.001+) for software agents and automated workflows.","url":"https://api.bakhour.ca/text/stats","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"text":{"type":"string"}}},"responseSchema":{"type":"json","example":{"lines":1,"words":2,"bytes_utf8":11,"characters":11,"characters_no_whitespace":10}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","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.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_RM_Zp2d_5fz0IiA6v3dQL","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes character, word, line, and byte counts for a given text string","exampleAgentPrompt":"Can you give me the full stats on this text — word count, line count, character count with and without whitespace, and UTF-8 byte size: 'Hello world, this is a test sentence.'","exampleUseCases":[{"title":"Validate token limits before API call","prompt":"Before I send this prompt to the LLM, can you tell me how many characters and bytes it is so I can check it fits within the limit? Here's the text: 'You are a helpful assistant. Answer the following question concisely...'"},{"title":"Check word count for content submission","prompt":"I need to verify my article excerpt is under 250 words — can you count the words in this passage: 'The quick brown fox jumps over the lazy dog. This is a sample article body...'"},{"title":"Measure localized string byte size","prompt":"Can you tell me the UTF-8 byte size and character count of this string I'm about to store in a database field: '日本語のテキストサンプルです'"}],"resultDescription":"A JSON object containing: lines (number of newline-delimited lines), words (whitespace-separated word count), bytes_utf8 (byte length in UTF-8 encoding), characters (total character count), and characters_no_whitespace (character count excluding all whitespace).","failureModes":["Missing or empty 'text' field in request body — likely returns a 400 or error response","Extremely large text inputs may time out or hit payload size limits","Non-string values for 'text' field may cause parsing errors","Payment failure or insufficient USDC balance results in 402 Payment Required, blocking the request"],"whenToPreferThis":"Choose this endpoint when you need precise, deterministic text statistics — particularly UTF-8 byte counts — as part of an automated pipeline. Ideal for agents that need to enforce character limits, measure storage requirements, or validate content length before passing text to downstream systems. Prefer this over client-side counting when byte-accurate UTF-8 measurement is required (e.g. for multibyte/Unicode text).","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T18:49:25.193Z","isFirstParty":false}