# TextKit Grapheme Count

> TextKit Grapheme Count is a paid API for AI agents from textkit.johnaio281.workers.dev, paid per call via x402, $0.003/call, status unknown (last checked 2026-10-22).

Counts the number of Unicode grapheme clusters, code points, UTF-16 units, and bytes in a given string

## Facts

- Endpoint: GET https://textkit.johnaio281.workers.dev/api/tk/grapheme-count?utm_source=zero.xyz
- Price: $0.003/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-22
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/textkit-grapheme-count-aedb1020
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_LzxWQk0vodq011T3Go1QE

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability textkit-grapheme-count-aedb1020
```

Example prompt: How many visible characters (graphemes) are in the string '👨‍👩‍👧‍👦🏳️‍🌈' — I need the grapheme count, code point count, UTF-16 units, and byte count?

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

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.

## Output

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).

## Request schema (JSON Schema)

```json
{
 "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"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "bytes": 18,
  "graphemes": 1,
  "codePoints": 5,
  "utf16Units": 11
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/textkit-grapheme-count-aedb1020/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from textkit.johnaio281.workers.dev](https://www.zero.xyz/host/textkit.johnaio281.workers.dev/llms.txt)
