{"uid":"cap_LzxWQk0vodq011T3Go1QE","slug":"textkit-grapheme-count-aedb1020","name":"TextKit Grapheme Count","description":"General-purpose text, Unicode and date utilities for AI agents: homoglyph folding and spoofed-domain detection, Unicode script detection, NFC/NFD normalization, grapheme counting, date description (weekday, ISO week, quarter, leap year), business-day counting, slugify, FNV-1a hashing, Shannon entropy, string format detection (uuid, email, url, ipv4, jwt, iban), byte-encoding detection and human-readable byte sizes. Pay per request in USDC on Base via x402 - no signup, no API key, no KYC.","url":"https://textkit.johnaio281.workers.dev/api/tk/grapheme-count?utm_source=zero.xyz","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"],"type":"string"},"queryParams":{"type":"object","required":["text"],"properties":{"text":{"type":"string"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object"}}}}},"responseSchema":{"type":"json","example":{"bytes":18,"graphemes":1,"codePoints":5,"utf16Units":11}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.003","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.003/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_-eDgKGup98B7JDKXAWdHW","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.003","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 Unicode grapheme clusters, code points, UTF-16 units, and bytes in a given string","exampleAgentPrompt":"How many visible characters (graphemes) are in the string '👨‍👩‍👧‍👦🏳️‍🌈' — I need the grapheme count, code point count, UTF-16 units, and byte count?","exampleUseCases":[{"title":"Emoji-safe character limit validation","prompt":"I'm building a form that allows 140 visible characters max — can you check how many graphemes are in this string: '🏳️‍🌈 Hello wörld 日本語' so I know if it fits?"},{"title":"Database field sizing for Unicode text","prompt":"I need to know the byte length and UTF-16 unit count for the string 'मुझे नहीं पता' so I can make sure it fits in my database column."},{"title":"Debugging character count mismatch","prompt":"My code says this string '👨‍👩‍👧‍👦 family' has 22 characters but it looks like only 8 visible things — can you tell me the actual grapheme count versus code points and UTF-16 units?"}],"resultDescription":"A JSON object with four numeric fields: graphemes (number of user-perceived characters/grapheme clusters), codePoints (number of Unicode scalar values), utf16Units (number of UTF-16 code units, as used by JavaScript's .length), and bytes (UTF-8 byte size of the string).","failureModes":["Missing required 'text' query parameter returns an error","Extremely long strings may time out or exceed worker limits","Non-UTF-8 encoded input may produce unexpected results","Payment failure via x402 protocol results in 402 response before processing"],"whenToPreferThis":"Use this endpoint when you need accurate Unicode-aware character counting that goes beyond naive byte or code-unit counting — especially for strings containing emoji, combining characters, CJK text, or other multi-codepoint grapheme clusters. It is the right choice when enforcing UI character limits, sizing database fields, or debugging length mismatches caused by JavaScript's .length or Python's len() returning unexpected values. Prefer it over manual counting or language-standard string length functions when correctness across scripts and emoji sequences is required.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-22T12:40:48.204Z","isFirstParty":false,"canonicalSlug":"textkit-grapheme-count-aedb1020"}